From 1614753352c7b3fcc07fcdd545a719fafa5e32c1 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 02:24:27 +0000 Subject: [PATCH] Add Fruit schema --- schemas/fruit.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 schemas/fruit.py diff --git a/schemas/fruit.py b/schemas/fruit.py new file mode 100644 index 0000000..d063626 --- /dev/null +++ b/schemas/fruit.py @@ -0,0 +1,30 @@ +from pydantic import BaseModel, Field +from datetime import datetime +from uuid import UUID + +class FruitBase(BaseModel): + name: str = Field(..., min_length=1, max_length=100, description="Name of the fruit") + +class FruitCreate(FruitBase): + class Config: + schema_extra = { + "example": { + "name": "Apple" + } + } + +class Fruit(FruitBase): + id: UUID + created_at: datetime + updated_at: datetime + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "name": "Apple", + "created_at": "2023-01-01T00:00:00", + "updated_at": "2023-01-01T00:00:00" + } + } \ No newline at end of file