From b1f772408f87a38751a01a5228f3db66e0d37af1 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:03:46 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E0=B8=94=E0=B8=B6=E0=B8=87=20relations?= =?UTF-8?q?=20=E0=B8=A1=E0=B8=B2=E0=B8=94=E0=B9=89=E0=B8=A7=E0=B8=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileInformationController.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/controllers/ProfileInformationController.ts b/src/controllers/ProfileInformationController.ts index 816bb0c9..8f106478 100644 --- a/src/controllers/ProfileInformationController.ts +++ b/src/controllers/ProfileInformationController.ts @@ -69,7 +69,14 @@ export class ProfileInformationController extends Controller { ], }) public async detailProfileInformation(@Path() profileId: string) { - const getProfileInformation = await this.profileInformationRepo.findBy({ profileId }); + const getProfileInformation = await this.profileInformationRepo.findOne({ + relations: { + bloodGroup: true, + relationship: true, + gender: true, + }, + where: { profileId }, + }); if (!getProfileInformation) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); } @@ -106,8 +113,15 @@ export class ProfileInformationController extends Controller { ], }) public async getProfileInformationHistory(@Path() informationId: string) { - const record = await this.profileInformationHistoryRepo.findBy({ - profileInformationId: informationId, + const record = await this.profileInformationHistoryRepo.find({ + relations: { + bloodGroup: true, + relationship: true, + gender: true, + }, + where: { + profileInformationId: informationId, + }, }); if (!record) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");