Skip to content

fix: normalise event payload keys, implement updatePlayer, add pagination#240

Merged
Petah1 merged 1 commit into
scout-off:mainfrom
knytcomics-ui:fix/issues-202-205-207-209
Jun 20, 2026
Merged

fix: normalise event payload keys, implement updatePlayer, add pagination#240
Petah1 merged 1 commit into
scout-off:mainfrom
knytcomics-ui:fix/issues-202-205-207-209

Conversation

@knytcomics-ui

@knytcomics-ui knytcomics-ui commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Payload key normalisationnormalizePayload() added to the indexer converts all camelCase event keys to snake_case on ingest, so subscriptionExpiry, playerId, evidenceUri, unlockedAt, txHash, and metadataUri are all stored and read consistently as snake_case across the scout, validator, and player controllers
  • PUT /api/players/:playerId implemented — accepts either a metadata object (pinned to IPFS) or a metadataUri directly, calls updateProfile() on the Soroban contract stub, and returns { transactionId, metadataUri } with HTTP 200 (previously returned a stub 202 with no data)
  • Pagination for getEvents() — added limit/offset options and a getEventsCount() helper for paginated event queries
  • src/services/store.ts removed — legacy in-memory store fully superseded by the SQLite-backed db layer

Closes #202

Test plan

  • npm test — all 350 tests pass
  • PUT /api/players/:playerId with { metadataUri: "Qm..." } returns 200 with transactionId and metadataUri
  • PUT /api/players/:playerId with { metadata: { position: "GK" } } pins to IPFS and returns 200
  • PUT /api/players/:playerId with neither field returns 400
  • Scout subscription endpoint returns correct active/remainingDays using subscription_expiry key
  • Scout contacts endpoint returns correct playerId and unlockedAt using player_id / unlocked_at keys
  • Validator pending milestones endpoint filters correctly using player_id key

…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>
@Petah1 Petah1 merged commit 93d5bf6 into scout-off:main Jun 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire updatePlayer() to Soroban contract call

2 participants