Added code samples for AI-Agents
This commit is contained in:
45
models/task.py
Normal file
45
models/task.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Pydantic модели для заданий."""
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TaskCreate(BaseModel):
|
||||
"""Модель для создания задания."""
|
||||
|
||||
title: str = Field(..., min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
duration_minutes: int = Field(..., ge=1, le=480)
|
||||
category: str = Field(..., description="Категория: утренняя_рутина, обучение, игра, отдых, вечерняя_рутина")
|
||||
image_url: Optional[str] = None
|
||||
order: int = Field(default=0, ge=0)
|
||||
|
||||
|
||||
class TaskUpdate(BaseModel):
|
||||
"""Модель для обновления задания."""
|
||||
|
||||
title: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
duration_minutes: Optional[int] = Field(None, ge=1, le=480)
|
||||
category: Optional[str] = None
|
||||
image_url: Optional[str] = None
|
||||
completed: Optional[bool] = None
|
||||
order: Optional[int] = Field(None, ge=0)
|
||||
|
||||
|
||||
class TaskResponse(BaseModel):
|
||||
"""Модель ответа с заданием."""
|
||||
|
||||
id: UUID
|
||||
title: str
|
||||
description: Optional[str]
|
||||
duration_minutes: int
|
||||
category: str
|
||||
image_url: Optional[str]
|
||||
completed: bool
|
||||
order: int
|
||||
schedule_id: UUID
|
||||
created_at: datetime
|
||||
|
||||
Reference in New Issue
Block a user