霖雨寺
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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",
|
||||
)
|
||||
Reference in New Issue
Block a user