Let's consider the following pseudo entities:
cateogory
{
id
name
...
}
product
{
id
name
categories[] {
{id: 1, isDefault: false},
{id: 2, isDefault: true}
}
}
In other words product knows about assigned categories and which of their is default.
Now I would like to model it as graphql queries in hot chocolate. First query is for getting categories list, second query is for getting products lists. The products list should contain assigned categories with details and information whether category is default or not.
In this case should I create CategoryProductType that contains {id, name, isDefault}
or {isDefault, categoryInfo {id, name}}
? The main difference is that categoryInfo field is of the same type like the category and if I add one more fields to the categoryType, then it will appear in category details inside product.
Which approach is more correct?