File size: 882 Bytes
2b8ea89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Admin Guide — read the single tracked standalone HTML file, rewritten for in-app serving."""
from __future__ import annotations

from fastapi import APIRouter

from sinetti_api.schemas import AdminGuideResponse
from sinetti_services import admin_guide_service

router = APIRouter(prefix="/api/admin/guide", tags=["admin_guide_admin"])


@router.get("", response_model=AdminGuideResponse)
def get_admin_guide() -> AdminGuideResponse:
    guide = admin_guide_service.read_guide()
    if not guide.html:
        return AdminGuideResponse(
            ok=False,
            html="",
            path=guide.path,
            updated_at=guide.updated_at,
            message="Admin guide is unavailable on this build.",
        )
    return AdminGuideResponse(
        ok=True, html=guide.html, path=guide.path, updated_at=guide.updated_at, message=""
    )