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