Description
Ticket buyers want to know what events are "hot right now". Scan velocity (scans per hour in the last 24 hours) is a strong proxy for demand and a useful discovery surface.
Requirements & context
GET /events/trending?limit=10 (public, no auth)
- Queries
ticket_scans grouped by event_id, counting scans in the last 24 hours, ordered descending
- Returns:
{ "events": [ { "event_id", "scan_count_24h", "rank" } ], "generated_at" }
- Join with
event_sales_summary to include event_name in the response
- Cache for 10 minutes — trending data does not need to be real-time
- Write tests with seeded scan data
Suggested execution
git checkout -b feat/trending-events-endpoint
- Add
get_trending_events(limit, hours) to AnalyticsService
- Add route to
src/main.py
- Write tests
Guidelines
- PR must include:
Closes #[issue_id]
- Timeframe: 48 hours
Description
Ticket buyers want to know what events are "hot right now". Scan velocity (scans per hour in the last 24 hours) is a strong proxy for demand and a useful discovery surface.
Requirements & context
GET /events/trending?limit=10(public, no auth)ticket_scansgrouped byevent_id, counting scans in the last 24 hours, ordered descending{ "events": [ { "event_id", "scan_count_24h", "rank" } ], "generated_at" }event_sales_summaryto includeevent_namein the responseSuggested execution
get_trending_events(limit, hours)toAnalyticsServicesrc/main.pyGuidelines
Closes #[issue_id]