| from fastapi import APIRouter, HTTPException
|
| from backend_app.state.store import store
|
| from backend_app.core.strategic_controller import get_strategic_audit, analyze_jira_from_db
|
| from pydantic import BaseModel
|
|
|
| class StrategicAuditResponse(BaseModel):
|
| briefing: str
|
|
|
| router = APIRouter(prefix="/strategic", tags=["strategic"])
|
|
|
| @router.post("/audit", response_model=StrategicAuditResponse)
|
| def compute_strategic_audit():
|
|
|
| if not store.loaded:
|
| raise HTTPException(status_code=400, detail="GitHub data not loaded. Call /load_data first.")
|
|
|
|
|
|
|
|
|
| briefing_text = get_strategic_audit()
|
| return StrategicAuditResponse(briefing=briefing_text)
|
|
|
| @router.post("/jira-audit", response_model=StrategicAuditResponse)
|
| def compute_jira_audit():
|
| """
|
| Compares the latest Jira data from DB with active GitHub data.
|
| """
|
| if not store.loaded:
|
| raise HTTPException(status_code=400, detail="GitHub data not loaded. Call /load_data first.")
|
|
|
| analysis = analyze_jira_from_db()
|
| return StrategicAuditResponse(briefing=analysis)
|
|
|