diff --git a/src/controllers/ProfileFamilyHistoryController.ts b/src/controllers/ProfileFamilyHistoryController.ts index aed19573..d0f0fe55 100644 --- a/src/controllers/ProfileFamilyHistoryController.ts +++ b/src/controllers/ProfileFamilyHistoryController.ts @@ -92,11 +92,11 @@ export class ProfileFamilyHistoryController extends Controller { public async getFamilyHistory(@Path() profileId: string) { const family = await this.familyHistoryRepo.find({ take: 1, - order: { createdAt: "DESC" }, + order: { lastUpdatedAt: "DESC" }, where: { profileId }, }); const children = await this.childrenRepo.find({ - order: { createdAt: "DESC" }, + order: { createdAt: "ASC" }, where: { profileId }, }); return new HttpSuccess( @@ -226,8 +226,9 @@ export class ProfileFamilyHistoryController extends Controller { const record = await Promise.all( family.map(async (v) => ({ ...v, - children: await this.childrenHistoryRepo.findBy({ - profileFamilyHistoryId: v.id, + children: await this.childrenHistoryRepo.find({ + order: { createdAt: "ASC" }, + where: { profileFamilyHistoryId: v.id }, }), })), );