2022-10-14 17:52:31 +00:00
|
|
|
from pydantic import BaseModel
|
|
|
|
from typing import Optional, List
|
|
|
|
|
|
|
|
|
|
|
|
# TO support creation and update APIs
|
2022-10-14 18:16:52 +00:00
|
|
|
class AlbumBase(BaseModel):
|
2022-10-14 17:52:31 +00:00
|
|
|
title: str
|
|
|
|
artist: str
|
|
|
|
price: float
|
|
|
|
|
|
|
|
|
|
|
|
# TO support list and get APIs
|
2022-10-14 18:16:52 +00:00
|
|
|
class Album(AlbumBase):
|
2022-10-14 17:52:31 +00:00
|
|
|
id: int
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
orm_mode = True
|
|
|
|
|
|
|
|
|
|
|
|
# To support list cars API
|
2022-10-14 18:34:11 +00:00
|
|
|
class Albums(BaseModel):
|
2022-10-14 17:52:31 +00:00
|
|
|
data: List[Album]
|