-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bet payout hook #7
base: main
Are you sure you want to change the base?
Conversation
also refactor code to remove unused bits
).at(0); | ||
|
||
if (betPool) { | ||
await pb.collection('betPool').update(betPool.id, { amount: betPool.amount + amount }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the amount
is a string here the bets amount gets added as a string (amount is any
rn not a number
)
so consecutive bets of 10 lead betPool.amount + amount
to become 1010
also same issue in line 38 for bet.amount + amount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've added validation middleware using zod
.
with how this is setup, everytime so maybe an |
also maybe a check to make sure the bets cannot be distributed before |
No description provided.