Remove unnecessary logic
This commit is contained in:
@@ -130,12 +130,7 @@ function transformKeyValue(schema, className, restKey, restValue, {
|
|||||||
return {key: key, value: value};
|
return {key: key, value: value};
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformQueryKeyValue(schema, className, restKey, restValue, {
|
function transformQueryKeyValue(schema, className, restKey, restValue, { validate } = {}) {
|
||||||
inArray,
|
|
||||||
inObject,
|
|
||||||
update,
|
|
||||||
validate,
|
|
||||||
} = {}) {
|
|
||||||
// Check if the schema is known since it's a built-in field.
|
// Check if the schema is known since it's a built-in field.
|
||||||
var key = restKey;
|
var key = restKey;
|
||||||
var timeField = false;
|
var timeField = false;
|
||||||
@@ -228,7 +223,7 @@ function transformQueryKeyValue(schema, className, restKey, restValue, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle atomic values
|
// Handle atomic values
|
||||||
var value = transformAtom(restValue, false, { inArray, inObject });
|
var value = transformAtom(restValue, false);
|
||||||
if (value !== CannotTransform) {
|
if (value !== CannotTransform) {
|
||||||
if (timeField && (typeof value === 'string')) {
|
if (timeField && (typeof value === 'string')) {
|
||||||
value = new Date(value);
|
value = new Date(value);
|
||||||
@@ -236,19 +231,13 @@ function transformQueryKeyValue(schema, className, restKey, restValue, {
|
|||||||
return {key: key, value: value};
|
return {key: key, value: value};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACLs are handled before this method is called
|
|
||||||
// If an ACL key still exists here, something is wrong.
|
|
||||||
if (key === 'ACL') {
|
|
||||||
throw 'There was a problem transforming an ACL.';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle arrays
|
// Handle arrays
|
||||||
if (restValue instanceof Array) {
|
if (restValue instanceof Array) {
|
||||||
throw new Parse.Error(Parse.Error.INVALID_JSON,'cannot use array as query param');
|
throw new Parse.Error(Parse.Error.INVALID_JSON,'cannot use array as query param');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle update operators
|
// Handle update operators
|
||||||
value = transformUpdateOperator(restValue, !update);
|
value = transformUpdateOperator(restValue, true);
|
||||||
if (value !== CannotTransform) {
|
if (value !== CannotTransform) {
|
||||||
return {key: key, value: value};
|
return {key: key, value: value};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user