beforeFind: Improve request.query object (#6237)

* beforeFind: Improve request.query object

Closes: https://github.com/parse-community/parse-server/issues/6164

* can modify exclude query
This commit is contained in:
Diamond Lewis
2019-11-23 11:38:13 -06:00
committed by GitHub
parent 7c7a8704c5
commit 2f05d819f3
2 changed files with 42 additions and 13 deletions

View File

@@ -451,22 +451,14 @@ export function maybeRunQueryTrigger(
restOptions,
});
}
const json = Object.assign({}, restOptions);
json.where = restWhere;
const parseQuery = new Parse.Query(className);
if (restWhere) {
parseQuery._where = restWhere;
}
parseQuery.withJSON(json);
let count = false;
if (restOptions) {
if (restOptions.include && restOptions.include.length > 0) {
parseQuery._include = restOptions.include.split(',');
}
if (restOptions.skip) {
parseQuery._skip = restOptions.skip;
}
if (restOptions.limit) {
parseQuery._limit = restOptions.limit;
}
count = !!restOptions.count;
}
const requestObject = getRequestQueryObject(
@@ -503,6 +495,10 @@ export function maybeRunQueryTrigger(
restOptions = restOptions || {};
restOptions.include = jsonQuery.include;
}
if (jsonQuery.excludeKeys) {
restOptions = restOptions || {};
restOptions.excludeKeys = jsonQuery.excludeKeys;
}
if (jsonQuery.keys) {
restOptions = restOptions || {};
restOptions.keys = jsonQuery.keys;