Skip to content

Conversation

@devksingh4
Copy link
Member

@devksingh4 devksingh4 commented Nov 10, 2025

  • Require UIN or iCard swipe
  • Do not call UIN endpoint on client side, instead call it on the server side to enforce no NetID can be used.
  • Filter tickets for current event

Summary by CodeRabbit

Release Notes

  • New Features
    • Purchase lookup now supports UIN-based search as an alternative to email
    • Added product ID filtering for ticket and merchandise purchases
    • Merchandise items now include size information
    • Multi-select flow introduced for claiming multiple tickets

- Require UIN or iCard swipe
- Do not call UIN endpoint on client side, instead call it on the server side to enforce no NetID can be used.
- Filter tickets for current event
@devksingh4 devksingh4 merged commit 3fe0874 into main Nov 10, 2025
7 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Refactored user purchases lookup from email-based to UIN (Unique Identification Number) based with optional product filtering. Added getUserIdByUin function for UIN-to-ID mapping, updated API endpoint from GET to POST with body parameters, modified UI to accept UIN input, and added product filtering to ticketing and merch queries.

Changes

Cohort / File(s) Summary
Core Business Logic
src/api/functions/tickets.ts, src/api/functions/uin.ts
Added optional productId parameter for filtering purchases in ticketing and merch queries; created new getUserIdByUin function to resolve UINs to user IDs via DynamoDB; expanded merch purchaser data to include size field.
Type Definitions
src/common/types/generic.ts, src/common/types/user.ts
Added new illinoisUin Zod schema validator enforcing 9-digit numeric format with metadata; updated searchUserByUinRequest to use the new validator.
API Routes
src/api/routes/tickets.ts, src/api/routes/user.ts
Replaced GET /purchases/:email with POST /getPurchasesByUser accepting UIN and productId in request body; delegated UIN-to-ID lookup to getUserIdByUin helper; reduced required roles for /findUserByUin to VIEW_USER_INFO.
UI Components
src/ui/pages/tickets/ScanTickets.page.tsx
Refactored from email-based to UIN-based purchase lookup; updated API calls to POST /getPurchasesByUser with { uin, productId }; changed manual entry validation to 9-digit UIN; replaced auto-claim flow with multi-select modal for multiple claimable tickets; removed NetID/Email fallbacks.
Infrastructure
terraform/modules/frontend/main.tf
Added CloudFront ordered_cache_behavior for /api/v1/tickets/getPurchasesByUser path with HiCpu Lambda origin and existing cache policies.
Tests
tests/unit/functions/tickets.test.ts, tests/unit/tickets.test.ts
Updated merch test data to include size field; converted endpoint tests from GET with email to POST with UIN and productId in body; added productId filtering test cases and negative tests for invalid UIN format and database errors.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as ScanTickets Page
    participant API as POST /getPurchasesByUser
    participant UinFunc as getUserIdByUin
    participant DynamoDB
    participant TicketsFunc as getUserTicketingPurchases<br/>getUserMerchPurchases
    
    User->>UI: Scan UIN / Enter UIN
    UI->>API: POST body: { uin, productId }
    API->>UinFunc: Resolve UIN to user ID
    UinFunc->>DynamoDB: Query UinHashIndex with hashed UIN
    DynamoDB-->>UinFunc: Return user ID
    API->>TicketsFunc: Get purchases with productId filter
    TicketsFunc->>DynamoDB: Query with FilterExpression on event_id/item_id
    DynamoDB-->>TicketsFunc: Return filtered purchases
    TicketsFunc-->>API: Tickets & Merch data
    API-->>UI: { tickets, merch }
    UI->>UI: Display results or multi-select modal
    UI-->>User: Show claimable tickets
Loading
sequenceDiagram
    participant Old as Old Flow
    participant New as New Flow
    
    rect rgb(220, 240, 255)
    Old->>Old: GET /purchases/:email (URL param)
    Old->>Old: Direct DB lookup by email
    New->>New: POST /getPurchasesByUser (body)
    New->>New: UIN → User ID lookup
    New->>New: DB lookup with user ID + productId filter
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Areas requiring extra attention:

  • src/ui/pages/tickets/ScanTickets.page.tsx: Substantial logic refactor with new multi-select modal flow and manual UIN validation; verify state management and error handling paths align with new UIN-based architecture.
  • src/api/routes/tickets.ts: Confirm UIN-to-ID lookup error handling propagates correctly; validate productId filtering is consistently applied to both ticketing and merch queries.
  • Type consistency: Ensure illinoisUin validator constraints (9 digits, regex pattern) are uniformly applied across all UIN input surfaces (API body, UI validation, tests).
  • Test coverage: Verify new productId filtering tests adequately cover edge cases (empty results, mixed ticket/merch with productId mismatch).
  • Infrastructure alignment: Confirm CloudFront cache behavior TTL and compression settings match security and performance requirements for the new POST endpoint.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dsingh14/ticketing-uin

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between ca87a36 and 69567e9.

📒 Files selected for processing (10)
  • src/api/functions/tickets.ts (6 hunks)
  • src/api/functions/uin.ts (2 hunks)
  • src/api/routes/tickets.ts (3 hunks)
  • src/api/routes/user.ts (3 hunks)
  • src/common/types/generic.ts (1 hunks)
  • src/common/types/user.ts (1 hunks)
  • src/ui/pages/tickets/ScanTickets.page.tsx (6 hunks)
  • terraform/modules/frontend/main.tf (1 hunks)
  • tests/unit/functions/tickets.test.ts (3 hunks)
  • tests/unit/tickets.test.ts (12 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@devksingh4 devksingh4 deleted the dsingh14/ticketing-uin branch November 10, 2025 08:30
@github-actions
Copy link
Contributor

💰 Infracost report

Monthly estimate generated

This comment will be updated when code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants