From cb26678af0edfed7392b1b1630cd256a7b8270f0 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 13 Dec 2024 18:22:28 +0700 Subject: [PATCH] fix --- src/controllers/KpiPeriodController.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/controllers/KpiPeriodController.ts b/src/controllers/KpiPeriodController.ts index fefe614..3de8a72 100644 --- a/src/controllers/KpiPeriodController.ts +++ b/src/controllers/KpiPeriodController.ts @@ -331,7 +331,12 @@ export class kpiPeriodController extends Controller { const kpiUserEvaluation = await this.kpiUserEvaluationRepository.find({ where: { kpiPeriodId: id }, }); - + if (kpiUserEvaluation && kpiUserEvaluation.length > 0) { + throw new HttpError( + HttpStatusCode.NOT_FOUND, + "ไม่สามารถลบรอบการประเมินนี้ได้ เนื่องจากพบรายการผู้รับการประเมินในรอบนี้", + ); + } const kpiUserRole = await this.kpiUserRoleRepository.find({ where: { kpiRoleId: In(kpiRole.map((x) => x.id)) }, });