Fixed listing issues

This commit is contained in:
Jori Lallo
2016-09-11 15:06:02 -07:00
parent 6ed3dcdeed
commit d65c5ff6f4

View File

@ -1,8 +1,5 @@
import Router from 'koa-router';
import httpErrors from 'http-errors';
import {
sequelize,
} from '../sequelize';
import { lock } from '../redis';
import isUUID from 'validator/lib/isUUID';
@ -130,7 +127,7 @@ router.post('documents.create', auth(), async (ctx) => {
});
}
const document = await Document.create({
const newDocument = await Document.create({
parentDocumentId: parentDocumentObj.id,
atlasId: ownerCollection.id,
teamId: user.teamId,
@ -144,11 +141,11 @@ router.post('documents.create', auth(), async (ctx) => {
// TODO: Move to afterSave hook if possible with imports
if (parentDocument && ownerCollection.type === 'atlas') {
await ownerCollection.reload();
ownerCollection.addNodeToNavigationTree(document);
ownerCollection.addNodeToNavigationTree(newDocument);
await ownerCollection.save();
}
done(resolve(document));
done(resolve(newDocument));
});
});
})();