task-queue-system/app/schemas.py

25 lines
No EOL
561 B
Python

from pydantic import BaseModel, Field
from typing import Optional, List
from uuid import UUID
class CreateJobRequest(BaseModel):
job_type: str = Field(examples=["MailCheck"])
domain: str = Field(examples=["example.com"])
payload: dict = Field(default_factory=dict)
class TaskInfo(BaseModel):
id: UUID
name: str
status: str
retries: int
max_retries: int
result: Optional[dict] = None
error: Optional[str] = None
class JobInfo(BaseModel):
id: UUID
job_type: str
status: str
domain: str
payload: dict | None
tasks: List[TaskInfo]