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 has been 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?
Thank you in advance, and Happy New Year!
I'm
The text was updated successfully, but these errors were encountered:
I don't believe this is the appropriate venue for this question as I don't think this is an issue with this package, but what you are looking for is adding an object called cypherParams to the GraphQL context.
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:
query get_thing {
Thing (id: "QEQXbK2Z6Ngp40TMOYKVx73XtEu2", uid: "ffe38a42-474f-4426-bc45-2453e19a4d83") {
id
isFollowing
}
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.
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?
Thank you in advance, and Happy New Year!
I'm
The text was updated successfully, but these errors were encountered: