move kontor_model in kontor-api

This commit is contained in:
Thomas Peetz
2026-10-15 19:10:32 +02:00
parent 2e80cd9b0e
commit 7cc2784bdb
69 changed files with 3974 additions and 730 deletions
+29
View File
@@ -0,0 +1,29 @@
from datetime import datetime
from pydantic import BaseModel
from src.db.models.bookshelf import Book
class BookResponse(BaseModel):
id: str
created_date: datetime
last_modified_date: datetime
version: int
isbn: str
title: str
year: int
publisher_id: str
def to_response(book: Book) -> BookResponse:
response: BookResponse = BookResponse(
id=book.id,
created_date=book.created_date,
last_modified_date=book.last_modified_date,
version=book.version,
isbn=str(book.isbn),
title=str(book.title),
year=book.year,
publisher_id=str(book.publisher_id)
)
return response