Files
admin/app/temple_scope.py
2026-07-27 09:57:35 +08:00

21 lines
513 B
Python

from typing import Annotated
from fastapi import Header, HTTPException, status
from app.database import Database
TempleId = Annotated[int, Header(alias="X-Temple-Id")]
def ensure_temple_exists(db: Database, temple_id: int) -> None:
row = db.execute(
"SELECT id FROM temples WHERE id = ? AND is_active = 1",
(temple_id,),
).fetchone()
if row is None:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Temple not found",
)