เพิ่มฟิว API

This commit is contained in:
AdisakKanthawilang 2024-07-15 11:41:20 +07:00
parent 772a0b3a93
commit e777551657

View file

@ -250,6 +250,18 @@ export class KpiUserEvaluationController extends Controller {
}) })
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", { .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.position LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
}); });
}), }),
) )
@ -258,20 +270,36 @@ export class KpiUserEvaluationController extends Controller {
.take(requestBody.pageSize) .take(requestBody.pageSize)
.getManyAndCount(); .getManyAndCount();
const mapData = kpiUserEvaluation.map((item) => ({ const mapData = kpiUserEvaluation.map((item) => {
id: item.id, const fullNameParts = [item.child4, item.child3, item.child2, item.child1, item.org];
profileId: item.profileId,
prefix: item.prefix, const organization = fullNameParts
firstname: item.firstName, .filter((part) => part !== undefined && part !== null)
lastname: item.lastName, .join("/");
kpiPeriodId: item.kpiPeriodId,
evaluationStatus: item.evaluationStatus, return {
evaluationResults: item.evaluationResults, id: item.id,
createdAt: item.createdAt, profileId: item.profileId,
evaluatorId: item.evaluatorId, prefix: item.prefix,
commanderId: item.commanderId, firstname: item.firstName,
commanderHighId: item.commanderHighId, lastname: item.lastName,
})); kpiPeriodId: item.kpiPeriodId,
evaluationStatus: item.evaluationStatus,
evaluationResults: item.evaluationResults,
createdAt: item.createdAt,
evaluatorId: item.evaluatorId,
commanderId: item.commanderId,
commanderHighId: item.commanderHighId,
root: item.org,
rootId: item.orgId,
position: item.position,
// posTypeId: item.posTypeId,
posTypeName: item.posTypeName,
// posLevelId: item.posLevelId,
posLevelName: item.posLevelName,
organization: organization,
};
});
return new HttpSuccess({ data: mapData, total }); return new HttpSuccess({ data: mapData, total });
} }