แก้ api เก็บประวัติแก้ทะเบียน
This commit is contained in:
parent
576f6bcc0d
commit
fd3f1fa515
62 changed files with 855 additions and 1471 deletions
|
|
@ -202,15 +202,21 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
};
|
||||
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
const history = new ProfileEducationHistory();
|
||||
history.profileEducationId = data.id;
|
||||
|
||||
await this.profileEducationRepo.save(data);
|
||||
await Promise.all([
|
||||
this.profileEducationRepo.save(data),
|
||||
(history.profileEducationId = data.id),
|
||||
this.profileEducationHistoryRepo.save(history),
|
||||
]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
@Patch("{educationId}")
|
||||
public async editProfileEducation(
|
||||
@Body() requestBody: UpdateProfileEducation,
|
||||
@Body() body: UpdateProfileEducation,
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() educationId: string,
|
||||
) {
|
||||
|
|
@ -220,12 +226,16 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
|
||||
const history = new ProfileEducationHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, requestBody);
|
||||
Object.assign(record, body);
|
||||
Object.assign(history, body);
|
||||
|
||||
history.profileEducationId = educationId;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
record.lastUpdateUserId = req.user.sub;
|
||||
record.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.profileEducationRepo.save(record),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue