acupedia-api/app/bootstrap/result.py

26 lines
582 B
Python

from __future__ import annotations
from dataclasses import asdict, dataclass, field
from typing import Any
@dataclass(slots=True)
class StepResult:
name: str
status: str
details: dict[str, Any] = field(default_factory=dict)
@dataclass(slots=True)
class BootstrapRunResult:
command: str
status: str
steps: list[StepResult] = field(default_factory=list)
def to_dict(self) -> dict[str, Any]:
return {
"command": self.command,
"status": self.status,
"steps": [asdict(item) for item in self.steps],
}