Remove all dependencies on schemaController

This commit is contained in:
Drew Gross
2016-05-23 16:43:51 -07:00
parent d944255e4e
commit f4b1f7b951
2 changed files with 20 additions and 12 deletions

View File

@@ -830,10 +830,6 @@ const mongoObjectToParseObject = (schemaController, className, mongoObject, sche
if (key.indexOf('_p_') == 0) {
var newKey = key.substring(3);
var expected;
if (schemaController && schemaController.getExpectedType) {
expected = schemaController.getExpectedType(className, newKey);
}
if (!schema.fields[newKey]) {
log.info('transform.js', 'Found a pointer column not in the schema, dropping it.', className, newKey);
break;
@@ -858,13 +854,12 @@ const mongoObjectToParseObject = (schemaController, className, mongoObject, sche
} else if (key[0] == '_' && key != '__type') {
throw ('bad key in untransform: ' + key);
} else {
var expectedType = schemaController.getExpectedType(className, key);
var value = mongoObject[key];
if (expectedType && expectedType.type === 'File' && FileCoder.isValidDatabaseObject(value)) {
if (schema.fields[key] && schema.fields[key].type === 'File' && FileCoder.isValidDatabaseObject(value)) {
restObject[key] = FileCoder.databaseToJSON(value);
break;
}
if (expectedType && expectedType.type === 'GeoPoint' && GeoPointCoder.isValidDatabaseObject(value)) {
if (schema.fields[key] && schema.fields[key].type === 'GeoPoint' && GeoPointCoder.isValidDatabaseObject(value)) {
restObject[key] = GeoPointCoder.databaseToJSON(value);
break;
}