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

🐛: Inconsistent API Dev project #675

Closed
yashksaini-coder opened this issue Oct 17, 2024 · 5 comments · Fixed by #695
Closed

🐛: Inconsistent API Dev project #675

yashksaini-coder opened this issue Oct 17, 2024 · 5 comments · Fixed by #695
Assignees
Labels
Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. gssoc-ext hacktoberfest level3 Status: Assigned Indicates an issue has been assigned to a contributor.

Comments

@yashksaini-coder
Copy link
Contributor

Title

Inconsistent code, Bugs and errors in Database Setup, FastAPI API, and SQLAlchemy Model

Bug

Several issues were identified across three files related to database setup, FastAPI API development, and model constraints. These bugs affect database table creation, API responses, and data validation. Specifically:

  • Missing model creation in the database setup file.
  • Inconsistent API response models in the FastAPI endpoints.
  • Improper handling of unique constraints and string lengths in the SQLAlchemy model.

Changes

Database Setup File

  • Add Base.metadata.create_all(bind=engine) to ensure the tables are created in the database.

FastAPI API File

  • Add a response_model=BookBase to the get_book() method decorator.
  • Implement checks for existing books or handle the SQLAlchemy Integrity Error.
  • Adjust the return to None or change the status code to 200 OK with a message.

SQLAlchemy Model File

  • Remove the (unique=True) from author if duplicate authors are allowed.
  • Increase the character limit from String(100) or String(255) for more flexibility.

Screenshots 📷

image

image

image

Full Name

Yash K. Saini

Participant Role

GSSOC

Copy link

🙌 Thank you for bringing this issue to our attention! We appreciate your input and will investigate it as soon as possible.

Feel free to join our community on Discord to discuss more!

@yashksaini-coder
Copy link
Contributor Author

@UTSAVS26 can you assign me this issue with proper labels

@yashksaini-coder
Copy link
Contributor Author

hey @UTSAVS26 can you assign me this issue

@UTSAVS26 UTSAVS26 added Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. Status: Assigned Indicates an issue has been assigned to a contributor. level3 gssoc-ext hacktoberfest labels Oct 18, 2024
Copy link

✅ This issue has been closed. Thank you for your contribution! If you have any further questions or issues, feel free to join our community on Discord to discuss more!

1 similar comment
Copy link

✅ This issue has been closed. Thank you for your contribution! If you have any further questions or issues, feel free to join our community on Discord to discuss more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. gssoc-ext hacktoberfest level3 Status: Assigned Indicates an issue has been assigned to a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants