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
@@ -0,0 +1,25 @@
from datetime import datetime
from pydantic import BaseModel
from kontor_model.db.models.bookshelf import BookAuthor
class BookAuthorResponse(BaseModel):
id: str
created_date: datetime
last_modified_date: datetime
version: int
author_id: str
book_id: str
def to_response(bookauthor: BookAuthor) -> BookAuthorResponse:
response: BookAuthorResponse = BookAuthorResponse(
id=bookauthor.id,
created_date=bookauthor.created_date,
last_modified_date=bookauthor.last_modified_date,
version=bookauthor.version,
author_id=str(bookauthor.author_id),
book_id=str(bookauthor.book_id)
)
return response