fix: doctor schedule search by room & doctor
This commit is contained in:
@ -9,12 +9,13 @@ export class DoctorScheduleModel {
|
|||||||
let whereAttr: string[] = [];
|
let whereAttr: string[] = [];
|
||||||
let whereVal: any = {};
|
let whereVal: any = {};
|
||||||
if (filter && Object.keys(filter).length > 0) {
|
if (filter && Object.keys(filter).length > 0) {
|
||||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter).whereAttr];
|
const filterResult = CommonHelper.handleQueryFilter(filter);
|
||||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter).whereVal };
|
whereAttr = [...whereAttr, ...filterResult.whereAttr];
|
||||||
|
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||||
}
|
}
|
||||||
|
|
||||||
var query = repo.createQueryBuilder("DoctorSchedule")
|
var query = repo.createQueryBuilder("DoctorSchedule")
|
||||||
.leftJoinAndSelect("DoctorSchedule.doctor", "doctor")
|
.leftJoinAndSelect("DoctorSchedule.doctor", "Doctor")
|
||||||
.leftJoinAndSelect("DoctorSchedule.room", "Room");
|
.leftJoinAndSelect("DoctorSchedule.room", "Room");
|
||||||
if (whereAttr.length != 0) {
|
if (whereAttr.length != 0) {
|
||||||
query = query.where(whereAttr.join(" and "), whereVal);
|
query = query.where(whereAttr.join(" and "), whereVal);
|
||||||
|
|||||||
Reference in New Issue
Block a user