task-queue-system/app/schemas.py

38 lines
893 B
Python

from pydantic import BaseModel, Field, EmailStr
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]
class SendTestMailRequest(BaseModel):
mailbox_id: UUID
recipients: List[EmailStr]
subject: str = Field(max_length=998)
body_text: Optional[str] = None
body_html: Optional[str] = None
# Anhänge könnt ihr später ergänzen
class UploadMailResponse(BaseModel):
id: UUID
message_id: Optional[str] = None