Given the following example:
I want to implement a student report endpoint with API platform.
api/report/student
I have the following tables:
Student
id,
name,
address
Invoice
id,
description,
amount,
status,
student_id
I would like to work an API endpoint to return with the following information:
{
data: [
student_id: 1,
student_name: john,
outstanding_amount: 200 (Total of unpaid bill)
],
[
student_id: 2,
student_name: mike,
outstanding_amount: 300 (Total of unpaid bill)
]
}
Just wondering what would be the best practice to write an API endpoint for the report with API platform (https://api-platform.com).
The report endpoint requires sorting, joining tables and pagination etc.
What would be the best practice is to achieve this with the API platform? Is this something we can achieve with GraphQL or we need to bind it with controller action for doing this?
Thanks.