update
This commit is contained in:
@ -52,8 +52,19 @@ export class ScheduleController {
|
||||
order_direction: "asc" | "desc";
|
||||
} = await schema.validateAsync(req.query);
|
||||
|
||||
const filterObj = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||
const filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||
const filterAny = filter.any && filter.any !== "" ? String(filter.any) : "";
|
||||
const filterObj = { ...filter } as any;
|
||||
delete filterObj.any;
|
||||
|
||||
const query = await ScheduleModel.listSeries(filterObj);
|
||||
if (filterAny !== "") {
|
||||
const anyVal = filterAny.includes("%") ? filterAny : `%${filterAny}%`;
|
||||
query.andWhere(
|
||||
"(ScheduleSeries.title ILIKE :any OR Room.room ILIKE :any OR Room.code ILIKE :any OR Doctor.name ILIKE :any OR Doctor.username ILIKE :any)",
|
||||
{ any: anyVal }
|
||||
);
|
||||
}
|
||||
const orderDirection = param.order_direction.toUpperCase() as "ASC" | "DESC";
|
||||
|
||||
const offset = (param.page - 1) * param.limit;
|
||||
|
||||
Reference in New Issue
Block a user