Fixed Collection#updateDocument

This commit is contained in:
Jori Lallo
2017-06-04 22:12:36 -07:00
parent c229369efd
commit a4dca58ae7
4 changed files with 85 additions and 57 deletions

View File

@@ -39,14 +39,16 @@ export async function presentDocument(ctx, document, options) {
};
if (options.includeCollection) {
data.collection = await ctx.cache.get(document.atlasId, async () => {
const collection = await Collection.findOne({
where: {
id: document.atlasId,
},
});
return await presentCollection(ctx, collection);
});
data.collection =
options.collection ||
(await ctx.cache.get(document.atlasId, async () => {
const collection = await Collection.findOne({
where: {
id: document.atlasId,
},
});
return await presentCollection(ctx, collection);
}));
}
if (options.includeCollaborators) {
@@ -93,7 +95,6 @@ export async function presentCollection(
};
if (collection.type === 'atlas') {
data.navigationTree = collection.navigationTree;
data.documents = await collection.getDocumentsStructure();
}