feat(reports): add quarterly and technique download routes [FASE-2.4]

Expose GET endpoints for quarterly-summary and technique reports with PDF, DOCX, and HTML formats.
This commit is contained in:
2026-05-18 14:00:46 +02:00
parent ed2c34ef28
commit 6ab950ec42
2 changed files with 77 additions and 0 deletions

View File

@@ -70,3 +70,38 @@ def generate_executive_report(
media_type=_MEDIA_TYPES[format],
filename=f"executive_summary.{format}",
)
@router.get("/quarterly-summary")
def generate_quarterly_report(
format: str = Query("pdf", pattern="^(pdf|docx|html)$"),
db: Session = Depends(get_db),
user: User = Depends(require_any_role("red_lead", "blue_lead", "viewer")),
):
"""Generate a quarterly security summary report."""
filepath = report_generation_service.generate_quarterly_summary(
db, output_format=format,
)
return FileResponse(
filepath,
media_type=_MEDIA_TYPES[format],
filename=f"quarterly_summary.{format}",
)
@router.get("/technique/{technique_id}")
def generate_technique_report(
technique_id: UUID,
format: str = Query("pdf", pattern="^(pdf|docx|html)$"),
db: Session = Depends(get_db),
user: User = Depends(get_current_user),
):
"""Generate a detailed report for one MITRE technique."""
filepath = report_generation_service.generate_technique_detail_report(
db, str(technique_id), output_format=format,
)
return FileResponse(
filepath,
media_type=_MEDIA_TYPES[format],
filename=f"technique_{technique_id}.{format}",
)