From 48ed6d99f6bfa981bdfb28502ab15d2fd1a7614f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 15 Jan 2026 13:07:39 +0100 Subject: [PATCH] fix myRole field query --- backend/src/graphql/resolvers/groups.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backend/src/graphql/resolvers/groups.ts b/backend/src/graphql/resolvers/groups.ts index 1213c15a9..fbf5f96dc 100644 --- a/backend/src/graphql/resolvers/groups.ts +++ b/backend/src/graphql/resolvers/groups.ts @@ -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!')