ผูก log เมนูทะเบียนประวัติ
This commit is contained in:
parent
5643cc67c4
commit
6539804937
76 changed files with 909 additions and 431 deletions
|
|
@ -25,7 +25,7 @@ import {
|
|||
} from "../entities/ProfileGovernment";
|
||||
import { EmployeePosition } from "../entities/EmployeePosition";
|
||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { calculateAge, calculateRetireDate } from "../interfaces/utils";
|
||||
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
|
||||
import permission from "../interfaces/permission";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
@Route("api/v1/org/profile-employee/government")
|
||||
|
|
@ -368,6 +368,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
});
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
const before = structuredClone(record);
|
||||
const history = new ProfileGovernment();
|
||||
|
||||
Object.assign(record, body);
|
||||
|
|
@ -384,7 +385,10 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([this.profileEmployeeRepo.save(record), this.govRepo.save(history)]);
|
||||
await Promise.all([
|
||||
this.profileEmployeeRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.govRepo.save(history, { data: req })]);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue