diff --git a/src/controllers/ProfileAddressController.ts b/src/controllers/ProfileAddressController.ts index e2edab5f..497d45b7 100644 --- a/src/controllers/ProfileAddressController.ts +++ b/src/controllers/ProfileAddressController.ts @@ -41,7 +41,7 @@ export class ProfileAddressController extends Controller { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } const getProfileAddress = await this.profileRepo.findOne({ - where: { id: request.user.sub }, + where: { id: profile.id }, select: [ "id", "registrationAddress", diff --git a/src/controllers/ProfileCertificateController.ts b/src/controllers/ProfileCertificateController.ts index 56f08974..10185798 100644 --- a/src/controllers/ProfileCertificateController.ts +++ b/src/controllers/ProfileCertificateController.ts @@ -33,7 +33,7 @@ export class ProfileCertificateController extends Controller { private certificateRepo = AppDataSource.getRepository(ProfileCertificate); private certificateHistoryRepo = AppDataSource.getRepository(ProfileCertificateHistory); - @Get("{profileId}") + @Get("user") public async getCertificateUser(@Request() request: { user: Record }) { const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub }); if (!profile) { diff --git a/src/controllers/ProfileFamilyHistoryController.ts b/src/controllers/ProfileFamilyHistoryController.ts index 1ea363ea..7928ef92 100644 --- a/src/controllers/ProfileFamilyHistoryController.ts +++ b/src/controllers/ProfileFamilyHistoryController.ts @@ -45,11 +45,11 @@ export class ProfileFamilyHistoryController extends Controller { const family = await this.familyHistoryRepo.find({ take: 1, order: { lastUpdatedAt: "DESC" }, - where: { id: profile.id }, + where: { profileId: profile.id }, }); const children = await this.childrenRepo.find({ order: { createdAt: "ASC" }, - where: { id: profile.id }, + where: { profileId: profile.id }, }); return new HttpSuccess( family.length > 0 diff --git a/src/controllers/ProfileFamilyMotherController.ts b/src/controllers/ProfileFamilyMotherController.ts index 879b7795..cad827d2 100644 --- a/src/controllers/ProfileFamilyMotherController.ts +++ b/src/controllers/ProfileFamilyMotherController.ts @@ -50,7 +50,7 @@ export class ProfileFamilyMotherController extends Controller { "motherLive", "profileId", ], - where: { id: profile.id }, + where: { profileId: profile.id }, order: { lastUpdatedAt: "DESC" }, }); diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index 1f1d9ec3..184d3307 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -47,7 +47,7 @@ export class ProfileInsigniaController extends Controller { insigniaType: true, }, }, - where: { id: profile.id }, + where: { profileId: profile.id }, }); return new HttpSuccess(record); } diff --git a/src/controllers/ProfileLeaveController.ts b/src/controllers/ProfileLeaveController.ts index 07289054..60e866b2 100644 --- a/src/controllers/ProfileLeaveController.ts +++ b/src/controllers/ProfileLeaveController.ts @@ -44,7 +44,7 @@ export class ProfileLeaveController extends Controller { } const record = await this.leaveRepo.find({ relations: { leaveType: true }, - where: { id: profile.id }, + where: { profileId: profile.id }, }); return new HttpSuccess(record); } diff --git a/src/controllers/ProfileNopaidController.ts b/src/controllers/ProfileNopaidController.ts index d79a0f0b..06b163d8 100644 --- a/src/controllers/ProfileNopaidController.ts +++ b/src/controllers/ProfileNopaidController.ts @@ -36,7 +36,7 @@ export class ProfileNopaidController extends Controller { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } const lists = await this.nopaidRepository.find({ - where: { id: profile.id }, + where: { profileId: profile.id }, }); return new HttpSuccess(lists); }