|
|
@ -271,6 +271,7 @@ class BaseModelSqlv2 { |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
ignoreViewFilterAndSort = false, |
|
|
|
ignoreViewFilterAndSort = false, |
|
|
|
validateFormula = false, |
|
|
|
validateFormula = false, |
|
|
|
|
|
|
|
throwErrorIfInvalidParams = false, |
|
|
|
): Promise<any> { |
|
|
|
): Promise<any> { |
|
|
|
const { where, fields, ...rest } = this._getListArgs(args as any); |
|
|
|
const { where, fields, ...rest } = this._getListArgs(args as any); |
|
|
|
|
|
|
|
|
|
|
@ -287,8 +288,16 @@ class BaseModelSqlv2 { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const aliasColObjMap = await this.model.getAliasColObjMap(); |
|
|
|
const aliasColObjMap = await this.model.getAliasColObjMap(); |
|
|
|
let sorts = extractSortsObject(rest?.sort, aliasColObjMap); |
|
|
|
let sorts = extractSortsObject( |
|
|
|
const filterObj = extractFilterFromXwhere(where, aliasColObjMap); |
|
|
|
rest?.sort, |
|
|
|
|
|
|
|
aliasColObjMap, |
|
|
|
|
|
|
|
throwErrorIfInvalidParams, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const filterObj = extractFilterFromXwhere( |
|
|
|
|
|
|
|
where, |
|
|
|
|
|
|
|
aliasColObjMap, |
|
|
|
|
|
|
|
throwErrorIfInvalidParams, |
|
|
|
|
|
|
|
); |
|
|
|
// todo: replace with view id
|
|
|
|
// todo: replace with view id
|
|
|
|
if (!ignoreViewFilterAndSort && this.viewId) { |
|
|
|
if (!ignoreViewFilterAndSort && this.viewId) { |
|
|
|
await conditionV2( |
|
|
|
await conditionV2( |
|
|
@ -311,6 +320,8 @@ class BaseModelSqlv2 { |
|
|
|
}), |
|
|
|
}), |
|
|
|
], |
|
|
|
], |
|
|
|
qb, |
|
|
|
qb, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
throwErrorIfInvalidParams, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!sorts) |
|
|
|
if (!sorts) |
|
|
@ -318,7 +329,7 @@ class BaseModelSqlv2 { |
|
|
|
? args.sortArr |
|
|
|
? args.sortArr |
|
|
|
: await Sort.list({ viewId: this.viewId }); |
|
|
|
: await Sort.list({ viewId: this.viewId }); |
|
|
|
|
|
|
|
|
|
|
|
await sortV2(this, sorts, qb); |
|
|
|
await sortV2(this, sorts, qb, undefined, throwErrorIfInvalidParams); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
await conditionV2( |
|
|
|
await conditionV2( |
|
|
|
this, |
|
|
|
this, |
|
|
@ -335,11 +346,13 @@ class BaseModelSqlv2 { |
|
|
|
}), |
|
|
|
}), |
|
|
|
], |
|
|
|
], |
|
|
|
qb, |
|
|
|
qb, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
throwErrorIfInvalidParams, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!sorts) sorts = args.sortArr; |
|
|
|
if (!sorts) sorts = args.sortArr; |
|
|
|
|
|
|
|
|
|
|
|
await sortV2(this, sorts, qb); |
|
|
|
await sortV2(this, sorts, qb, undefined, throwErrorIfInvalidParams); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// sort by primary key if not autogenerated string
|
|
|
|
// sort by primary key if not autogenerated string
|
|
|
|