Recently, I needed virtual attribute which combines or mutates original attributes.
fullName which combines
studentCount which aggregates count from relation
I want to achieve it on GraphQL. Is there a proper way to achieve it?
Welcome @darron1217 ,
Virtual fields are currently not possible by default, but there has been some discussion going on how to implement it. Checkout this RFC.
For now you could create a custom query in your GraphQL shema(s) to implement some custom logic. These docs could help you out:
afterFind Lifecycle hook could help you out realizing the ‘calculated’ logic on student fetches.
Hope this helps