inital commit

This commit is contained in:
2026-06-08 15:57:11 +02:00
parent aaf8729663
commit d9ca48addc
114 changed files with 12172 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
from fastapi import APIRouter, Depends
from app.auth.dependencies import ApiPrincipal, require_scope
router = APIRouter(prefix="/schemas", tags=["schemas"])
@router.get("/campaign")
def get_campaign_schema(
principal: ApiPrincipal = Depends(require_scope("campaign:read")),
) -> dict[str, Any]:
"""Return the authoritative campaign JSON Schema used by the backend.
The WebUI can fetch this instead of carrying a stale copy. A future UI
schema can be served alongside this endpoint.
"""
schema_path = Path(__file__).resolve().parents[2] / "mailer" / "schemas" / "campaign.schema.json"
return json.loads(schema_path.read_text(encoding="utf-8"))