I was evaluating Hasura GraphQL engine + Postgres on Heroku and have run into a situation. I have 2 simple tables as shown below;
Employees
Employees table and Payrolls have a foreign key employees.ID -> payrolls.employee_id Employees table has a foreign key with itself employees.manager_id -> employees.ID
I have gone ahead and "auto-tracked" all the relationships in Hasura.
What I want to calculate is the "sum of salaries" for all employees reporting. But, when I'm using the Hasura explorer to form the GQL query, I'm not able to find the "sum" aggregation under the "managed_employees_aggregate" subquery.
The expected output is
[
{
"full_name": "anuj gupta",
"total_reportee_salary": 4000
},
{
"full_name": "sowmya",
"total_reportee_salary": 2000
},
... "total_reportee_salary" for everyone else is 0
]
Any suggestions or references is really appreciated.