@autofleet/sheilta 1.4.6 → 1.4.8-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/formatter/index.js
CHANGED
|
@@ -171,6 +171,7 @@ const formatQuery = (query, associationModels, replacementsMap, additionalAllowe
|
|
|
171
171
|
}
|
|
172
172
|
if (additionalAllowedAttributes.includes(queryItemKey)) {
|
|
173
173
|
externalQueryValues[queryItemKey] = queryItemValue;
|
|
174
|
+
return;
|
|
174
175
|
}
|
|
175
176
|
const key = (0, utils_1.isAttributeByAssociation)(queryItemKey, associationModels)
|
|
176
177
|
? (0, utils_1.wrapAttributeWithOperator)(queryItemKey)
|
package/lib/middleware/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const logger = (0, logger_1.default)();
|
|
|
14
14
|
const querySchema = object.keys({
|
|
15
15
|
query: object,
|
|
16
16
|
attributes: array.items(string),
|
|
17
|
-
order: array.items(
|
|
17
|
+
order: array.items(any),
|
|
18
18
|
page: number,
|
|
19
19
|
perPage: number,
|
|
20
20
|
include: array.items(any),
|
|
@@ -57,7 +57,7 @@ const newQueryValidationMiddleware = (inner = 'body') => (model, options = {}) =
|
|
|
57
57
|
exports.newQueryValidationMiddleware = newQueryValidationMiddleware;
|
|
58
58
|
const newQueryFormatMiddleware = (inner = 'body') => (model, options = {}) => async (req, res, next) => {
|
|
59
59
|
const { order, page, perPage, include, query, attributes, searchTerm, } = req[inner];
|
|
60
|
-
const { query: formattedQuery, order: formattedOrder, page: formattedPage, perPage: formattedPerPage, include: formattedInclude, scopes: formattedScopes, attributes: formattedAttribute, } = (0, formatter_1.default)({
|
|
60
|
+
const { query: formattedQuery, externalQueryValues, order: formattedOrder, page: formattedPage, perPage: formattedPerPage, include: formattedInclude, scopes: formattedScopes, attributes: formattedAttribute, } = (0, formatter_1.default)({
|
|
61
61
|
query,
|
|
62
62
|
order,
|
|
63
63
|
page,
|
|
@@ -67,6 +67,7 @@ const newQueryFormatMiddleware = (inner = 'body') => (model, options = {}) => as
|
|
|
67
67
|
searchTerm,
|
|
68
68
|
}, model, options);
|
|
69
69
|
req[inner].query = formattedQuery;
|
|
70
|
+
req[inner].externalQueryValues = externalQueryValues;
|
|
70
71
|
req[inner].order = formattedOrder;
|
|
71
72
|
req[inner].attributes = formattedAttribute;
|
|
72
73
|
req[inner].page = formattedPage;
|