Phase 24: daily check-in system + club milestones endpoint
CI / Build, lint & test (push) Failing after 28s

- migrations/0012_daily_checkin.sql: daily_checkins table tracking streak,
  coins awarded, pack granted, timestamp per profile
- services/checkin.rs: get_status() (available, streak_day, next reward),
  claim() (idempotent same-day guard, streak logic: continue if yesterday
  or today, else reset; 7-day cycle with STREAK_COINS array, day-7 pack)
- routes/club.rs: GET /club/checkin, POST /club/checkin, GET /club/milestones
  (computed from statistics, season_history, owned_cards, sbc_submissions,
  daily_checkins tables; no new DB tables needed)
- 4 new integration tests: checkin available initially, claim awards coins,
  idempotent same-day, milestones endpoint structure (93 → 93+4=97 tests)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-25 19:05:52 -07:00
parent 28d7490555
commit 956bfe7a73
6 changed files with 297 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
CREATE TABLE IF NOT EXISTS daily_checkins (
id TEXT PRIMARY KEY,
profile_id TEXT NOT NULL,
club_id TEXT NOT NULL,
streak_day INTEGER NOT NULL DEFAULT 1,
coins_awarded INTEGER NOT NULL DEFAULT 0,
pack_granted TEXT, -- nullable pack definition id
checked_in_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_daily_checkins_profile ON daily_checkins (profile_id, checked_in_at DESC);