23 lines
654 B
Python
23 lines
654 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
class CountryBase(BaseModel):
|
|
name: str = Field(..., description="Name of the country")
|
|
iso_code: str = Field(..., description="ISO code of the country")
|
|
|
|
class CountryCreate(CountryBase):
|
|
pass
|
|
|
|
class CountryUpdate(CountryBase):
|
|
name: Optional[str] = Field(None, description="Name of the country")
|
|
iso_code: Optional[str] = Field(None, description="ISO code of the country")
|
|
|
|
class CountrySchema(CountryBase):
|
|
id: UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |