From 0968f4d14edfca3b82d02fabdce325db8c1700f2 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 2 Jul 2024 14:11:29 +0700 Subject: [PATCH] fix user/evaluation --- src/controllers/KpiUserEvaluationController.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index 7c75e33..67b69b2 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -737,13 +737,23 @@ export class KpiUserEvaluationController extends Controller { @Query("keyword") keyword?: string, @Query("status") status?: string, ) { + let profileId: any = null; + await new CallAPI() + .GetData(request, "org/profile/keycloak/position") + .then((x) => { + profileId = x.profileId; + }) + .catch((x) => { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ"); + }); const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation) .createQueryBuilder("kpiUserEvaluation") .leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod") .andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", { kpiPeriodId: kpiPeriodId, }) - .andWhere({ createdUserId: request.user.sub }) + // .andWhere({ createdUserId: request.user.sub }) + .andWhere({ profileId : profileId }) .andWhere( status == null || status == undefined ? "1=1" : "evaluationStatus LIKE :evaluationStatus", {