From 2f21ba062b90b65338d0956d4d54c815e332e46f Mon Sep 17 00:00:00 2001 From: vikram-blaxel Date: Thu, 9 Apr 2026 20:25:12 +0530 Subject: [PATCH 1/2] Add publisher field to book model --- models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/models.py b/models.py index bd73c60..9c4ec41 100644 --- a/models.py +++ b/models.py @@ -18,6 +18,7 @@ class Book(Base): id: Mapped[int] = mapped_column(primary_key=True, index=True) title: Mapped[str] = mapped_column(String(255), index=True) author: Mapped[str] = mapped_column(String(255)) + publisher: Mapped[str] = mapped_column(String(255), nullable=False) # Pydantic models class BookIn(BaseModel): From f12900812529edd9ca749eb190d812ebb3f8ab42 Mon Sep 17 00:00:00 2001 From: FixerBot Date: Mon, 11 May 2026 09:09:33 +0000 Subject: [PATCH 2/2] fix: resolve test failures in PR #13 --- models.py | 2 ++ repositories.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 9c4ec41..3de4e16 100644 --- a/models.py +++ b/models.py @@ -26,6 +26,7 @@ class BookIn(BaseModel): title: str author: str + publisher: str = "" class BookOut(BaseModel): @@ -34,5 +35,6 @@ class BookOut(BaseModel): id: int title: str author: str + publisher: str model_config = ConfigDict(from_attributes=True) diff --git a/repositories.py b/repositories.py index dc9ff88..4fa11e7 100644 --- a/repositories.py +++ b/repositories.py @@ -4,7 +4,7 @@ # Create a new book def create_book(db: Session, book: models.BookIn): - db_book = models.Book(title=book.title, author=book.author) + db_book = models.Book(title=book.title, author=book.author, publisher=book.publisher) db.add(db_book) db.commit() db.refresh(db_book) @@ -27,6 +27,7 @@ def update_book(db: Session, book_id: int, book: models.BookIn): if db_book: db_book.title = book.title db_book.author = book.author + db_book.publisher = book.publisher db.commit() db.refresh(db_book) return db_book