Hello,
I create new Category type DQL schema as below. Need to set category as hierarchy level
type Category {
name: String! @id @search(by: [regexp])
position: Int @default(add: { value: 0})
parent: Category
subCategories: [Category] @hasInverse(field: parent)
}
When try to get details of child category using graphql query as below
{
queryCategory {
name
position
parent(filter: {name: {eq:"Parts"}}) {
name
}
}
}
It’s return all categories data as below
{
"data": {
"queryCategory": [
{
"name": "Parts",
"position": 1,
"parent": null
},
{
"name": "Mobile Parts",
"position": 9,
"parent": {
"name": "Parts"
}
}
]
},
}
Please help for that anything wrong with schema or query?