From f39e27c47c2a90fe72a0edd287d93f34d54d6de3 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Sun, 3 Mar 2019 19:29:40 +0100 Subject: [PATCH] Added followedByCurrentUser and shoutedByCurrentUser --- src/schema.graphql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/schema.graphql b/src/schema.graphql index 20a0b3652..dd2bfde59 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -92,6 +92,12 @@ type User { followedBy: [User]! @relation(name: "FOLLOWS", direction: "IN") followedByCount: Int! @cypher(statement: "MATCH (this)<-[:FOLLOWS]-(r:User) RETURN COUNT(DISTINCT r)") + "Is the currently logged in user following that user?" + followedByCurrentUser: Boolean! @cypher(statement: """ + MATCH (this)<-[:FOLLOWS]-(u:User {id: $cypherParams.currentUserId}) + RETURN COUNT(u) >= 1 + """) + #contributions: [WrittenPost]! #contributions2(first: Int = 10, offset: Int = 0): [WrittenPost2]! # @cypher( @@ -150,6 +156,12 @@ type Post { shoutedBy: [User]! @relation(name: "SHOUTED", direction: "IN") shoutedCount: Int! @cypher(statement: "MATCH (this)<-[:SHOUTED]-(r:User) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(DISTINCT r)") + + "Has the currently logged in user shouted that post?" + shoutedByCurrentUser: Boolean! @cypher(statement: """ + MATCH (this)<-[:SHOUTED]-(u:User {id: $cypherParams.currentUserId}) + RETURN COUNT(u) >= 1 + """) } type Comment {