chore: initialize GSREA website project

This commit is contained in:
zlwu committed 2026-10-30 11:05:55 +08:00
commit d3c5461de5
1842 files changed
+246140

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
from fastapi import APIRouter, Depends, HTTPException, Query, status
from sqlalchemy.orm import Session
from app.core.deps import require_staff
from app.db import get_db
from app.models.uploaded_case import list_uploaded_cases, uploaded_case_detail
router = APIRouter(dependencies=[Depends(require_staff)])
@router.get("/uploaded-cases")
def read_uploaded_cases(
kind: str = Query("residential"),
current: int = Query(1),
size: int = Query(10),
q: str = Query(""),
db: Session = Depends(get_db),
) -> dict:
body = list_uploaded_cases(db, kind=kind, current=current, size=size, q=q)
if body is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="案例种类不正确")
return body
@router.get("/uploaded-cases/{case_id}")
def read_uploaded_case(case_id: int, db: Session = Depends(get_db)) -> dict:
body = uploaded_case_detail(db, case_id)
if body is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="上传案例不存在")
return body