30 lines
765 B
Python
30 lines
765 B
Python
|
|
"""
|
||
|
|
Pydantic schemas for Task CRUD operations.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from datetime import datetime
|
||
|
|
from typing import Optional
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class TaskCreate(BaseModel):
|
||
|
|
"""Request body for creating a new signin task."""
|
||
|
|
cron_expression: str = Field(..., min_length=1, max_length=50, description="Cron expression for scheduling")
|
||
|
|
|
||
|
|
|
||
|
|
class TaskUpdate(BaseModel):
|
||
|
|
"""Request body for updating an existing task."""
|
||
|
|
is_enabled: Optional[bool] = Field(None, description="Enable or disable the task")
|
||
|
|
|
||
|
|
|
||
|
|
class TaskResponse(BaseModel):
|
||
|
|
"""Public representation of a signin task."""
|
||
|
|
id: str
|
||
|
|
account_id: str
|
||
|
|
cron_expression: str
|
||
|
|
is_enabled: bool
|
||
|
|
created_at: Optional[datetime]
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
from_attributes = True
|