fix(players, economy): grants are atomic and tell the player; create and edit players work
Grant and revoke (player page and economy module) used to read the balance,
add in PHP, write it back and insert the ledger row separately, racing any
game payout in between. They now call admin_adjust_currency() (one statement,
coins or gems, never below zero, booked as admin_grant / debit; see El3ab
migrations/2026-10-26-manager-columns.sql) and put a notice in the player's
bell (title_ar/body_ar, as the game's notifications.php reads them).
award_coins() was not used: coins only, no floor, and it books staff grants
as game income.
Edit no longer sends profiles.email (no such column; PGRST204 rejected the
whole update); the login email is shown read-only from the auth account.
Create now makes a real login account through GoTrue's admin API, whose
trigger creates the profile; the old insert had no id and always failed.
The match history query used a players column matches does not have, and
the transactions tab read a variable that was never set.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>
Showing
core/EconomyService.php
0 → 100644
Please register or sign in to comment