up
This commit is contained in:
@ -43,9 +43,16 @@ export class RoomServicesController {
|
||||
|
||||
let param: Paging = await schema.validateAsync(req.query);
|
||||
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||
const filterAny = filter.any && filter.any !== "" ? String(filter.any) : "";
|
||||
let filterObj = { ...filter } as any;
|
||||
delete filterObj.any;
|
||||
|
||||
// Get total count of rooms
|
||||
const query = await RoomServicesModel.listByRoom(filter, param.with_deleted);
|
||||
const query = await RoomServicesModel.listByRoom(filterObj, param.with_deleted);
|
||||
if (filterAny !== "") {
|
||||
const anyVal = filterAny.includes("%") ? filterAny : `%${filterAny}%`;
|
||||
query.andWhere("(Room.code ILIKE :any OR Room.room ILIKE :any)", { any: anyVal });
|
||||
}
|
||||
const total_count_data = await query.getCount();
|
||||
|
||||
// Get all rooms with services
|
||||
|
||||
Reference in New Issue
Block a user