feat(lotto): POST /api/lotto/purchase/bulk — 결정카드 원클릭 기록

This commit is contained in:
2026-05-11 08:42:27 +09:00
parent 4f85496fe5
commit b936233e7c
3 changed files with 115 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ from .db import (
get_recommendation_performance,
# Phase 2: 구매 이력
add_purchase, get_purchases, update_purchase, delete_purchase, get_purchase_stats,
bulk_insert_purchases_from_briefing,
# Phase 2: 주간 리포트 캐시
save_weekly_report, get_weekly_report_list, get_weekly_report,
# Phase 2: 개인 패턴 분석
@@ -343,6 +344,22 @@ def api_purchase_delete(purchase_id: int):
return {"ok": True}
class BulkPurchaseRequest(BaseModel):
draw_no: int
tier_mode: str # core | core_bonus | core_bonus_extended | full
sets: int # 검증용 — 실제 INSERT는 briefing 기준
amount: int # 검증용
@app.post("/api/lotto/purchase/bulk", status_code=201)
def api_purchase_bulk(body: BulkPurchaseRequest):
"""결정카드 원클릭 기록 — 큐레이터 브리핑 picks 를 tier_mode 기준으로 일괄 기록."""
result = bulk_insert_purchases_from_briefing(body.draw_no, body.tier_mode, body.amount)
if not result["ok"]:
raise HTTPException(status_code=400, detail=result["reason"])
return result
# ── 전략 진화 API ──────────────────────────────────────────────────────────
@app.get("/api/lotto/strategy/weights")