fix user/evaluation

This commit is contained in:
Bright 2024-07-02 14:11:29 +07:00
parent 02cd84a436
commit 0968f4d14e

View file

@ -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",
{