from typing import Any from app.core.constants import ActorValue from app.core.database import SessionLocal from app.modules.feishu.constants import FeishuReceiveIdType from app.tasks.app import celery_app @celery_app.task(name="reports.push_daily_brief") def push_daily_brief( receive_id: str | None = None, receive_id_type: str = FeishuReceiveIdType.CHAT_ID, actor: str = ActorValue.SCHEDULER, push_run_code: str | None = None, ) -> dict[str, Any]: from app.modules.reports.services import ReportService db = SessionLocal() try: report = ReportService(db).daily_brief() return ReportService(db).push_report( report, receive_id, receive_id_type, actor, push_run_code=push_run_code, ) finally: db.close() @celery_app.task(name="reports.push_project_weekly") def push_project_weekly( receive_id: str | None = None, receive_id_type: str = FeishuReceiveIdType.CHAT_ID, actor: str = ActorValue.SCHEDULER, push_run_code: str | None = None, ) -> dict[str, Any]: from app.modules.reports.services import ReportService db = SessionLocal() try: report = ReportService(db).project_weekly() return ReportService(db).push_report( report, receive_id, receive_id_type, actor, push_run_code=push_run_code, ) finally: db.close()