Skip to content

Change name of function and variable from baseFieldName to rootFieldName #4817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ const untransformObjectACL = ({_rperm, _wperm, ...output}) => {
}

/**
* When querying, the fieldName may be compound, extract the base fieldName
* When querying, the fieldName may be compound, extract the root fieldName
* `temperature.celsius` becomes `temperature`
* @param {string} fieldName that may be a compound field name
* @returns {string} the basename of the field
* @returns {string} the root name of the field
*/
const getBaseFieldName = (fieldName: string): string => {
const getRootFieldName = (fieldName: string): string => {
return fieldName.split('.')[0]
}

Expand Down Expand Up @@ -421,8 +421,8 @@ class DatabaseController {
if (fieldName.match(/^authData\.([a-zA-Z0-9_]+)\.id$/)) {
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name for update: ${fieldName}`);
}
const baseFieldName = getBaseFieldName(fieldName);
if (!SchemaController.fieldNameIsValid(baseFieldName) && !isSpecialUpdateKey(baseFieldName)) {
const rootFieldName = getRootFieldName(fieldName);
if (!SchemaController.fieldNameIsValid(rootFieldName) && !isSpecialUpdateKey(rootFieldName)) {
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name for update: ${fieldName}`);
}
});
Expand Down Expand Up @@ -910,8 +910,8 @@ class DatabaseController {
if (fieldName.match(/^authData\.([a-zA-Z0-9_]+)\.id$/)) {
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Cannot sort by ${fieldName}`);
}
const baseFieldName = getBaseFieldName(fieldName);
if (!SchemaController.fieldNameIsValid(baseFieldName)) {
const rootFieldName = getRootFieldName(fieldName);
if (!SchemaController.fieldNameIsValid(rootFieldName)) {
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name: ${fieldName}.`);
}
});
Expand Down