feat(lotto): review 라우터 — latest/history/by-draw

This commit is contained in:
2026-05-11 08:39:01 +09:00
parent 2a2209a86c
commit 4f85496fe5
2 changed files with 28 additions and 0 deletions

View File

@@ -39,11 +39,13 @@ from .strategy_evolver import (
) )
from .routers import curator as curator_router from .routers import curator as curator_router
from .routers import briefing as briefing_router from .routers import briefing as briefing_router
from .routers import review as review_router
from .jobs.grade_weekly_review import run_for_latest as grade_run_for_latest from .jobs.grade_weekly_review import run_for_latest as grade_run_for_latest
app = FastAPI() app = FastAPI()
app.include_router(curator_router.router) app.include_router(curator_router.router)
app.include_router(briefing_router.router) app.include_router(briefing_router.router)
app.include_router(review_router.router)
scheduler = BackgroundScheduler(timezone=os.getenv("TZ", "Asia/Seoul")) scheduler = BackgroundScheduler(timezone=os.getenv("TZ", "Asia/Seoul"))
ALL_URL = os.getenv("LOTTO_ALL_URL", "https://smok95.github.io/lotto/results/all.json") ALL_URL = os.getenv("LOTTO_ALL_URL", "https://smok95.github.io/lotto/results/all.json")

View File

@@ -0,0 +1,26 @@
"""주간 회고(weekly_review) 조회 엔드포인트."""
from fastapi import APIRouter, HTTPException
from .. import db
router = APIRouter(prefix="/api/lotto/review")
@router.get("/latest")
def latest():
r = db.get_latest_review()
if not r:
raise HTTPException(404, "no review yet")
return r
@router.get("/history")
def history(limit: int = 10):
return {"reviews": db.list_reviews(limit)}
@router.get("/{draw_no}")
def get_one(draw_no: int):
r = db.get_review(draw_no)
if not r:
raise HTTPException(404, f"no review for draw {draw_no}")
return r