I have an headless site that is using GraphQL and we have one query that need to do some calculation before returning the results.
I was planing to create a behaviours in Craft with a property that return the result.
If I'm querying the entry :
Entry::find()->section('xyz')->id('1')->one()->totalResult
The behaviours return what it is supposed.
If i'm building a GraphQL query I've got an error saying that the field cannot be query.
query MyQuery {
product {
id, title, totalResult
}
}
Is there a way for GraphQL to have access to this property or is there a simple workaround to create a custom query without having to create a separate api?