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: prices GET endpoint #26

Merged
merged 3 commits into from
Nov 15, 2023
Merged

feat: prices GET endpoint #26

merged 3 commits into from
Nov 15, 2023

Conversation

raphodn
Copy link
Member

@raphodn raphodn commented Nov 14, 2023

What

  • new GET endpoint /prices
  • no authentication needed
  • basic filters

Todo (futur PRs)

  • look at fastapi-filter for additional/complex filtering
  • and fastapi-pagination

@raphodn raphodn force-pushed the raphodn/price-get-endpoint branch from 7e749bc to f6ae9aa Compare November 14, 2023 14:07
@raphodn raphodn force-pushed the raphodn/price-create-endpoint branch from 118a132 to f62ee3e Compare November 15, 2023 14:00
Base automatically changed from raphodn/price-create-endpoint to main November 15, 2023 14:06
@raphodn raphodn force-pushed the raphodn/price-get-endpoint branch from 8e28b98 to 162f6aa Compare November 15, 2023 14:09
@raphodn raphodn marked this pull request as ready for review November 15, 2023 14:18
@raphodn raphodn requested a review from raphael0202 November 15, 2023 14:18
app/api.py Outdated
@@ -124,6 +126,12 @@ async def authentication(form_data: Annotated[OAuth2PasswordRequestForm, Depends
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Server error")


@app.get("/prices", response_model=List[schemas.PriceBase])
Copy link
Member Author

Choose a reason for hiding this comment

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

@raphael0202 this is a simple v1, but I feel we'll need to have improvements like

  • using fastapi-filters to have more complex filtering
  • pagination & limit parameters
  • should the endpoint answer a list, or a dict with keys like "data" ?

Copy link
Contributor

Choose a reason for hiding this comment

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

pagination would be good to have indeed!
Better have a dict as a response, so we can add other fields if needed.
like {"prices": [...]}

Copy link
Member Author

Choose a reason for hiding this comment

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

in Django Rest Framework the following format is returned
image

Copy link
Member Author

Choose a reason for hiding this comment

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

I found fastapi-pagination, I'll add it in a follow-up PR

app/api.py Outdated Show resolved Hide resolved
@raphodn raphodn force-pushed the raphodn/price-get-endpoint branch from 162f6aa to 47c31bd Compare November 15, 2023 15:09
@raphodn raphodn merged commit a769910 into main Nov 15, 2023
3 of 4 checks passed
@raphodn raphodn deleted the raphodn/price-get-endpoint branch November 15, 2023 15:12
@raphodn raphodn mentioned this pull request Jan 14, 2024
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