feat(agent-office): /api/agent-office/notify/lotto-prize 웹훅
This commit is contained in:
@@ -10,8 +10,10 @@ from .websocket_manager import ws_manager
|
|||||||
from .agents import init_agents, get_agent, get_all_agent_states, AGENT_REGISTRY
|
from .agents import init_agents, get_agent, get_all_agent_states, AGENT_REGISTRY
|
||||||
from .scheduler import init_scheduler
|
from .scheduler import init_scheduler
|
||||||
from . import telegram_bot
|
from . import telegram_bot
|
||||||
|
from .routers import notify as notify_router
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
app.include_router(notify_router.router)
|
||||||
|
|
||||||
_cors_origins = CORS_ALLOW_ORIGINS.split(",")
|
_cors_origins = CORS_ALLOW_ORIGINS.split(",")
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
|
|||||||
0
agent-office/app/routers/__init__.py
Normal file
0
agent-office/app/routers/__init__.py
Normal file
20
agent-office/app/routers/notify.py
Normal file
20
agent-office/app/routers/notify.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
"""다른 서비스가 트리거하는 웹훅 — 현재 lotto-backend → 텔레그램 푸시."""
|
||||||
|
from typing import List
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from ..notifiers.telegram_lotto import send_prize_alert
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/agent-office/notify")
|
||||||
|
|
||||||
|
|
||||||
|
class LottoPrizeEvent(BaseModel):
|
||||||
|
draw_no: int
|
||||||
|
match_count: int
|
||||||
|
numbers: List[int]
|
||||||
|
purchase_id: int
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/lotto-prize")
|
||||||
|
async def lotto_prize(body: LottoPrizeEvent):
|
||||||
|
await send_prize_alert(body.model_dump())
|
||||||
|
return {"ok": True}
|
||||||
Reference in New Issue
Block a user