fix: query order
This commit is contained in:
parent
380a32fabf
commit
a492d6a82e
1 changed files with 5 additions and 4 deletions
|
|
@ -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 },
|
||||
}),
|
||||
})),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue