Creating a single relationship between multiple type of nodes

Hi all
I am trying to design my own project and was curious about something once I finished design. So initially My system had the follwoing two relationships going on

(User) -[LIVES_AT]->(Address)-[HASZIP]->Zipcode
(Clubs) -[LOCATED_AT]->(Address)-[HASZIP]->Zipcode

After the first iteration I figured I should remove the address node entirely(it had no properties in it that I really wanted to keep). So now I want it something like

(User) -[HASZIP]->Zipcode
(Clubs) -[HASZIP]->Zipcode

So here is the question part. When writing a typedef for this realtionship, I want the api to allow user to be null or club to be null but not both. Is there a way to achieve this?

type HAS_ZIP @relation(name: "HAS_ZIP"){


user: User(not sure?)

club: Club(not sure?)

zipcode : ZIPCode!


Hi, I don't know abou typedef but you could use the constraints o created a query that get both relations a compare if is null.


Oh ye that makes sense. Do you guys have any sample projects that make use of contraints ?
Thanks again for the help

You can see info about constrainsts here: