d5705c3a28
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #98
33 lines
782 B
Python
33 lines
782 B
Python
"""
|
|
Model definitions for ComicWork.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from src.db.models.comic import ComicWork
|
|
|
|
|
|
class ComicWorkResponse(BaseModel):
|
|
id: str
|
|
created_date: datetime
|
|
last_modified_date: datetime
|
|
version: int
|
|
comic_id: str
|
|
artist_id: str
|
|
work_type_id: str
|
|
|
|
|
|
def comicwork_to_response(comicwork: ComicWork) -> ComicWorkResponse:
|
|
response: ComicWorkResponse = ComicWorkResponse(
|
|
id=comicwork.id,
|
|
created_date=comicwork.created_date,
|
|
last_modified_date=comicwork.last_modified_date,
|
|
version=comicwork.version,
|
|
comic_id=str(comicwork.comic_id),
|
|
artist_id=str(comicwork.artist_id),
|
|
work_type_id=str(comicwork.work_type_id),
|
|
)
|
|
return response
|