ผูก log เมนูทะเบียนประวัติ

This commit is contained in:
AdisakKanthawilang 2024-10-03 15:57:44 +07:00
parent 5643cc67c4
commit 6539804937
76 changed files with 909 additions and 431 deletions

View file

@ -25,6 +25,7 @@ import {
UpdateProfileOther,
} from "../entities/ProfileOther";
import permission from "../interfaces/permission";
import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/profile-temp/other")
@Tags("ProfileOther")
@Security("bearerAuth")
@ -87,7 +88,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const before = null;
const data = new ProfileOther();
const meta = {
@ -103,9 +104,10 @@ export class ProfileOtherEmployeeTempController extends Controller {
const history = new ProfileOtherHistory();
Object.assign(history, { ...data, id: undefined });
await this.otherRepository.save(data);
await this.otherRepository.save(data, { data: req });
setLogDataDiff(req, { before, after: data });
history.profileOtherId = data.id;
await this.otherHistoryRepository.save(history);
await this.otherHistoryRepository.save(history, { data: req });
return new HttpSuccess();
}