sort เรียงจากวันที่สร้าง
This commit is contained in:
parent
c55edf33b1
commit
0c170928d1
2 changed files with 9 additions and 4 deletions
|
|
@ -27,6 +27,7 @@ import { KpiRole } from "../entities/kpiRole";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import { setLogDataDiff } from "../interfaces/utils";
|
import { setLogDataDiff } from "../interfaces/utils";
|
||||||
|
import { KpiUserPlanned } from "../entities/kpiUserPlanned";
|
||||||
|
|
||||||
@Route("api/v1/kpi/plan")
|
@Route("api/v1/kpi/plan")
|
||||||
@Tags("kpiPlan")
|
@Tags("kpiPlan")
|
||||||
|
|
@ -39,6 +40,7 @@ import { setLogDataDiff } from "../interfaces/utils";
|
||||||
export class kpiPlanController extends Controller {
|
export class kpiPlanController extends Controller {
|
||||||
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
||||||
private kpiRoleRepository = AppDataSource.getRepository(KpiRole);
|
private kpiRoleRepository = AppDataSource.getRepository(KpiRole);
|
||||||
|
private kpiUserPlanRepository = AppDataSource.getRepository(KpiUserPlanned);
|
||||||
private kpiSpecialRepository = AppDataSource.getRepository(KpiSpecial);
|
private kpiSpecialRepository = AppDataSource.getRepository(KpiSpecial);
|
||||||
private kpiPlanHistoryRepository = AppDataSource.getRepository(KpiPlanHistory);
|
private kpiPlanHistoryRepository = AppDataSource.getRepository(KpiPlanHistory);
|
||||||
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
||||||
|
|
@ -866,9 +868,12 @@ export class kpiPlanController extends Controller {
|
||||||
} else if (kpiPlan.child4Id != null) {
|
} else if (kpiPlan.child4Id != null) {
|
||||||
type = 4;
|
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) {
|
if (kpiPlan) {
|
||||||
let remainingKpiPlans: any;
|
let remainingKpiPlans: any;
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||||
.take(requestBody.pageSize)
|
.take(requestBody.pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
@ -1050,7 +1050,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
evaluationStatus: status == undefined ? "" : status.trim().toUpperCase(),
|
evaluationStatus: status == undefined ? "" : status.trim().toUpperCase(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue