parent
248dd12508
commit
29707d5567
1 changed files with 20 additions and 27 deletions
|
|
@ -244,39 +244,32 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"posLevelId",
|
"posLevelId",
|
||||||
"posTypeId",
|
"posTypeId",
|
||||||
],
|
],
|
||||||
where: {
|
|
||||||
prefix: Like(`%${keyword}%`),
|
|
||||||
firstName: Like(`%${keyword}%`),
|
|
||||||
lastName: Like(`%${keyword}%`),
|
|
||||||
citizenId: Like(`%${keyword}%`),
|
|
||||||
position: Like(`%${keyword}%`),
|
|
||||||
},
|
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
skip: (page - 1) * pageSize,
|
skip: (page - 1) * pageSize,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
});
|
});
|
||||||
// if (keyword != undefined && keyword !== "") {
|
if (keyword != undefined && keyword !== "") {
|
||||||
// const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
||||||
// const filteredProfile = profile.filter(
|
const filteredProfile = profile.filter(
|
||||||
// (x) =>
|
(x) =>
|
||||||
// (x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
(x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
||||||
// x.citizenId?.toString().includes(keyword) ||
|
x.citizenId?.toString().includes(keyword) ||
|
||||||
// x.position?.toString().includes(keyword),
|
x.position?.toString().includes(keyword),
|
||||||
// );
|
);
|
||||||
|
|
||||||
// const formattedData = filteredProfile.map((item) => ({
|
const formattedData = filteredProfile.map((item) => ({
|
||||||
// id: item.id,
|
id: item.id,
|
||||||
// prefix: item.prefix,
|
prefix: item.prefix,
|
||||||
// firstName: item.firstName,
|
firstName: item.firstName,
|
||||||
// lastName: item.lastName,
|
lastName: item.lastName,
|
||||||
// citizenId: item.citizenId,
|
citizenId: item.citizenId,
|
||||||
// position: item.position,
|
position: item.position,
|
||||||
// posLevelId: item.posLevelId,
|
posLevelId: item.posLevelId,
|
||||||
// posTypeId: item.posTypeId,
|
posTypeId: item.posTypeId,
|
||||||
// }));
|
}));
|
||||||
|
|
||||||
// return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
||||||
// }
|
}
|
||||||
|
|
||||||
const formattedData = profile.map((item) => ({
|
const formattedData = profile.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue