Schemas POST fix tests
This commit is contained in:
19
schemas.js
19
schemas.js
@@ -113,18 +113,13 @@ function createSchema(req) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return req.config.database.collection('_SCHEMA')
|
return req.config.database.loadSchema()
|
||||||
.then(coll => Schema.load(coll))
|
.then(schema => schema.addClassIfNotExists(className, req.body.fields))
|
||||||
.then(schema => schema.validateClassName(req.body.className))
|
.then(result => ({ response: mongoSchemaToSchemaAPIResponse(result) }))
|
||||||
.catch(error => {
|
.catch(error => ({
|
||||||
console.log(arguments);
|
status: 400,
|
||||||
return {response: error};
|
response: error,
|
||||||
})
|
}));
|
||||||
.then(newSchema => {
|
|
||||||
for (key in newSchema.data) {
|
|
||||||
}
|
|
||||||
return {response: {}};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
router.route('GET', '/schemas', getAllSchemas);
|
router.route('GET', '/schemas', getAllSchemas);
|
||||||
|
|||||||
Reference in New Issue
Block a user