SurfSense/surfsense_backend/app/automations/schemas/api/run.py
CREDO23 c0232fdcfe refactor(automations): park manual trigger pending Run-now redesign
Manual-as-a-standalone-trigger conflates "user clicks Run now" with the
trigger model and forces ad-hoc input plumbing on the caller. Remove the
unreachable surface so the tree reflects reality (schedule is the only
v1 trigger).

- Unregister `manual`: drop import from triggers/__init__.py
- Delete `app/automations/triggers/manual/`
- Drop `RunService.dispatch_manual` (RunService is now read-only)
- Drop `POST /automations/{id}/run` and `RunDispatched` schema
- Keep `TriggerType.MANUAL` Python + PG enum value (reserved, documented)
  to avoid an Alembic round-trip when Run-now is redesigned
2026-05-27 22:29:51 +02:00

42 lines
1,007 B
Python

"""Response schemas for run sub-resources."""
from __future__ import annotations
from datetime import datetime
from typing import Any
from pydantic import BaseModel, ConfigDict
from app.automations.persistence.enums.run_status import RunStatus
class RunSummary(BaseModel):
"""Lightweight run view for list endpoints."""
model_config = ConfigDict(from_attributes=True)
id: int
automation_id: int
trigger_id: int | None = None
status: RunStatus
started_at: datetime | None = None
finished_at: datetime | None = None
created_at: datetime
class RunDetail(RunSummary):
"""Full run view including snapshot, results and artifacts."""
definition_snapshot: dict[str, Any]
inputs: dict[str, Any]
step_results: list[dict[str, Any]]
output: dict[str, Any] | None = None
artifacts: list[dict[str, Any]]
error: dict[str, Any] | None = None
class RunList(BaseModel):
"""Paginated list of runs."""
items: list[RunSummary]
total: int