mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-31 19:45:15 +02:00
feat(automations): static_inputs on triggers + vertical-slice api/services
This commit is contained in:
parent
84d99f19a2
commit
27ab367a13
27 changed files with 915 additions and 356 deletions
49
surfsense_backend/app/automations/schemas/api/run.py
Normal file
49
surfsense_backend/app/automations/schemas/api/run.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"""Response schemas for run sub-resources and run dispatch."""
|
||||
|
||||
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
|
||||
|
||||
|
||||
class RunDispatched(BaseModel):
|
||||
"""Response of a successful run dispatch."""
|
||||
|
||||
run_id: int
|
||||
status: RunStatus
|
||||
Loading…
Add table
Add a link
Reference in a new issue