You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 3, 2021. It is now read-only.
I have the below definition for a Thing and I can't seem to figure out how to get isFollowing to work as it's not clear how to pass custom variables to neo4j-graphql-js.
I thought I might be able to put them in my query e.g:
but it doesn't seem like there's any way for the "uid" variable that I passed to make its way to the Type Definition here, to be used for the "isFollowing" cypher directive.
type Thing {
id: String,
name: String,
description: String,
image: String,
followers: [User] @relation(name: "FOLLOWS", direction: "IN"),
follower_count: Int @cypher(statement: """
MATCH (u:User)-[:FOLLOWS]->(this)
RETURN count(u)
"""),
isFollowing: Boolean @cypher(statement: """
MATCH (u:User {id: $cypherParams.currentUserId}),(this)
RETURN EXISTS((u)-[:FOLLOWS]->(t))
"""),
}
I've seen the ability to add contextParams to an @cypher directive (here), but it's unclear how to inject information like that into a query such that it's even retrievable from "req".
Any thoughts on how to pass a currently signed in user's ID in a graphql query to neo4j-graphql-js?