เพิ่มวันที่เวลา แก้ไข/สร้าง
This commit is contained in:
parent
f8bebde592
commit
1c2bc1dbda
17 changed files with 505 additions and 361 deletions
|
|
@ -26,7 +26,7 @@ import { KpiSpecial } from "../entities/kpiSpecial";
|
|||
import { KpiRole } from "../entities/kpiRole";
|
||||
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/plan")
|
||||
@Tags("kpiPlan")
|
||||
|
|
@ -186,6 +186,8 @@ export class kpiPlanController extends Controller {
|
|||
kpiPlan.createdFullName = request.user.name;
|
||||
kpiPlan.lastUpdateUserId = request.user.sub;
|
||||
kpiPlan.lastUpdateFullName = request.user.name;
|
||||
kpiPlan.createdAt = new Date();
|
||||
kpiPlan.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(kpiPlan, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPlan });
|
||||
|
||||
|
|
@ -195,6 +197,8 @@ export class kpiPlanController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: history });
|
||||
|
||||
|
|
@ -280,6 +284,8 @@ export class kpiPlanController extends Controller {
|
|||
kpiPlan.createdFullName = request.user.name;
|
||||
kpiPlan.lastUpdateUserId = request.user.sub;
|
||||
kpiPlan.lastUpdateFullName = request.user.name;
|
||||
kpiPlan.createdAt = new Date();
|
||||
kpiPlan.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(kpiPlan, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPlan });
|
||||
|
||||
|
|
@ -290,6 +296,8 @@ export class kpiPlanController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: history });
|
||||
|
||||
|
|
@ -803,6 +811,9 @@ export class kpiPlanController extends Controller {
|
|||
remainingKpiPlans.forEach((kpiPlan: any, index: any) => {
|
||||
kpiPlan.including = index + 1;
|
||||
});
|
||||
remainingKpiPlans.lastUpdateUserId = request.user.sub;
|
||||
remainingKpiPlans.lastUpdateFullName = request.user.name;
|
||||
remainingKpiPlans.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(remainingKpiPlans, { data: request });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue