sort data

This commit is contained in:
AdisakKanthawilang 2024-06-06 19:17:51 +07:00
parent 823fcb8ea8
commit 40082d9ffc

View file

@ -249,16 +249,19 @@ export class ProfileController extends Controller {
const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({ const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({
where: { profileId: id }, where: { profileId: id },
select: ["couplePrefix", "coupleFirstName", "coupleLastNameOld"], select: ["couplePrefix", "coupleFirstName", "coupleLastNameOld"],
order: {lastUpdatedAt: "DESC"}
}); });
const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({ const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({
where: { profileId: id }, where: { profileId: id },
select: ["motherPrefix", "motherFirstName", "motherLastName"], select: ["motherPrefix", "motherFirstName", "motherLastName"],
order: { lastUpdatedAt: "DESC" },
}); });
const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({ const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({
where: { profileId: id }, where: { profileId: id },
select: ["fatherPrefix", "fatherFirstName", "fatherLastName"], select: ["fatherPrefix", "fatherFirstName", "fatherLastName"],
order: { lastUpdatedAt: "DESC" },
}); });
const root = const root =
@ -420,6 +423,7 @@ export class ProfileController extends Controller {
const educations = await this.educationRepository.find({ const educations = await this.educationRepository.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"], select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileId: id }, where: { profileId: id },
order: {lastUpdatedAt:"DESC"},
}); });
const Education = educations.map((item) => ({ const Education = educations.map((item) => ({
Institute: item.institute, Institute: item.institute,