test throw report api

This commit is contained in:
Adisak 2025-11-03 10:01:43 +07:00
parent c31af516b3
commit f026ffde89

View file

@ -12,6 +12,7 @@ import { KpiCapacity } from "../entities/kpiCapacity";
import { KpiPlan } from "../entities/kpiPlan";
import { KpiRole } from "../entities/kpiRole";
import CallAPI from "../interfaces/call-api";
import { throws } from "assert";
@Route("api/v1/kpi/report")
@Tags("Report")
@Security("bearerAuth")
@ -775,6 +776,9 @@ export class ReportController extends Controller {
relations: ["kpiPeriod"],
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
});
if(!profileEvaluation || profileEvaluation.length === 0){
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรายงานการประเมินผลฯ ระดับบุคคลของบุคคลนี้");
}
const combinedData: KPIData = profileEvaluation.reduce(
(acc: KPIData, x) => {