feat: add Eventbrite admin data layer and show-up prediction API - #47
Open
DJCrossman wants to merge 1 commit into
Open
feat: add Eventbrite admin data layer and show-up prediction API#47DJCrossman wants to merge 1 commit into
DJCrossman wants to merge 1 commit into
Conversation
Introduces the server-side data layer for the admin dashboard behind /api/admin/* (guarded by requireAdmin on top of the proxy): - fetch/eventbrite.ts: shared Bearer-header GET client (refuses non-Eventbrite hosts, one retry on 429). fetch/events.ts and fetch/createEvent.ts migrate onto it, removing the token-in-URL query params that risked leaking the token into logs. - fetch/adminEvents.ts: upcoming events with expand=ticket_classes,venue for sold/capacity without the venue N+1 (drafts included). - fetch/attendees.ts: continuation-paginated attendee fetch; drafts 404 to an empty list. - fetch/attendanceHistory.ts: per-email registration/check-in stats from the 25 most recent past events, cached 6h via unstable_cache. Events with zero scans carry no signal and are skipped so unscanned events don't mark everyone a no-show (verified against real data: 20/25 recent events have scans, base rate 61%). - utils/showUpProbability.ts: smoothed personal rate (C + 3B)/(R + 3) clamped to [0.05, 0.95]; first-timers get the base rate and isNew. - lib/attendeeReport.ts: composes event + attendees + history into the report used by the API route and (next PR) the detail page; checked-in attendees count as 1.0 so expected turnout converges during an event. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 2/4 — stacked on #46 (Slack OAuth). Next: events list UI → event detail UI.
Summary
fetch/eventbrite.ts): Bearer-header GET with a host allowlist (the token can never be sent off-Eventbrite) and one 429 retry.fetch/events.ts/fetch/createEvent.tsmigrate onto it — this removes the existing?token=query-param auth (token-leak fix); public/api/eventsbehavior is unchanged.fetchAdminEvents()/fetchAdminEventById()useexpand=ticket_classes,venue→ sold/capacity per event, no venue N+1, drafts included.fetchAttendeesForEvent()follows continuation pagination (50/page); draft events 404 →[].fetch/attendanceHistory.ts): per-email{registrations, checkins}from the 25 most recent past events, deduped per (event, email), cancelled/refunded excluded, cached 6h (unstable_cache, tagattendance-history). Events with zero scans are skipped — organizers sometimes don't run check-in, and counting those days would mark everyone a no-show.utils/showUpProbability.ts): smoothed personal ratep = (C + 3B)/(R + 3)whereB= community base rate, clamped to [5%, 95%]; no-history attendees getB+isNew.lib/attendeeReport.tscomposes event + attendees + predictions + summary (expected turnout counts checked-in people as 1.0).GET /api/admin/eventsandGET /api/admin/events/[id]/attendees, bothrequireAdmin()-guarded (defense in depth behind the proxy), house-style error fallbacks, 404 passthrough.Verified against the live Eventbrite org
bun run lint/bun run buildpass;grep -rn 'token=' fetch/is empty/api/admin/events→ 401🤖 Generated with Claude Code