2025-03-26 12:47:43 +00:00

46 lines
1.7 KiB
Python

from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime
from uuid import UUID
class DogBase(BaseModel):
breed_name: str = Field(..., min_length=1, max_length=100, description="Name of the dog breed")
origin: str = Field(..., description="Origin/country of the breed")
size: str = Field(..., description="Size category of the breed")
temperament: str = Field(..., description="Temperament characteristics")
life_span: str = Field(..., description="Average life span of the breed")
description: str = Field(..., description="Detailed description of the breed")
class DogCreate(DogBase):
class Config:
schema_extra = {
"example": {
"breed_name": "Labrador Retriever",
"origin": "Canada",
"size": "Large",
"temperament": "Friendly, Active, Outgoing",
"life_span": "10-12 years",
"description": "The Labrador Retriever is one of the most popular dog breeds in the world."
}
}
class Dog(DogBase):
id: UUID
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
schema_extra = {
"example": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"breed_name": "Labrador Retriever",
"origin": "Canada",
"size": "Large",
"temperament": "Friendly, Active, Outgoing",
"life_span": "10-12 years",
"description": "The Labrador Retriever is one of the most popular dog breeds in the world.",
"created_at": "2023-01-01T00:00:00",
"updated_at": "2023-01-01T00:00:00"
}
}