update models to use string type for id fields

This commit is contained in:
Thomas Peetz
2025-05-02 11:21:57 +02:00
parent 7ff2bf912d
commit c77adb0e04
31 changed files with 397 additions and 233 deletions
+3 -19
View File
@@ -7,30 +7,14 @@ from src.db.models.comic import Artist
class ArtistCreation(BaseModel):
id: str
name: str
class ArtistResponse(BaseModel):
id: UUID
id: str
name: str
class ArtistDetailResponse(BaseModel):
id: UUID
id: str
name: str
works: Dict[str, List[str]]
def get_artist_details(artist: Artist) -> ArtistDetailResponse:
works = {}
for work in artist.comic_works:
work_type = work.work_type.name
comic_title = work.comic.title
if work_type in works:
works[work_type].append(comic_title)
else:
works[work_type] = [comic_title]
response = ArtistDetailResponse(
id=artist.id,
name=artist.name,
works=works
)
return response
+2 -2
View File
@@ -7,12 +7,12 @@ from src.db.models.comic import Comic
class ComicResponse(BaseModel):
id: UUID
id: str
title: str
completed: bool
class ComicDetailsResponse(BaseModel):
id: UUID
id: str
created: str
title: str
completed : bool