Fix issue #3: Book API source model #6
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes #3.
The issue has been successfully resolved. The changes implement a complete solution for storing different book API sources in the database:
Created a new
book_api_sourcestable in the database through a migration file (20250403000000_add_book_api_sources.sql) that includes fields for id, name, api_url, api_key, description, is_active, and timestamps.Added appropriate row-level security policies for the new table.
Pre-populated the table with default sources (Google Books API and Open Library API).
Modified the
user_bookstable constraint to reference the newbook_api_sourcestable, ensuring that book sources are valid.Created a new TypeScript interface
BookApiSourcein the types file to represent the data structure.Implemented a complete service (
bookApiSourceService.ts) with CRUD operations for managing book API sources.Updated the database schema documentation to include the new table.
Expanded the
BookSourcetype to include 'openlibrary' and allow for string values from the database.These changes provide a robust solution for storing and managing different book API sources in the database, which directly addresses the requirements in the issue description.
Automatic fix generated by OpenHands 🙌