Files
New-planet-ai-agent/models/task.py

46 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""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