Files
kontor/kontor-api/src/schema/comics/artist.py
T
Thomas Peetz 40b498ed2a
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
complete loading single items
2026-05-21 13:43:53 +02:00

36 lines
775 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel
from src.db.models.comic import Artist
class ArtistCreation(BaseModel):
id: str
name: str
class ArtistResponse(BaseModel):
id: str
created_date: datetime
last_modified_date: datetime
version: int
name: str
weblink: Optional[str]
def artist_to_response(artist: Artist) -> ArtistResponse:
response: ArtistResponse = ArtistResponse(
id=artist.id,
created_date=artist.created_date,
last_modified_date=artist.last_modified_date,
version=artist.version,
name=artist.name,
weblink=artist.weblink
)
return response
class AddArtist(BaseModel):
id: str
name: str