This commit is contained in:
Jori Lallo
2016-06-23 00:19:45 -07:00
parent 7f4095b77f
commit 7ea6eb5d28
2 changed files with 8 additions and 1 deletions

View File

@ -119,6 +119,9 @@ router.post('documents.delete', auth(), async (ctx) => {
if (!document) throw httpErrors.BadRequest(); if (!document) throw httpErrors.BadRequest();
// TODO: Don't allow to destroy root docs
// TODO: handle sub documents
try { try {
await document.destroy(); await document.destroy();
} catch (e) { } catch (e) {

View File

@ -56,7 +56,11 @@ const Atlas = sequelize.define('atlas', {
atlasId: this.id, atlasId: this.id,
}}); }});
return await getNodeForDocument(rootDocument); if (rootDocument) {
return await getNodeForDocument(rootDocument);
} else {
return; // TODO should create a root doc
}
} }
} }
}); });