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