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 ProfileFamilyCoupleEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
await this.ProfileFamilyCouple.update(
{ profileEmployeeId: profile.id },
{ couple: false },
);
const before = null;
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
@ -169,7 +173,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.createdAt = new Date();
familyCouple.lastUpdatedAt = new Date();
familyCouple.couple = true;
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
Object.assign(history, { ...familyCouple, id: undefined });