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)) }, });