mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
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
This commit is contained in:
parent
8fb65d7188
commit
c0232fdcfe
13 changed files with 18 additions and 176 deletions
|
|
@ -1,42 +1,15 @@
|
|||
"""HTTP routes for automation runs (dispatch + history)."""
|
||||
"""HTTP routes for automation run history."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Query, status
|
||||
|
||||
from app.automations.schemas.api import (
|
||||
RunDetail,
|
||||
RunDispatched,
|
||||
RunList,
|
||||
RunSummary,
|
||||
)
|
||||
from app.automations.schemas.api import RunDetail, RunList, RunSummary
|
||||
from app.automations.services import RunService, get_run_service
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post(
|
||||
"/automations/{automation_id}/run",
|
||||
response_model=RunDispatched,
|
||||
status_code=status.HTTP_202_ACCEPTED,
|
||||
)
|
||||
async def run_automation_now(
|
||||
automation_id: int,
|
||||
inputs: dict[str, Any] | None = Body(default=None),
|
||||
service: RunService = Depends(get_run_service),
|
||||
) -> RunDispatched:
|
||||
"""Fire a manual run.
|
||||
|
||||
``inputs`` is the runtime payload supplied by the caller; it is merged with
|
||||
the manual trigger's ``static_inputs`` (static wins) and validated against
|
||||
the automation's input schema.
|
||||
"""
|
||||
run = await service.dispatch_manual(automation_id=automation_id, runtime_inputs=inputs)
|
||||
return RunDispatched(run_id=run.id, status=run.status)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/automations/{automation_id}/runs",
|
||||
response_model=RunList,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue