แก้ api เก็บประวัติแก้ทะเบียน
This commit is contained in:
parent
576f6bcc0d
commit
fd3f1fa515
62 changed files with 855 additions and 1471 deletions
|
|
@ -160,8 +160,14 @@ export class ProfileTrainingController extends Controller {
|
|||
};
|
||||
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
const history = new ProfileTrainingHistory();
|
||||
history.profileTrainingId = data.id;
|
||||
|
||||
await this.trainingRepo.save(data);
|
||||
await Promise.all([
|
||||
this.trainingRepo.save(data),
|
||||
(history.profileTrainingId = data.id),
|
||||
this.trainingHistoryRepo.save(history),
|
||||
]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -179,11 +185,16 @@ export class ProfileTrainingController extends Controller {
|
|||
|
||||
const history = new ProfileTrainingHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, body);
|
||||
Object.assign(history, body);
|
||||
|
||||
history.profileTrainingId = trainingId;
|
||||
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.trainingRepo.save(record), this.trainingHistoryRepo.save(history)]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue