from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from app.core.database import get_db from app.core.security import require_api_key from app.modules.reports.schemas import PushReportRequest, ReportResponse from app.modules.reports.service import ReportService router = APIRouter(dependencies=[Depends(require_api_key)]) @router.get("/daily-brief", response_model=ReportResponse) def daily_brief(db: Session = Depends(get_db)) -> dict: return ReportService(db).daily_brief() @router.get("/project-weekly", response_model=ReportResponse) def project_weekly(db: Session = Depends(get_db)) -> dict: return ReportService(db).project_weekly() @router.post("/daily-brief/push") def push_daily_brief(payload: PushReportRequest, db: Session = Depends(get_db)) -> dict: report = ReportService(db).daily_brief() return ReportService(db).push_report( report, payload.receive_id, payload.receive_id_type, payload.actor, ) @router.post("/project-weekly/push") def push_project_weekly(payload: PushReportRequest, db: Session = Depends(get_db)) -> dict: report = ReportService(db).project_weekly() return ReportService(db).push_report( report, payload.receive_id, payload.receive_id_type, payload.actor, )