Api ticket #14 and #15 - #34
Conversation
| def get_energy(self, race_id, lap_number): | ||
| return self.repository.get_lap_energy(race_id, lap_number) | ||
|
|
||
| def get_average_speed(self, race_id: int, lap_number: int): |
There was a problem hiding this comment.
This might be a service-level request. This implementation means that we are storing for each lap on a separate table in the repository the average speed for each lap. Might make more sense to just calculate it each time when we pull the lap.
This also does not necessary have to be its own independent thing. We could bundle it all in with a get_lap so when you pull the lap it adds up the average speed and adds that to the lap info on top of the array of data points.
I think the same can be said for average_speed_between_points. We can just bundle that with the getting between points anyway
henrybednarz
left a comment
There was a problem hiding this comment.
Left one small comment. Mostly just thinking about what should live in the repository as stored information and what should exist in the services. Not everything has to be its own table in the repo, we can also just calculate it if the overhead is low.
…nto api-ticker#14
shreya-m9
left a comment
There was a problem hiding this comment.
The hooks and mock data look good!
Overview
This ticket was to set up the endpoints and the hooks that we could potentially need for this project. The main files that were touched were backend/controllers, backend/repositories, backend/services, frontend/src/api/client.js, frontend/src/hooks
Technical Description
For the endpoints, we split them up by controllers, repositories, and services so that if something has to change, not everything has to get touched. After that created hooks based on the API endpoints we added.
In controllers added the actual endpoints
In services, added template code but this is where we would do any transformations, etc
In repositories this is where it would actually connect to the database. Since we do not have this already set up, and we wanted to test our endpoints along with the hooks, we created sample data for this and know that if it works it will pull this sample data.
How Has This Been Tested?
for the endpoint:
cd ~/Desktop/orion/backend
uvicorn main:app --reload
and then went to local host. Here i was able to put in inputs and see if each one returned an output
for the hooks:
cd ~/Desktop/orion/frontend
npm run dev
Since we don't have a frontend done yet, it was a little tricky, but I basically went in and changed the app.js to portray whatever endpoint data I wanted, and then I ran that. If the screen had the sample data (from the repository) it worked.
Ticket Review
Answer the following: