d5705c3a28
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #98
26 lines
695 B
Python
26 lines
695 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from src.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
|