log admin , master (ยกเว้น menu ข้อมูลปฎิทินวันหยุด)
This commit is contained in:
parent
e59f4f13e2
commit
f0e5a83d02
11 changed files with 122 additions and 63 deletions
|
|
@ -144,14 +144,15 @@ export class PositionController extends Controller {
|
|||
if (rowRepeated) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
const before = null;
|
||||
posDict.createdUserId = request.user.sub;
|
||||
posDict.createdFullName = request.user.name;
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict);
|
||||
await this.posDictRepository.save(posDict, {data: request});
|
||||
setLogDataDiff(request, { before, after: posDict });
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +219,13 @@ export class PositionController extends Controller {
|
|||
if (!posMaster) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
|
||||
}
|
||||
await this.posMasterAssignRepo.delete({ posMasterId: posMaster.id });
|
||||
const posMasterAssigns = await this.posMasterAssignRepo.find({
|
||||
where: { posMasterId: posMaster.id },
|
||||
});
|
||||
if (posMasterAssigns.length > 0) {
|
||||
await this.posMasterAssignRepo.remove(posMasterAssigns, {data:request});
|
||||
}
|
||||
// await this.posMasterAssignRepo.delete({ posMasterId: posMaster.id });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -270,6 +277,7 @@ export class PositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
|
||||
}
|
||||
|
||||
const before = null;
|
||||
let posExecutive: any = new PosExecutive();
|
||||
if (requestBody.posExecutive != null && requestBody.posExecutive != "") {
|
||||
const checkName = await this.posExecutiveRepository.findOne({
|
||||
|
|
@ -299,7 +307,8 @@ export class PositionController extends Controller {
|
|||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.createdAt = new Date();
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
await this.posExecutiveRepository.save(posExecutive, {data:request});
|
||||
setLogDataDiff(request, {before, after: posExecutive});
|
||||
}
|
||||
|
||||
const rowRepeated = await this.posDictRepository.findOne({
|
||||
|
|
@ -325,7 +334,8 @@ export class PositionController extends Controller {
|
|||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict);
|
||||
await this.posDictRepository.save(posDict, {data:request});
|
||||
setLogDataDiff(request, {before, after: posDict});
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
||||
|
|
@ -407,6 +417,7 @@ export class PositionController extends Controller {
|
|||
if (rowRepeated) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ข้อมูล Row นี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
const before = structuredClone(posDict);
|
||||
Object.assign(posDict, requestBody);
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
posDict.lastUpdateFullName = request.user.name;
|
||||
|
|
@ -422,7 +433,8 @@ export class PositionController extends Controller {
|
|||
posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : "";
|
||||
posDict.isSpecial = requestBody.isSpecial;
|
||||
// this.posDictRepository.merge(posDict, requestBody);
|
||||
await this.posDictRepository.save(posDict);
|
||||
await this.posDictRepository.save(posDict, {data:request});
|
||||
setLogDataDiff(request, {before, after: posDict});
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -440,7 +452,7 @@ export class PositionController extends Controller {
|
|||
if (!delPosDict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้");
|
||||
}
|
||||
await this.posDictRepository.remove(delPosDict);
|
||||
await this.posDictRepository.remove(delPosDict, {data: request});
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue