fix: normalise event payload keys, implement updatePlayer, add pagination#240
Merged
Merged
Conversation
…tion - Normalise camelCase event payload keys to snake_case on ingest via normalizePayload() in the indexer so all DB reads use a single canonical naming style (fixes subscription_expiry, player_id, unlocked_at, tx_hash, evidence_uri field lookups across scout, validator, and player controllers) - Implement PUT /api/players/:playerId — pins metadata object to IPFS or accepts a metadataUri directly, then calls updateProfile() returning transactionId + metadataUri (previously returned a stub 202) - Add limit/offset pagination options to getEvents() and getEventsCount() helper to support paginated event queries - Remove src/services/store.ts (legacy in-memory store, fully superseded by the SQLite-backed db layer) Closes scout-off#202 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
normalizePayload()added to the indexer converts all camelCase event keys to snake_case on ingest, sosubscriptionExpiry,playerId,evidenceUri,unlockedAt,txHash, andmetadataUriare all stored and read consistently as snake_case across the scout, validator, and player controllersPUT /api/players/:playerIdimplemented — accepts either ametadataobject (pinned to IPFS) or ametadataUridirectly, callsupdateProfile()on the Soroban contract stub, and returns{ transactionId, metadataUri }with HTTP 200 (previously returned a stub 202 with no data)getEvents()— addedlimit/offsetoptions and agetEventsCount()helper for paginated event queriessrc/services/store.tsremoved — legacy in-memory store fully superseded by the SQLite-backed db layerCloses #202
Test plan
npm test— all 350 tests passPUT /api/players/:playerIdwith{ metadataUri: "Qm..." }returns 200 withtransactionIdandmetadataUriPUT /api/players/:playerIdwith{ metadata: { position: "GK" } }pins to IPFS and returns 200PUT /api/players/:playerIdwith neither field returns 400active/remainingDaysusingsubscription_expirykeyplayerIdandunlockedAtusingplayer_id/unlocked_atkeysplayer_idkey