Merge branch 'adiDev' into develop

This commit is contained in:
AdisakKanthawilang 2024-04-18 17:50:18 +07:00
commit c4a975b503

View file

@ -70,23 +70,27 @@ async updateKpiEvaluations(
*/
@Get()
async listKpiEvaluation(
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
// @Query("page") page: number = 1,
// @Query("pageSize") pageSize: number = 10,
// @Query("keyword") keyword?: string,
) {
let whereClause: any = {};
if (keyword !== undefined && keyword !== "") {
whereClause = {
where: [{ description: Like(`%${keyword}%`) }],
};
whereClause.where.push({ level: Like(`%${keyword}%`) });
// if (keyword !== undefined && keyword !== "") {
// whereClause = {
// where: [{ description: Like(`%${keyword}%`) }],
// };
// whereClause.where.push({ level: Like(`%${keyword}%`) });
}
// }
const [kpiEvaluation, total] = await this.kpiEvaluationRepository.findAndCount({
...whereClause,
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
// const [kpiEvaluation, total] = await this.kpiEvaluationRepository.findAndCount({
// ...whereClause,
// ...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
// order:{
// level: "DESC"}
// });
const kpiEvaluation = await this.kpiEvaluationRepository.find({
order:{
level: "DESC"}
});
@ -96,6 +100,6 @@ async updateKpiEvaluations(
level: item.level,
description: item.description
}));
return new HttpSuccess({ data: formatted, total });
return new HttpSuccess(formatted);
}
}