Fork me on GitHub
#graphql
<
2021-04-19
>
fabrao03:04:36

Hello all, how do I use relationship one-to-many? Is it in object or query?

Lennart Buit08:04:30

I don’t fully understand the question. In lacinia, you can just mark a field as having type (list :Thing), then you can just return a list from your resolver

fabrao09:04:24

but how do you make the relationship one to many in resolver?

fabrao09:04:14

like if you have relationship product -> items

Lennart Buit12:04:08

You just return a list of things. So say that you have a type Product { }, that has a field Product#items, which has type (list :Item), you can create a resolver that returns that list of items

fabrao21:04:10

Lennart, but the resolver is formatted like what?