Tanya 0b95cd2492 feat: Add job cancellation support and update job status handling
This commit introduces a new `CANCELLED` status to the job management system, allowing users to cancel ongoing jobs. The frontend is updated to handle job cancellation requests, providing user feedback during the cancellation process. Additionally, the backend is enhanced to manage job statuses more effectively, ensuring that jobs can be marked as cancelled and that appropriate messages are displayed to users. This improvement enhances the overall user experience by providing better control over job processing.
2026-01-05 13:09:32 -05:00

32 lines
541 B
Python

"""Job schemas."""
from __future__ import annotations
from datetime import datetime
from enum import Enum
from pydantic import BaseModel
class JobStatus(str, Enum):
"""Job status enum."""
PENDING = "pending"
STARTED = "started"
PROGRESS = "progress"
SUCCESS = "success"
FAILURE = "failure"
CANCELLED = "cancelled"
class JobResponse(BaseModel):
"""Job response schema."""
id: str
status: JobStatus
progress: int = 0
message: str = ""
created_at: datetime
updated_at: datetime