Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Types for the FastAPI API and API refactor #748

Merged
merged 20 commits into from
Oct 10, 2024

Conversation

filiptrplan
Copy link
Collaborator

@filiptrplan filiptrplan commented Sep 30, 2024

Description:

Added Pydantic types to the FastAPI responses. This is preparation so we can generate a strongly-typed frontend client.

We also have a lot of endpoints that return JSON like this

{
  "success": true,
  "message": "..."
}

And returns false when the action fails, the status code remains 200. We will migrate to a new response type where we don't include the success variable and handle errors by returning the appropriate HTTP status codes.

Checklist

  • items.py
  • Type scrape.py
  • Type settings.py
  • Type tmdb.py
  • Type default.py
  • Test all the changed API endpoints
    • Ensure compatibility with the frontend

@dreulavelle
Copy link
Member

We should add the settings models to this too. We should be handling validations with pydantic for those too.. before now we havent used the full potential of pydantic.

Apreciate the hard work man!

@filiptrplan
Copy link
Collaborator Author

We should add the settings models to this too. We should be handling validations with pydantic for those too.. before now we havent used the full potential of pydantic.

Apreciate the hard work man!

Added to the goals :)

@filiptrplan filiptrplan changed the title Types for the FastAPI API feat: Types for the FastAPI API and API refactor Oct 4, 2024
@dreulavelle dreulavelle merged commit 9eec02d into rivenmedia:main Oct 10, 2024
1 check 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.

2 participants