Fix เพิ่มข้อมูลคู่สมรสแล้วไม่แสดง #1637, #1645

This commit is contained in:
Bright 2025-07-21 11:38:35 +07:00
parent d3b8de26d7
commit 750c3a089b
4 changed files with 17 additions and 4 deletions

View file

@ -161,6 +161,10 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await this.ProfileFamilyCouple.update(
{ profileEmployeeId: profile.id },
{ couple: false },
);
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
familyCouple.createdFullName = req.user.name;
@ -168,6 +172,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.createdAt = new Date();
familyCouple.lastUpdatedAt = new Date();
familyCouple.couple = true;
await this.ProfileFamilyCouple.save(familyCouple);
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship