moved support for deepReplyCount to seperate field

This commit is contained in:
Wyatt Johnson
2017-09-14 13:08:01 -06:00
parent 26256b979e
commit d820d2d2c3
@@ -59,6 +59,13 @@ const genDeepCommentCount = async (context, parent_ids) => {
};
module.exports = {
typeDefs: `
type Comment {
# deepReplyCount is the count of all decendant replies.
deepReplyCount: Int
}
`,
loaders: (context) => ({
Comments: {
getDeepCount: new DataLoader((parent_ids) => genDeepCommentCount(context, parent_ids)),
@@ -66,7 +73,7 @@ module.exports = {
}),
resolvers: {
Comment: {
replyCount({id}, args, {loaders: {Comments}}) {
deepReplyCount({id}, args, {loaders: {Comments}}) {
return Comments.getDeepCount.load(id);
}
}