add auery

This commit is contained in:
kittapath 2025-01-16 14:07:29 +07:00
parent 8a676e7d6e
commit 4c06594af8
5 changed files with 78 additions and 24 deletions

View file

@ -59,7 +59,10 @@ export class kpiPlanController extends Controller {
.where("kpiPeriod.year = :year", { year: requestBody.year })
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
.getOne();
const year = requestBody.year && parseInt(requestBody.year) > 0?parseInt(requestBody.year) + 543:"ดังกล่าว";
const year =
requestBody.year && parseInt(requestBody.year) > 0
? parseInt(requestBody.year) + 543
: "ดังกล่าว";
if (!kpiPeriod) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");
throw new HttpError(
@ -453,6 +456,7 @@ export class kpiPlanController extends Controller {
if (kpiPlan.strategyChild5Id != null) {
strategy = 5;
strategyId = kpiPlan.strategyChild5Id;
strategyName = kpiPlan.strategyChild5;
} else if (kpiPlan.strategyChild4Id != null) {
strategy = 4;
strategyId = kpiPlan.strategyChild4Id;
@ -870,11 +874,11 @@ export class kpiPlanController extends Controller {
type = 4;
}
const _null:any = null;
const _null: any = null;
await this.kpiPlanHistoryRepository.delete({ kpiPlanId: id });
await this.kpiUserPlanRepository.update({ kpiPlanId: id },{ kpiPlanId: _null });
await this.kpiUserPlanRepository.update({ kpiPlanId: id }, { kpiPlanId: _null });
await this.kpiPlanRepository.remove(kpiPlan, { data: request });
if (kpiPlan) {
let remainingKpiPlans: any;
if (type == 0) {