fix: doctor schedule search by room & doctor

This commit is contained in:
avicenan
2026-02-26 11:22:56 +07:00
parent 4c861f7597
commit 7676dd62c8

View File

@ -9,12 +9,13 @@ export class DoctorScheduleModel {
let whereAttr: string[] = [];
let whereVal: any = {};
if (filter && Object.keys(filter).length > 0) {
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter).whereAttr];
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter).whereVal };
const filterResult = CommonHelper.handleQueryFilter(filter);
whereAttr = [...whereAttr, ...filterResult.whereAttr];
whereVal = { ...whereVal, ...filterResult.whereVal };
}
var query = repo.createQueryBuilder("DoctorSchedule")
.leftJoinAndSelect("DoctorSchedule.doctor", "doctor")
.leftJoinAndSelect("DoctorSchedule.doctor", "Doctor")
.leftJoinAndSelect("DoctorSchedule.room", "Room");
if (whereAttr.length != 0) {
query = query.where(whereAttr.join(" and "), whereVal);