แก้ api เก็บประวัติแก้ทะเบียน
This commit is contained in:
parent
576f6bcc0d
commit
fd3f1fa515
62 changed files with 855 additions and 1471 deletions
|
|
@ -220,24 +220,16 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
familyFather.createdFullName = req.user.name;
|
||||
familyFather.lastUpdateUserId = req.user.sub;
|
||||
familyFather.lastUpdateFullName = req.user.name;
|
||||
await this.ProfileFamilyFather.save(familyFather);
|
||||
|
||||
if (familyFather) {
|
||||
const history: ProfileFamilyFatherHistory = Object.assign(new ProfileFamilyFatherHistory(), {
|
||||
profileFamilyFatherId: familyFather.id,
|
||||
fatherPrefix: familyFather.fatherPrefix,
|
||||
fatherFirstName: familyFather.fatherFirstName,
|
||||
fatherLastName: familyFather.fatherLastName,
|
||||
fatherCareer: familyFather.fatherCareer,
|
||||
fatherCitizenId: familyFather.fatherCitizenId,
|
||||
fatherLive: familyFather.fatherLive,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
});
|
||||
await this.ProfileFamilyFatherHistory.save(history);
|
||||
}
|
||||
const history = new ProfileFamilyFatherHistory();
|
||||
history.profileFamilyFatherId = familyFather.id;
|
||||
|
||||
await Promise.all([
|
||||
this.ProfileFamilyFather.save(familyFather),
|
||||
(history.profileFamilyFatherId = familyFather.id),
|
||||
this.ProfileFamilyFatherHistory.save(history),
|
||||
]);
|
||||
|
||||
return new HttpSuccess(familyFather.id);
|
||||
}
|
||||
|
||||
|
|
@ -252,20 +244,17 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const history = new ProfileFamilyFatherHistory();
|
||||
Object.assign(history, { ...familyFather, id: undefined });
|
||||
Object.assign(familyFather, body);
|
||||
(familyFather.lastUpdateUserId = req.user.sub),
|
||||
(familyFather.lastUpdateFullName = req.user.name);
|
||||
Object.assign(history, { ...familyFather, id: undefined });
|
||||
|
||||
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
|
||||
history.profileFamilyFatherId = familyFather.id; //profileFamilyFatherId
|
||||
(history.fatherPrefix = familyFather.fatherPrefix),
|
||||
(history.fatherFirstName = familyFather.fatherFirstName),
|
||||
(history.fatherLastName = familyFather.fatherLastName),
|
||||
(history.fatherCareer = familyFather.fatherCareer),
|
||||
(history.fatherCitizenId = familyFather.fatherCitizenId),
|
||||
(history.fatherLive = familyFather.fatherLive),
|
||||
(history.lastUpdateUserId = req.user.sub),
|
||||
(history.lastUpdateFullName = req.user.name);
|
||||
familyFather.lastUpdateUserId = req.user.sub;
|
||||
familyFather.lastUpdateFullName = req.user.name;
|
||||
history.lastUpdateUserId = req.user.sub;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
history.createdFullName = req.user.name;
|
||||
|
||||
await Promise.all([
|
||||
this.ProfileFamilyFather.save(familyFather),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue