23 lines
652 B
Python
23 lines
652 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
class FruitBase(BaseModel):
|
|
name: str = Field(..., description="The name of the fruit")
|
|
color: str = Field(..., description="The color of the fruit")
|
|
|
|
class FruitCreate(FruitBase):
|
|
pass
|
|
|
|
class FruitUpdate(FruitBase):
|
|
name: Optional[str] = Field(None, description="The updated name of the fruit")
|
|
color: Optional[str] = Field(None, description="The updated color of the fruit")
|
|
|
|
class FruitSchema(FruitBase):
|
|
id: UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |