Skip to content

Commit 329182c

Browse files
committed
tidyness
1 parent d175800 commit 329182c

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/Routers/SchemasRouter.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,19 @@ function deleteSchema(req) {
7979
if (!SchemaController.classNameIsValid(req.params.className)) {
8080
throw new Parse.Error(Parse.Error.INVALID_CLASS_NAME, SchemaController.invalidClassNameMessage(req.params.className));
8181
}
82-
8382
return req.config.database.deleteSchema(req.params.className)
84-
.then(() => {
85-
// We've dropped the collection now, so delete the item from _SCHEMA
86-
// and clear the _Join collections
87-
return req.config.database.schemaCollection()
88-
.then(coll => coll.findAndDeleteSchema(req.params.className))
89-
.then(document => {
90-
if (document === null) {
91-
//tried to delete non-existent class
92-
return Promise.resolve();
93-
}
94-
return removeJoinTables(req.config.database, document);
95-
});
96-
})
97-
.then(() => ({ response: {} }));
83+
.then(() => req.config.database.schemaCollection())
84+
// We've dropped the collection now, so delete the item from _SCHEMA
85+
// and clear the _Join collections
86+
.then(coll => coll.findAndDeleteSchema(req.params.className))
87+
.then(document => {
88+
if (document === null) {
89+
//tried to delete non-existent class
90+
return Promise.resolve();
91+
}
92+
return removeJoinTables(req.config.database, document);
93+
})
94+
.then(() => ({ response: {} }));
9895
}
9996

10097
export class SchemasRouter extends PromiseRouter {

0 commit comments

Comments
 (0)