mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-17 10:21:31 +00:00
fix myRole field query
This commit is contained in:
parent
017bfbc820
commit
48ed6d99f6
@ -460,6 +460,23 @@ export default {
|
||||
},
|
||||
},
|
||||
Group: {
|
||||
myRole: async (parent, _args, context: Context, _resolveInfo) => {
|
||||
if (!parent.id) {
|
||||
throw new Error('Can not identify selected Group!')
|
||||
}
|
||||
return (
|
||||
await context.database.query({
|
||||
query: `
|
||||
MATCH (:User {id: $user.id})-[membership:MEMBER_OF]->(group:Group {id: $parent.id})
|
||||
RETURN membership.role as role
|
||||
`,
|
||||
variables: {
|
||||
user: context.user,
|
||||
parent,
|
||||
},
|
||||
})
|
||||
).records.map((r) => r.get('role'))[0]
|
||||
},
|
||||
inviteCodes: async (parent, _args, context: Context, _resolveInfo) => {
|
||||
if (!parent.id) {
|
||||
throw new Error('Can not identify selected Group!')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user