[playersettings] fix delete setting

This commit is contained in:
Devin Zuczek
2026-09-08 23:27:04 -04:00
parent a2946fb9f4
commit 9696c56317
4 changed files with 213 additions and 2 deletions
+7
View File
@@ -10,11 +10,18 @@ Player-settings worker served on the `playersettings` subdomain.
`key=…&value=…` (or a JSON `{key,value}` / array) and **upserts** it into the
player's settings, keyed by the `sub` claim of the Bearer JWT. Returns `200`.
Persisted in Workers KV (`RECFLARE_PLAYER_SETTINGS`, key `player:<id>`).
- `DELETE /playersettings``[Authorize]`. Removes a setting from the player's
map. The client sends a bare form-urlencoded `key=PlayerShoppingBagId` (no
`value`); a JSON body and a `?key=` query param are also read. Deleting a key
that isn't stored is a no-op `200`, not a `404`.
> A full settings PUT would replace the player's _entire_ settings set on each
> call; we merge instead, so a single-key PUT (e.g. `key=PlayerSessionCount`)
> doesn't wipe the others.
> Emptying the map with DELETE puts the player back to a first read: the next
> `GET` re-seeds the defaults.
## KV namespace
```sh