In graphDBs you don’t have to care about foreign keys, join tables and so on. Graphs are all about relations.
Your schema would look like
PS: This is a DQL Schema, not GraphQL.
type User {
name
phone
}
type Product {
title
barcode
}
type Trade {
tax
from
products
}
name: string @index(exact) .
phone: string .
title: string @index(exact) .
barcode: string @index(exact) .
tax: int .
from: uid @reverse .
products: uid @reverse .
Your mutation
{
"set": [
{
"tax": "0%",
"from": {
"uid": "0xa31"
},
"products": [
{
"uid": "0x21"
},
{
"uid": "0x22"
},
{
"uid": "0x23"
}
]
}
]
}
And you can do calculations on the fly with queries.