Conversation
Three marketplace read endpoints over the existing Trade and CreatorPriceSnapshot read models (issues accesslayerorg#895, accesslayerorg#896, accesslayerorg#901): - GET /api/v1/keys/discovery: trending top-5 keys by 24h volume plus the 10 newest listings, cached 60s, invalidated on new key creation, both sections always return data even when volume is zero. - GET /api/v1/keys/leaderboard: per-key volume over ?window=24h|7d|30d, ranked descending, ?limit= capped at 50, cached with window-sized TTL. - GET /api/v1/search: unified search across keys, creators and governance proposals ranked by text-match relevance, ?type= filter, empty query returns 400 with usage guidance, governance-table outage degrades to empty proposals. Caching follows the creators module's in-process TTL pattern, keyed by a generation counter so key creation invalidates immediately. Jest tests cover aggregation, snapshot merge, ranking, type filtering and caching.
|
@samjay8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #901
Closes #896
Closes #895
Summary
Three marketplace read endpoints over the existing
TradeandCreatorPriceSnapshotread models, in one PR because they share the volume-aggregation and cache infrastructure:?window=24h|7d|30dfrom Trade rows, ranked descending with rank numbers,?limit=capped at 50, price change from window snapshot, cached with a TTL matching the window.?type=filter, per-type caps, empty query → 400 with usage guidance. A governance-table outage degrades to empty proposals rather than failing the other sections.Scope
New
src/modules/keys/module (service, controller, routes) + two-line wiring insrc/modules/index.ts. Caching follows the creators module's in-process TTL pattern (no Redis in this deployment), keyed by a generation counter. No changes to existing modules.Testing
keys.service.test.ts) cover volume aggregation, snapshot merge, ranking order, type filtering, cache hit/invalidation lifecycle, and the governance-outage degradation path.prismaandloggermocked at module boundary; no database needed.Files changed