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 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=comicwork.comic_id,
|
||||
artist_id=comicwork.artist_id,
|
||||
work_type_id=comicwork.work_type_id,
|
||||
)
|
||||
return response
|
||||
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Model definitions for IssueWork.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.db.models.comic import IssueWork
|
||||
|
||||
|
||||
class IssueWorkResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
issue_id: str
|
||||
artist_id: str
|
||||
work_type_id: str
|
||||
|
||||
|
||||
def to_response(issuework: IssueWork) -> IssueWorkResponse:
|
||||
response: IssueWorkResponse = IssueWorkResponse(
|
||||
id=issuework.id,
|
||||
created_date=issuework.created_date,
|
||||
last_modified_date=issuework.last_modified_date,
|
||||
version=issuework.version,
|
||||
issue_id=issuework.issue_id,
|
||||
artist_id=issuework.artist_id,
|
||||
work_type_id=issuework.work_type_id,
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user