Skip to content

Conversation

@ramonechen
Copy link
Contributor

What?

This is the initial implementation of the FastAPI API, based on the existing Spring Boot API.

Why?

Spring Boot is stupid and has way too many nuances to implement even something basic. Spring Boot is very scalable, but not very suitable for the scale we're operating at.

How?

I implemented all of our existing endpoints using Python (FastAPI, SQLModel). The behavior of each endpoint should be completely unchanged from the Spring Boot implementation. Except for the "/api/v1/course/all" endpoint, which has been removed in this implementation.

Testing?

Trust me bro.

Anything Else?

Have a good day.

All course data-related endpoints from the old Spring Boot API except for the /all endpoint have been implemented in the course_controller.py file.

I've decided to take an approach of using parameterized string queries instead of SQLModel's ORM features. I feel like we just don't have enough endpoints to justify writing queries and database models object-oriented style, but this is subject to change.
An .env file is required to supply the API with the credentials needed to interact with the database. An example .env has been added to demonstrate the file format and required variables.
Created course, course_attribute, and course_seats table models and modified the /api/v1/filter/values/{filter} endpoint to use these models instead of raw string queries.

Placed database models and endpoint controllers into their own folders for organization.
Just because I accidentally modified this file instead of making my own .env.
Just aligning with the FastAPI naming convention.
Before, the schema and tables were being created implicitly (if they didn't already exist) on each start-up of the API. They're now wrapped in a function definition so that it doesn't happen implicitly.
Also used black to format all Python files.
I forgot to checkout the code before running the black check.
@ramonechen ramonechen requested a review from jzgom067 February 7, 2025 22:54
Copy link

@jzgom067 jzgom067 left a comment

Choose a reason for hiding this comment

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

@ramonechen ramonechen merged commit 6765c79 into main Feb 7, 2025
2 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.

3 participants