25 lines
888 B
Python

from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime
from uuid import UUID
class FlowerBase(BaseModel):
name: str = Field(..., description="Name of the flower")
species: str = Field(..., description="Species of the flower")
class FlowerCreate(FlowerBase):
description: Optional[str] = Field(None, description="Description of the flower")
class FlowerUpdate(FlowerBase):
name: Optional[str] = Field(None, description="Name of the flower")
species: Optional[str] = Field(None, description="Species of the flower")
description: Optional[str] = Field(None, description="Description of the flower")
class FlowerSchema(FlowerBase):
id: UUID
description: Optional[str] = Field(None, description="Description of the flower")
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True