Open alastair opened 4 years ago
We found that you can make a relation for a single item:
target: ThingInterface! @relation(name: "ANNOTATION_TARGET", direction: OUT)
However, in the case where a field is required and a relation, the Create mutation allows you to create an object without the field (because you need to use Add/Merge to create the relation), but if you try and do a Query that includes this field when it's not set an error will be raised. This can probably be closed if we're happy with the current solution.
We have a few cases where we want to model a one-to-many relationship.
Using the neo4j-graphql-js library we haven't found a good way to do this. Currently we use
@relation
to define a many-to-many relationship.@ChristiaanScheermeijer suggested that we could try and use Neo4j constraints. We need to see if this is a suitable solution.
https://github.com/trompamusic/ce-api/pull/90/files/123f1a4849e69dde82543d77dc224d9ac0c8cf2e#r384462860