-
Notifications
You must be signed in to change notification settings - Fork 0
Sub feat/crud genre song albums #13
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
base: dev
Are you sure you want to change the base?
Conversation
backend/app/api/v1/genre.py
Outdated
| return genre | ||
|
|
||
|
|
||
| @router.get("/name/{name}", response_model=GenreOut) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this API. Use a query-param to the GET genre API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed updates and changes
backend/app/api/v1/genre.py
Outdated
| current_admin: dict = Depends(get_current_admin) | ||
| ): | ||
| """Create a new genre - admin only""" | ||
| if genre_name_taken(db, genre_data.name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do the same thing by only one database call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use integrity error to throw an exception, looked it up working similarly to how it works for CREATE ... IF NOT EXISTS in raw sql
backend/app/api/v1/song.py
Outdated
| return get_all_songs_paginated(db, skip=skip, limit=limit) | ||
|
|
||
|
|
||
| @router.get("/search", response_model=List[SongOut]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this API and add required query-params to the GET API route.
- genre search is case insensitive - genre name taken check is case insensitive - no redundant double GET endpoints for genre, only one get endpoint to get all and get via query param. - Get endpoint allows close matches - fixed redundant and useless usage of /admin endpoints to : no deletion option for genre, only disable option., admin see all genre others only active ones - single db call for genre create, removed prechecks and returning exception error based on crud returns
…as {name} in endpoints which might have whitespaces.
- added fuzzy search to song.
- rmeoved /search endpoint in song and resuing current get endpoint with query params
NOTE: TO BE APPROVED AFTER
sub-feat/crud-userbands, foreign key touserdata model to store who is the owner of thebandviacreated_by_user_idto enforce stricter rbac