Game finished: broadcast results, update DB #46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
When a game ends, announce results and persist them.
Files to change
apps/api/src/ws/handlers/gameHandlers.tspackages/db/src/models/lobbyModel.ts— update lobby status, write scores.Behavior
game:finishedwith players (userId, displayName, score, rank), winnerId.lobby_players.scorein PostgreSQL.lobbies.statusto 'finished'.Acceptance criteria
Notes
Use PostgreSQL transaction:
db.transaction(async (tx) => { ... }). Reference:packages/db/src/models/termModel.ts.