From a036a051cb8a2eb3f6f9ce20ecd054c6138b90bf Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 24 Jul 2017 16:40:08 -0300 Subject: [PATCH] Using async await --- graph/resolvers/asset.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/graph/resolvers/asset.js b/graph/resolvers/asset.js index 497ea0f9b..da9114c6a 100644 --- a/graph/resolvers/asset.js +++ b/graph/resolvers/asset.js @@ -4,11 +4,13 @@ const Asset = { recentComments({id}, _, {loaders: {Comments}}) { return Comments.genRecentComments.load(id); }, - comment({id}, {id: commentId}, {loaders: {Comments}}) { - return Comments.getByQuery({ + async comment({id}, {id: commentId}, {loaders: {Comments}}) { + const comments = await Comments.getByQuery({ asset_id: id, ids: commentId - }).then((c) => c.nodes[0]); + }); + + return comments.nodes[0]; }, comments({id}, {sort, limit, deep, excludeIgnored, tags}, {loaders: {Comments}}) { return Comments.getByQuery({