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