mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
implement currenltyPinnedPostsCount on Group
This commit is contained in:
parent
28071bc537
commit
8f71d4f5fb
@ -479,7 +479,16 @@ export default {
|
||||
).records.map((r) => r.get('inviteCodes'))
|
||||
},
|
||||
currentlyPinnedPostsCount: async (parent, _args, context: Context, _resolveInfo) => {
|
||||
return 0
|
||||
if (!parent.id) {
|
||||
throw new Error('Can not identify selected Group!')
|
||||
}
|
||||
const result = await context.database.query({
|
||||
query: `
|
||||
MATCH (:User)-[pinned:GROUP_PINNED]->(pinnedPosts:Post)-[:IN]->(:Group {id: $group.id})
|
||||
RETURN count(pinnedPosts) as count`,
|
||||
variables: { group: parent },
|
||||
})
|
||||
return result.records[0].get('count')
|
||||
},
|
||||
...Resolver('Group', {
|
||||
undefinedToNull: ['deleted', 'disabled', 'locationName', 'about'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user