How to do an auction system
I'm building a kind of store that an item can have a countdown and when it get to zero, it would be sold to the current highest bidder. I'm not sure how to make the item be sold to the highest bidder after it gets to zero.
I'm using supabase and clerk for auth and supabase for the db.
When the item timer gets to zero, I want to call the supabase db to transfer ownership of the item, deduct money from buyer etc.
But If I set it up normally with the supabase function, this would mean any authenticated users can call the supabase endpoint manually and I don't want that. I want the function to only be possible to be called when an item's countdown to zero and cannot be called manually from outside the site.
Also , if there's multiple users active when the item gets to zero, this would mean the function would be called for every user who is online (which I do not want). I would Ideally want it to be called only once
0 Replies