Address review comments

This commit is contained in:
Drew Gross
2016-02-05 18:53:06 -08:00
parent e2e0a26e9a
commit a5440bcc40
2 changed files with 6 additions and 5 deletions

View File

@@ -76,7 +76,8 @@ function classNameIsValid(className) {
className === '_SCHEMA' || //TODO: remove this, as _SCHEMA is not a valid class name for storing Parse Objects.
className === '_Role' ||
joinClassRegex.test(className) ||
classAndFieldRegex.test(className)
//Class names have the same constraints as field names, but also allow the previous additional names.
fieldNameIsValid(className)
);
}

View File

@@ -32,10 +32,10 @@ function mongoFieldTypeToSchemaAPIType(type) {
function mongoSchemaAPIResponseFields(schema) {
fieldNames = Object.keys(schema).filter(key => key !== '_id');
response = {};
fieldNames.forEach(fieldName => {
response[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName]);
});
response = fieldNames.reduce((obj, fieldName) => {
obj[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName])
return obj;
}, {});
response.ACL = {type: 'ACL'};
response.createdAt = {type: 'Date'};
response.updatedAt = {type: 'Date'};