เพิ่มวันที่เวลา แก้ไข/สร้าง
This commit is contained in:
parent
f8bebde592
commit
1c2bc1dbda
17 changed files with 505 additions and 361 deletions
|
|
@ -25,7 +25,7 @@ import { KpiCapacityDetail } from "../entities/kpiCapacityDetail";
|
|||
import { Like, In } from "typeorm";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/capacity")
|
||||
@Tags("kpiCapacity")
|
||||
|
|
@ -83,6 +83,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacity.createdFullName = request.user.name;
|
||||
kpiCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiCapacity.createdAt = new Date();
|
||||
kpiCapacity.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityRepository.save(kpiCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacity });
|
||||
|
||||
|
|
@ -100,6 +102,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacityDetail.createdFullName = request.user.name;
|
||||
kpiCapacityDetail.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacityDetail.lastUpdateFullName = request.user.name;
|
||||
kpiCapacityDetail.createdAt = new Date();
|
||||
kpiCapacityDetail.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityDetailRepository.save(kpiCapacityDetail, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacityDetail });
|
||||
}
|
||||
|
|
@ -155,6 +159,7 @@ export class kpiCapacityController extends Controller {
|
|||
const before = structuredClone(kpiCapacity);
|
||||
kpiCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiCapacity.lastUpdatedAt = new Date();
|
||||
this.kpiCapacityRepository.merge(kpiCapacity, _kpiCapacity);
|
||||
await this.kpiCapacityRepository.save(kpiCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacity });
|
||||
|
|
@ -180,6 +185,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacityDetail.createdFullName = request.user.name;
|
||||
kpiCapacityDetail.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacityDetail.lastUpdateFullName = request.user.name;
|
||||
kpiCapacityDetail.createdAt = new Date();
|
||||
kpiCapacityDetail.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityDetailRepository.save(kpiCapacityDetail, { data: request });
|
||||
setLogDataDiff(request, { before: beforeDetail, after: kpiCapacityDetail });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue