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

🐛 Bug Fix: Inconsistent API Dev project #695

Merged
merged 4 commits into from
Oct 19, 2024

Conversation

yashksaini-coder
Copy link
Contributor

Pull Request for PyVerse 💡

Requesting to submit a pull request to the PyVerse repository.


Issue Title

Please enter the title of the issue related to your pull request.
Fixes: #675

  • I have provided the issue title.

Info about the Related Issue

What's the goal of the project?
Describe the aim of the project.

An interactive web app that is used to analyze WhatsApp chats using NLP techniques

  • I have described the aim of the project.

Name

Please mention your name.
Yash K. Saini

  • I have provided my name.

GitHub ID

Please mention your GitHub ID.
yashksaini-coder

  • I have provided my GitHub ID.

Email ID

Please mention your email ID for further communication.
Enter your email ID here.

[email protected]

  • I have provided my email ID.

Identify Yourself

Mention in which program you are contributing (e.g., WoB, GSSOC, SSOC, SWOC).
Enter your participant role here.
GSSOC-Ext

  • I have mentioned my participant role.

Closes

Enter the issue number that will be closed through this PR.
Closes: #675

  • I have provided the issue number.

Describe the Add-ons or Changes You've Made

Give a clear description of what you have added or modified.
Describe your changes here.

This pull request includes several changes to improve the code quality, fix bugs, and enhance the functionality of the API. The most important changes include fixing a bug in the database initialization, improving error handling for duplicate entries, and updating the database models.

Bug Fixes and Improvements:

  • api_dev/database.py: Ensured database tables are created when the engine is initialized by adding Base.metadata.create_all(bind=engine).
  • api_dev/main.py: Added error handling for duplicate book entries using IntegrityError in the create_book endpoint. [1] [2]

Code Quality Enhancements:

  • api_dev/database.py: Improved comments for better readability and fixed typos in the descriptions.
  • api_dev/main.py: Simplified and clarified comments in API endpoints and improved Pydantic model configuration.

Database Model Updates:

  • api_dev/models.py: Increased the string length for the title column and removed the unique constraint on the author column in the Book model.
  • I have described my changes.

Type of Change

Select the type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Describe how your changes have been tested.
On my codespace

  • I have described my testing process.

Checklist

Please confirm the following:

  • My code follows the guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly wherever it was hard to understand.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added things that prove my fix is effective or that my feature works.
  • Any dependent changes have been merged and published in downstream modules.

@UTSAVS26 I have completed teh bug fixes, with new properly feat to the chat analayzer web app. Reveiw this PR, and aa proper labels to it, also assign me on this PR.

Remove unique=True from author if duplicate authors are allowed
Increase the character limit to String(100) or String(255) for flexibility
Implement checks for existing books or handle SQLAlchemy’s IntegrityError
Adjust the return to None or change the status code to 200 OK with a message
Copy link

👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly!

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

@yashksaini-coder
Copy link
Contributor Author

hey @UTSAVS26 did you look at this

@UTSAVS26 UTSAVS26 merged commit a0b5567 into UTSAVS26:main Oct 19, 2024
1 check passed
@UTSAVS26 UTSAVS26 added Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. Status: Approved PRs that have passed review and are approved for merging. level3 gssoc-ext hacktoberfest hacktoberfest-accepted labels Oct 19, 2024
@yashksaini-coder yashksaini-coder deleted the yash/fix-675 branch October 19, 2024 06:35
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 hacktoberfest-accepted level3 Status: Approved PRs that have passed review and are approved for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛: Inconsistent API Dev project
2 participants