update: docs

This commit is contained in:
2026-03-13 14:48:32 +08:00
parent e0a40ceff0
commit b7e973e2b6
31 changed files with 2183 additions and 196 deletions

View File

@@ -8,6 +8,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.core.config import settings
from app.core.database import get_db
from app.models.report import ExportReport
from app.models.report import ReportType
from app.repositories.case_repo import CaseRepository
from app.schemas.report import ReportCreate, ReportOut, ReportListOut
@@ -20,6 +21,8 @@ async def generate_report(case_id: UUID, body: ReportCreate, db: AsyncSession =
case = await repo.get(case_id)
if not case:
raise HTTPException(404, "案件不存在")
if body.report_type == ReportType.word:
raise HTTPException(400, "当前仅支持 PDF 和 Excel 报告导出")
from app.services.report_service import generate_report as gen
report = await gen(case_id, body, db)
@@ -30,7 +33,7 @@ async def generate_report(case_id: UUID, body: ReportCreate, db: AsyncSession =
async def list_reports(case_id: UUID, db: AsyncSession = Depends(get_db)):
result = await db.execute(
select(ExportReport)
.where(ExportReport.case_id == case_id)
.where(ExportReport.case_id == case_id, ExportReport.report_type != ReportType.word)
.order_by(ExportReport.created_at.desc())
)
items = list(result.scalars().all())