23 lines
369 B
Python
23 lines
369 B
Python
from pydantic import BaseModel
|
|
from typing import Optional, List
|
|
|
|
|
|
# TO support creation and update APIs
|
|
class AlbumBase(BaseModel):
|
|
title: str
|
|
artist: str
|
|
price: float
|
|
|
|
|
|
# TO support list and get APIs
|
|
class Album(AlbumBase):
|
|
id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# To support list cars API
|
|
class Albums(BaseModel):
|
|
data: List[Album]
|