เพิ่มฟิว 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", {
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)
.getManyAndCount();
const mapData = kpiUserEvaluation.map((item) => ({
id: item.id,
profileId: item.profileId,
prefix: item.prefix,
firstname: item.firstName,
lastname: item.lastName,
kpiPeriodId: item.kpiPeriodId,
evaluationStatus: item.evaluationStatus,
evaluationResults: item.evaluationResults,
createdAt: item.createdAt,
evaluatorId: item.evaluatorId,
commanderId: item.commanderId,
commanderHighId: item.commanderHighId,
}));
const mapData = kpiUserEvaluation.map((item) => {
const fullNameParts = [item.child4, item.child3, item.child2, item.child1, item.org];
const organization = fullNameParts
.filter((part) => part !== undefined && part !== null)
.join("/");
return {
id: item.id,
profileId: item.profileId,
prefix: item.prefix,
firstname: item.firstName,
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 });
}