fix(api): qualify guarantor filter columns
This commit is contained in:
@ -6,18 +6,19 @@ import { PatientGuarantor } from "entity";
|
||||
export class PatientGuarantorModel {
|
||||
static async list(filterObj = {}, filterAny: string = ""): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(PatientGuarantor);
|
||||
let whereAttr: string[] = [];
|
||||
let whereAttr = [];
|
||||
let whereVal: any = {};
|
||||
if (filterObj && Object.keys(filterObj).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filterObj, "patient_guarantor").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filterObj, "patient_guarantor").whereVal };
|
||||
if (filterObj) {
|
||||
const filterResult = CommonHelper.handleQueryFilter(filterObj);
|
||||
whereAttr = [...whereAttr, ...filterResult.whereAttr];
|
||||
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||
}
|
||||
|
||||
if (filterAny && filterAny !== "" && filterAny !== null && filterAny !== undefined) {
|
||||
const filterResult = CommonHelper.handleFilter({
|
||||
filter: JSON.stringify({ any: filterAny }),
|
||||
col_any_eq: [],
|
||||
col_any_like: ["patient_guarantor.name", "patient_guarantor.phone"],
|
||||
col_any_like: ["guarantor_name", "phone"],
|
||||
});
|
||||
|
||||
if (filterResult.whereAttr && filterResult.whereAttr !== "") {
|
||||
|
||||
Reference in New Issue
Block a user