16 lines
489 B
Python
16 lines
489 B
Python
from fastapi import APIRouter, Depends, HTTPException, status
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.db import get_db
|
|
from app.models.legal import public_legal_page
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/legal/{page_key}")
|
|
def read_public_legal_page(page_key: str, db: Session = Depends(get_db)) -> dict:
|
|
body = public_legal_page(db, page_key)
|
|
if body is None:
|
|
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="合规页键不正确")
|
|
return body
|