|
|
@ -265,10 +265,20 @@ class BaseModelSqlv2 { |
|
|
|
sort?: string | string[]; |
|
|
|
sort?: string | string[]; |
|
|
|
fieldsSet?: Set<string>; |
|
|
|
fieldsSet?: Set<string>; |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
|
|
|
|
options: { |
|
|
|
|
|
|
|
ignoreViewFilterAndSort?: boolean; |
|
|
|
|
|
|
|
ignorePagination?: boolean; |
|
|
|
|
|
|
|
validateFormula?: boolean; |
|
|
|
|
|
|
|
throwErrorIfInvalidParams?: boolean; |
|
|
|
|
|
|
|
} = {}, |
|
|
|
|
|
|
|
): Promise<any> { |
|
|
|
|
|
|
|
const { |
|
|
|
ignoreViewFilterAndSort = false, |
|
|
|
ignoreViewFilterAndSort = false, |
|
|
|
|
|
|
|
ignorePagination = false, |
|
|
|
validateFormula = false, |
|
|
|
validateFormula = false, |
|
|
|
throwErrorIfInvalidParams = false, |
|
|
|
throwErrorIfInvalidParams = false, |
|
|
|
): Promise<any> { |
|
|
|
} = options; |
|
|
|
|
|
|
|
|
|
|
|
const { where, fields, ...rest } = this._getListArgs(args as any); |
|
|
|
const { where, fields, ...rest } = this._getListArgs(args as any); |
|
|
|
|
|
|
|
|
|
|
|
const qb = this.dbDriver(this.tnPath); |
|
|
|
const qb = this.dbDriver(this.tnPath); |
|
|
@ -359,7 +369,7 @@ class BaseModelSqlv2 { |
|
|
|
qb.orderBy('created_at'); |
|
|
|
qb.orderBy('created_at'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
applyPaginate(qb, rest); |
|
|
|
if (!ignorePagination) applyPaginate(qb, rest); |
|
|
|
const proto = await this.getProto(); |
|
|
|
const proto = await this.getProto(); |
|
|
|
|
|
|
|
|
|
|
|
let data; |
|
|
|
let data; |
|
|
@ -370,7 +380,11 @@ class BaseModelSqlv2 { |
|
|
|
if (validateFormula || !haveFormulaColumn(await this.model.getColumns())) |
|
|
|
if (validateFormula || !haveFormulaColumn(await this.model.getColumns())) |
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
console.log(e); |
|
|
|
console.log(e); |
|
|
|
return this.list(args, ignoreViewFilterAndSort, true); |
|
|
|
return this.list(args, { |
|
|
|
|
|
|
|
ignoreViewFilterAndSort, |
|
|
|
|
|
|
|
ignorePagination, |
|
|
|
|
|
|
|
validateFormula: true, |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
return data?.map((d) => { |
|
|
|
return data?.map((d) => { |
|
|
|
d.__proto__ = proto; |
|
|
|
d.__proto__ = proto; |
|
|
@ -1891,7 +1905,10 @@ class BaseModelSqlv2 { |
|
|
|
}), |
|
|
|
}), |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
true, |
|
|
|
{ |
|
|
|
|
|
|
|
ignoreViewFilterAndSort: true, |
|
|
|
|
|
|
|
ignorePagination: true, |
|
|
|
|
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const groupedList = groupBy(data, pCol.title); |
|
|
|
const groupedList = groupBy(data, pCol.title); |
|
|
|