I'm having an issue creating a relationship the right way, I have these schemas :
type User {
id: ID!
mail: String!
password: String! @private
meals: [Meal] @relationship(type: "IN_MEALS", direction: IN)
}
type Meal {
name: String!
createdBy: User! @relationship(type: "IN_MEALS", direction: OUT)
}
And I added this mutation to create a meal directly as one of the current user's like so :
type Mutation {
createMeal(name: String!): Meal
@cypher(
statement: """
MATCH (u:User {id: $auth.jwt.id})
MERGE (m:Meal {name: $name})-[r:IN_MEALS]->(u)
RETURN m
"""
)
}
In neo4j databse the relation is made to the user and all seems good but when I query meals of the users or the createdBy field of a meal it shows "null", what am I missing?