update
This commit is contained in:
@ -71,8 +71,10 @@ export class FareTypeController {
|
||||
const offset = (param.page - 1) * param.limit
|
||||
|
||||
const filterObj = param.filter ? JSON.parse(param.filter) : {};
|
||||
const filterAny = filterObj.any && filterObj.any !== "" ? String(filterObj.any) : "";
|
||||
// Remove foreign key from filter for CommonHelper.handleFilter
|
||||
const filterWithoutFK = { ...filterObj };
|
||||
delete filterWithoutFK.any;
|
||||
delete filterWithoutFK.munisipo_id;
|
||||
const filterStrWithoutFK = JSON.stringify(filterWithoutFK);
|
||||
|
||||
@ -91,6 +93,12 @@ export class FareTypeController {
|
||||
// res_count.andWhere("munisipo.id = :munisipoId", { munisipoId: filterObj.munisipo_id });
|
||||
// }
|
||||
|
||||
if (filterAny !== "") {
|
||||
res_count.andWhere("FareType.name ILIKE :any", {
|
||||
any: filterAny.includes("%") ? filterAny : `%${filterAny}%`
|
||||
});
|
||||
}
|
||||
|
||||
const res_list = repo.createQueryBuilder("FareType")
|
||||
// .leftJoin("Administrativu.munisipo", "munisipo")
|
||||
// .where(whereAttr || "1=1", whereVal)
|
||||
@ -103,6 +111,12 @@ export class FareTypeController {
|
||||
// res_list.andWhere("munisipo.id = :munisipoId", { munisipoId: filterObj.munisipo_id });
|
||||
// }
|
||||
|
||||
if (filterAny !== "") {
|
||||
res_list.andWhere("FareType.name ILIKE :any", {
|
||||
any: filterAny.includes("%") ? filterAny : `%${filterAny}%`
|
||||
});
|
||||
}
|
||||
|
||||
if (param.with_deleted) {
|
||||
res_count.withDeleted();
|
||||
res_list.withDeleted();
|
||||
|
||||
Reference in New Issue
Block a user