ปรับ family
This commit is contained in:
parent
0524653f4b
commit
3e62126570
6 changed files with 19 additions and 5 deletions
|
|
@ -61,6 +61,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
"coupleCareer", "coupleCitizenId", "coupleLive", "relationship", "profileEmployeeId",
|
||||
],
|
||||
where: { profileEmployeeId },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
|
||||
return new HttpSuccess(familyCouple);
|
||||
|
|
@ -150,6 +151,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
await this.ProfileFamilyCouple.save(familyCouple);
|
||||
|
||||
if (familyCouple) {
|
||||
profile.relationship = familyCouple.relationship //update profileEmployee.relationship
|
||||
const history: ProfileFamilyCoupleHistory = Object.assign(new ProfileFamilyCoupleHistory(), {
|
||||
profileFamilyCoupleId: familyCouple.id,
|
||||
couple: familyCouple.couple,
|
||||
|
|
@ -165,7 +167,10 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
});
|
||||
await this.ProfileFamilyCoupleHistory.save(history);
|
||||
await Promise.all([
|
||||
this.profileRepo.save(profile),
|
||||
this.ProfileFamilyCoupleHistory.save(history)
|
||||
]);
|
||||
}
|
||||
return new HttpSuccess(familyCouple.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue