E4-F4: Cart Management with TTL¶
Epic: E4: Ticket Purchase Flow
Size: S (Small)
Problem / Outcome¶
Manage seat reservations with timeout.
Scope¶
In-Scope:
- Cart model in Redis with TTL
- Cart contents API
- TTL countdown display
- Cart expiration handling
Out-of-Scope:
- Cart persistence beyond TTL
Acceptance Criteria¶
- AC1: Cart created with 20-minute TTL from queue entry (or add-to-cart if no queue)
- AC2: Expired cart releases seats back to Available
- AC3: API returns remaining TTL for countdown display
Data Model Impact¶
CartReservation (Redis):
- key: cart:{user_id}:{match_id}
- user_id (VARCHAR)
- match_id (VARCHAR)
- seats[] (Array of seat IDs)
- total_amount (DECIMAL)
- expires_at (TIMESTAMP)
- TTL: 1200 seconds (20 minutes)
Cart expiration triggers:
- Seat.status = AVAILABLE
- CartReservation deleted
Permissions/Roles¶
- Authenticated user
How to Verify¶
npm test -- --grep "cart TTL"
Expected: TTL enforced, seats released on expiration.
Dependencies¶
Implementation Tasks¶
Doc References¶
Last Updated: January 2026