feat: track crawl run employee changes and verify dismissals
This commit is contained in:
16
app/api.py
16
app/api.py
@@ -8,7 +8,7 @@ from app.config import Settings, get_settings
|
||||
from app.db import SessionLocal, get_db
|
||||
from app.models import CrawlRun, Employee
|
||||
from app.security import require_admin
|
||||
from app.services.admin_data import employee_display_payload, list_employees_page, run_payload, stats_payload
|
||||
from app.services.admin_data import employee_display_payload, list_employees_page, run_detail_payload, run_payload, stats_payload
|
||||
from app.services.crawl_control import get_running_run, run_crawl_if_idle
|
||||
from app.version import BACKEND_VERSION, FRONTEND_VERSION
|
||||
|
||||
@@ -88,6 +88,20 @@ def latest_crawl_run(
|
||||
return {"running": run_payload(running), "latest": run_payload(latest)}
|
||||
|
||||
|
||||
@router.get("/crawl-runs/{run_id}")
|
||||
def get_crawl_run(
|
||||
run_id: int,
|
||||
request: Request,
|
||||
db: Session = Depends(get_db),
|
||||
settings: Settings = Depends(get_settings),
|
||||
) -> dict:
|
||||
require_admin(request, settings)
|
||||
run = db.get(CrawlRun, run_id)
|
||||
if not run:
|
||||
return {"error": "not_found"}
|
||||
return run_detail_payload(db, run) or {"error": "not_found"}
|
||||
|
||||
|
||||
@router.post("/crawl-runs")
|
||||
def trigger_crawl(
|
||||
request: Request,
|
||||
|
||||
Reference in New Issue
Block a user