feat: Feature 1.5 — Bet Submission with 3 methods + performance tracking

Three submission methods:
- POST /api/bets/quickslip — structured bet entry
- POST /api/bets/screenshot — stub OCR with confirm flow
- POST /api/bets/sync — coming soon stub

Full bet lifecycle:
- PATCH /api/bets/:id/settle — settle with outcome, recalculates performance
- GET /api/bets — list with status/book/pagination filters
- GET /api/bets/performance — ROI, win rate, profit (weekly/monthly/all_time)

Payout calculator handles straight bets (American odds) and parlays
(multiplied leg payouts). Performance service recalculates on each
settlement and upserts into performance table.

33 new tests, 221 total (194 Node.js + 27 Python), all passing.
All backend features for Phase 1 + Phase 2 now complete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-03-22 05:11:42 -04:00
parent 2366660f5e
commit ed6502a880
12 changed files with 1310 additions and 37 deletions
+21
View File
@@ -0,0 +1,21 @@
const { extractFromScreenshot } = require('../../src/services/ocrStub');
describe('ocrStub', () => {
test('returns needs_confirmation: true', () => {
const result = extractFromScreenshot('draftkings');
expect(result.needs_confirmation).toBe(true);
expect(result.confidence).toBe(0);
expect(result.book).toBe('draftkings');
});
test('includes message for user', () => {
const result = extractFromScreenshot('fanduel');
expect(result.message).toContain('screenshot');
expect(result.book).toBe('fanduel');
});
test('defaults book to unknown', () => {
const result = extractFromScreenshot();
expect(result.book).toBe('unknown');
});
});