add nComments resolver

This commit is contained in:
keyan 2022-04-15 11:51:49 -05:00
parent f40fe85d5a
commit a49cd8500c
2 changed files with 6 additions and 0 deletions

View File

@ -759,6 +759,11 @@ export default {
return sats || 0 return sats || 0
}, },
meComments: async (item, args, { me, models }) => {
if (!me) return 0
return await models.items.count({ where: { userId: me.id, parentId: item.id } })
},
mine: async (item, args, { me, models }) => { mine: async (item, args, { me, models }) => {
return me?.id === item.userId return me?.id === item.userId
}, },

View File

@ -60,6 +60,7 @@ export default gql`
sats: Int! sats: Int!
upvotes: Int! upvotes: Int!
meSats: Int! meSats: Int!
meComments: Int!
ncomments: Int! ncomments: Int!
comments: [Item!]! comments: [Item!]!
path: String path: String