Users would like to be able to track their workout progress over time. We need to create a new API endpoint to enable our mobile app to consume the data and show a graph. The endpoint should return volume (reps
* weight
) per workout session. The data should be restricted to the authenticated user. It should be ordered by the latest workout session first. The data should be paginated for performance reasons.
workout_sessions
: Contains high-level data about workout sessions, such as when it occurred and which user it belongs to.sets
: Contains set-level data, including the number of reps, lift ID, weight, and workout session ID.lifts
: Contains data about the lifts performed.
lift
: Filter by the lift performed.reps
: Filter by the number of reps.dates
: Filter by date range.
Note: Future parameters may be added.
- Results are paginated, showing 15 entries per page.
- Entries are ordered by the latest first.
The following stats are also required. They should consider the filters passed into the request as well.
- Max volume (reps x weight) for a single session across all time.
- Max weight lifted across all time.
- Volume (weight x reps) is calculated per workout session.
- Utilises Laravel's error handling for graceful error messages.
- Authentication issues are handled by the Laravel framework.
- Validate incoming parameters to ensure they meet the expected criteria.
Feel free to explore the code for a better understanding of the data structure.
Create the required endpoint and classes to create a solution to the problem listed above. Please take a fork of this repo and submit a pull request with your solution. Please include a brief explanation of your solution and any assumptions you made in your pull request.
You should spend no longer than 1-2 hours on this solution. Please list on the PR what you would have done if you had more time.
If you have any questions, or anything is unclear please reach out for additional support.