Numbered tickets sale system
I'm working on a numbered ticket sales system where buyers are randomly assigned tickets after making a payment. Here's a breakdown of my current approach and the challenges I'm facing:
Current Approach:
Payment Validation:
-An httpAction receives payment webhooks from the payment company.
An Action validates the payment on your server.
Initial Data Creation:
-The database table is pre-populated with random numbers (0000-9999) and empty paymentID fields.
Ticket Assignment:
An internalMutation is triggered after successful payment validation.It receives buyer data and the payment ID.
This mutation iterates through the desired number of tickets:
It queries the database for an entry with an empty paymentID. If no entry is found, it returns an error indicating unavailability. Otherwise, it updates the found entry with the buyer's information and sets paymentID.
InternalMutation code:
the first problem I am facing is with more than 100 tickets I receive this error in the console:
Uncaught Error: Uncaught Error: Too many documents read in a single function execution (limit: 16384)
This is just an idea and I am learning so any help will be appreciated

