Fixed listing issues
This commit is contained in:
@ -1,8 +1,5 @@
|
|||||||
import Router from 'koa-router';
|
import Router from 'koa-router';
|
||||||
import httpErrors from 'http-errors';
|
import httpErrors from 'http-errors';
|
||||||
import {
|
|
||||||
sequelize,
|
|
||||||
} from '../sequelize';
|
|
||||||
import { lock } from '../redis';
|
import { lock } from '../redis';
|
||||||
import isUUID from 'validator/lib/isUUID';
|
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,
|
parentDocumentId: parentDocumentObj.id,
|
||||||
atlasId: ownerCollection.id,
|
atlasId: ownerCollection.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
@ -144,11 +141,11 @@ router.post('documents.create', auth(), async (ctx) => {
|
|||||||
// TODO: Move to afterSave hook if possible with imports
|
// TODO: Move to afterSave hook if possible with imports
|
||||||
if (parentDocument && ownerCollection.type === 'atlas') {
|
if (parentDocument && ownerCollection.type === 'atlas') {
|
||||||
await ownerCollection.reload();
|
await ownerCollection.reload();
|
||||||
ownerCollection.addNodeToNavigationTree(document);
|
ownerCollection.addNodeToNavigationTree(newDocument);
|
||||||
await ownerCollection.save();
|
await ownerCollection.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
done(resolve(document));
|
done(resolve(newDocument));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
Reference in New Issue
Block a user