mirror of
https://github.com/wassname/talk.git
synced 2026-10-28 13:30:17 +08:00
moved support for deepReplyCount to seperate field
This commit is contained in:
1 parent
26256b979e
commit
d820d2d2c3
1 file changed
+8
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user