feat(lotto): review 라우터 — latest/history/by-draw
This commit is contained in:
26
lotto/app/routers/review.py
Normal file
26
lotto/app/routers/review.py
Normal 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
|
||||
Reference in New Issue
Block a user