mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Adjusted
This commit is contained in:
@@ -81,7 +81,8 @@ async function paginate(model, req, {
|
||||
jsonbColumn = null,
|
||||
findOptions = {},
|
||||
auditOptions = null, // ← { mdl_Users, parentAlias },
|
||||
computedAttributes = []
|
||||
computedAttributes = [],
|
||||
context = "list",
|
||||
} = {}) {
|
||||
const page = Math.max(PAGE_START, parseInt(req.query.page, 10) || PAGE_START);
|
||||
const limit = Math.min(parseInt(req.query.limit, 10) || PAGE_SIZE, MAX_LIMIT);
|
||||
@@ -94,7 +95,7 @@ async function paginate(model, req, {
|
||||
const jsonbExclude = excludeAttributes.filter((f) => f.includes('.'));
|
||||
const jsonbAttr = jsonbColumn ? excludeJsonbPaths(jsonbColumn, jsonbExclude) : null;
|
||||
|
||||
const attributes = modelToAttributes(model, { exclude: excludeAttributes, jsonbSchemas });
|
||||
const attributes = modelToAttributes(model, { exclude: excludeAttributes, jsonbSchemas, context });
|
||||
const ALLOWED_FIELDS = attributes.map((a) => a.field);
|
||||
|
||||
const { where, order } = buildQuery(filters, sort, ALLOWED_FIELDS);
|
||||
|
||||
Reference in New Issue
Block a user