fix delete kpi plan
This commit is contained in:
parent
c55edf33b1
commit
55d1a71632
1 changed files with 7 additions and 2 deletions
|
|
@ -27,6 +27,7 @@ import { KpiRole } from "../entities/kpiRole";
|
|||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
import { KpiUserPlanned } from "../entities/kpiUserPlanned";
|
||||
|
||||
@Route("api/v1/kpi/plan")
|
||||
@Tags("kpiPlan")
|
||||
|
|
@ -39,6 +40,7 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
export class kpiPlanController extends Controller {
|
||||
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
||||
private kpiRoleRepository = AppDataSource.getRepository(KpiRole);
|
||||
private kpiUserPlanRepository = AppDataSource.getRepository(KpiUserPlanned);
|
||||
private kpiSpecialRepository = AppDataSource.getRepository(KpiSpecial);
|
||||
private kpiPlanHistoryRepository = AppDataSource.getRepository(KpiPlanHistory);
|
||||
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
||||
|
|
@ -866,9 +868,12 @@ export class kpiPlanController extends Controller {
|
|||
} else if (kpiPlan.child4Id != null) {
|
||||
type = 4;
|
||||
}
|
||||
await this.kpiPlanHistoryRepository.delete({ kpiPlanId: id });
|
||||
await this.kpiPlanRepository.remove(kpiPlan, { data: request });
|
||||
|
||||
const _null:any = null;
|
||||
await this.kpiPlanHistoryRepository.delete({ kpiPlanId: id });
|
||||
await this.kpiUserPlanRepository.update({ kpiPlanId: id },{ kpiPlanId: _null });
|
||||
await this.kpiPlanRepository.remove(kpiPlan, { data: request });
|
||||
|
||||
if (kpiPlan) {
|
||||
let remainingKpiPlans: any;
|
||||
if (type == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue