inital commit
This commit is contained in:
25
server/app/api/v1/system.py
Normal file
25
server/app/api/v1/system.py
Normal 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"))
|
||||
Reference in New Issue
Block a user