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