Skip to content

Api ticket #14 and #15 - #34

Merged
shreya-m9 merged 12 commits into
mainfrom
api-ticker#14
Sep 26, 2026
Merged

shreya-m9 merged 12 commits into
mainfrom
api-ticker#14

Conversation

@mdeekshita

Copy link
Copy Markdown
Collaborator

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

Screenshot 2026-09-20 at 12 21 24 AM Screenshot 2026-09-20 at 12 22 22 AM

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.

Screenshot 2026-09-20 at 12 31 08 AM

Ticket Review

Answer the following:

  1. What went well: Creating the hooks and the endpoints once we knew what we wanted to create
  2. What was difficult: figuring out what types of endpoints to create or how to test it.
  3. If you could start over, what would you do differently: maybe do more research on what else we could add.

Comment thread backend/services/race_service.py Outdated
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):

@henrybednarz henrybednarz Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 henrybednarz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@henrybednarz henrybednarz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@shreya-m9 shreya-m9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hooks and mock data look good!

@shreya-m9
shreya-m9 merged commit 3c492f8 into main Sep 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dashboard] Create reusable hooks for pulling data from backend [FastAPI] Create API contract for our backend service

4 participants