Skip to content

feat: add TicketOrder model and ticket-orders API for user/organizer transparency#52

Draft
Jayrodri088 wants to merge 2 commits intoBuidlZone-Labs:mainfrom
Jayrodri088:feat-ticket-order-model
Draft

feat: add TicketOrder model and ticket-orders API for user/organizer transparency#52
Jayrodri088 wants to merge 2 commits intoBuidlZone-Labs:mainfrom
Jayrodri088:feat-ticket-order-model

Conversation

@Jayrodri088
Copy link
Contributor

@Jayrodri088 Jayrodri088 commented Feb 28, 2026

Summary

Adds a Ticket Order model and read-only API so organizers and users can see ticket orders and payments, giving transparency between both sides.

Changes

Model: TicketOrder (src/models/ticket-order.ts)

  • id – MongoDB _id (returned as id in API)
  • ticketType – string (e.g. "free", "paid", "vip")
  • eventName – string (denormalized from event for display)
  • status – number: 0 = pending, 1 = completed, 3 = failed
  • quantity – number
  • amount – number (decimal)
  • zkIdMatch – boolean
  • privacyLevel – string (e.g. "anonymous", "wallet-required", "verified-access")
  • hasReceipt – boolean
  • datePurchased – Date
  • user – ref to User (buyer)
  • eventTicket – ref to EventTicket
  • transactionId – optional (for payment gateway)

API (protected, requires auth)

  • GET /ticket-orders/me?page=1&limit=20 – Current user’s ticket orders (buyer view). Paginated; returns { page, limit, total, orders }.
  • GET /ticket-orders/organizer?page=1&limit=20 – Ticket orders for events the current user organizes. Same response shape.

Role-based access

  • Users see only their own purchases (/me).
  • Organizers see only orders for events they organize (/organizer).

Other

  • Auth: Fixed validateAndGetUser to use User.findById(decoded.id) so JWT auth works for protected routes.
  • Service: TicketOrderService.createOrder() is implemented for use when a payment/checkout flow exists (creates order and fills eventName / privacyLevel from the event).

#47

@DioChuks DioChuks self-requested a review March 6, 2026 21:12
Copy link
Contributor

@DioChuks DioChuks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attend to these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't requested for, remove this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasnt part of issue description.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did not request for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed too.

@DioChuks
Copy link
Contributor

DioChuks commented Mar 8, 2026

@Jayrodri088 no changes so far, will be unassigning & closing PR

@DioChuks DioChuks marked this pull request as draft March 8, 2026 23:14
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