From 41cce9761a918c70b561d5f577b8733aca6e884a Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:12:20 +0700 Subject: [PATCH 1/2] fix: wrong condition get addr history --- src/controllers/ProfileAddressController.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/controllers/ProfileAddressController.ts b/src/controllers/ProfileAddressController.ts index d7141708..5e9013f3 100644 --- a/src/controllers/ProfileAddressController.ts +++ b/src/controllers/ProfileAddressController.ts @@ -71,9 +71,7 @@ export class ProfileAddressController extends Controller { @Get("history/{addressId}") public async getProfileAddressHistory(@Path() addressId: string) { const record = await this.profileAddressHistoryRepo.find({ - where: { - id: addressId, - }, + where: { profileId: addressId }, select: [ "registrationAddress", "registrationProvinceId", From d79d91c6b5f68318a50f255ae657a697384dcad1 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:08:40 +0700 Subject: [PATCH 2/2] feat: also return with relationship (reduce fetch) --- src/controllers/ProfileAddressController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controllers/ProfileAddressController.ts b/src/controllers/ProfileAddressController.ts index 5e9013f3..e0907264 100644 --- a/src/controllers/ProfileAddressController.ts +++ b/src/controllers/ProfileAddressController.ts @@ -75,13 +75,19 @@ export class ProfileAddressController extends Controller { select: [ "registrationAddress", "registrationProvinceId", + "registrationProvince", "registrationDistrictId", + "registrationDistrict", "registrationSubDistrictId", + "registrationSubDistrict", "registrationZipCode", "currentAddress", "currentProvinceId", + "currentProvince", "currentDistrictId", + "currentDistrict", "currentSubDistrictId", + "currentSubDistrict", "currentZipCode", "createdFullName", "createdAt",