Files
officeconvert/python/packages/server/src/officeconvert_server/models.py
T
2026-03-26 14:01:10 -07:00

31 lines
883 B
Python

"""In-memory models representing conversion workflow state."""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
def utc_now() -> datetime:
"""Return the current UTC timestamp with timezone information."""
return datetime.now(tz=timezone.utc)
@dataclass(slots=True)
class ConversionSession:
"""Stores mutable state for a single conversion lifecycle."""
conversion_id: str
source_filename: str
bucket_name: str
upload_object_key: str
status: int
created_at: datetime = field(default_factory=utc_now)
updated_at: datetime = field(default_factory=utc_now)
error_message: str = ""
slide_deck: Any | None = None
work_dir: Path | None = None
conversion_task: Any | None = None
cleanup_task: Any | None = None