From edeb22e70cc36f01661bf6570cf7e75afb8492d8 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 17 Jul 2023 15:58:46 +0200 Subject: [PATCH] room avatar is working (returns other users avatar image if present) --- backend/src/schema/types/type/Room.gql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/schema/types/type/Room.gql b/backend/src/schema/types/type/Room.gql index 76823d364..9950407b7 100644 --- a/backend/src/schema/types/type/Room.gql +++ b/backend/src/schema/types/type/Room.gql @@ -19,7 +19,12 @@ type Room { roomId: String! @cypher(statement: "RETURN this.id") roomName: String! @cypher(statement: "MATCH (this)<-[:CHATS_IN]-(user:User) WHERE NOT user.id = $cypherParams.currentUserId RETURN user.name") - avatar: String @cypher(statement: "MATCH (this)<-[:CHATS_IN]-(user:User) WHERE NOT user.id = $cypherParams.currentUserId RETURN user.avatar.url") + avatar: String @cypher(statement: """ + MATCH (this)<-[:CHATS_IN]-(user:User) + WHERE NOT user.id = $cypherParams.currentUserId + OPTIONAL MATCH (:User)-[:AVATAR_IMAGE]->(image:Image) + RETURN image.url + """) lastMessageAt: String