move kontor_model in kontor-api (#98)
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #98
This commit was merged in pull request #98.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
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
|
||||
Reference in New Issue
Block a user