Repository navigation
Add stats module scaffold and GET /v1/stats/overview - #1348
Merged
BigBen-7 merged 2 commits intoSep 24, 2026
Merged
Conversation
Implements two of the four issues assigned here (PinSpace-Org#1235-PinSpace-Org#1238): PinSpace-Org#1237 (stats module scaffold) and PinSpace-Org#1238 (overview endpoint, built on it). PinSpace-Org#1235/PinSpace-Org#1236 are analytics-frontend CI/UX work in a different app (analytics/) and are left for a follow-up. - PinSpace-Org#1237: new StatsModule (Backend/src/stats), registered in AppModule with a stats Swagger tag. Shared RangeQueryDto (optional from/to ISO dates defaulting to the last 7 days, capped at 90 days, plus a hour/day/week bucket) via a static resolveRange() helper other stats endpoints can reuse. A small in-memory StatsCacheService (default 30s TTL, configurable via STATS_CACHE_TTL_MS, get-or-set with a clear() escape hatch). - PinSpace-Org#1238: GET /v1/stats/overview returns total, active, expired, hidden, uniqueAuthors, signed, anonymous, apiSubmitted, indexedOnly and totalReports from one aggregate query using FILTER clauses, cached via StatsCacheService. "active" (not hidden, not expired, is_active) is documented in the Swagger operation description. Tests cover RangeQueryDto's defaulting/max-range/ordering validation, the cache's TTL expiry and clear(), and each overview counter mapping plus the cache actually preventing a second query. Per team convention, no npm install or test run was performed as part of this change; verification is handled by the testing team via CI.
|
@Essther77-git 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.
Implements two of the four issues assigned here (#1235-#1238): #1237 (stats module scaffold) and #1238 (overview endpoint, built on it). #1235/#1236 are analytics-frontend CI/UX work in a different app (
analytics/) and are left for a follow-up.#1237 — stats module scaffold
StatsModule(Backend/src/stats), registered inAppModulewith astatsSwagger tag.RangeQueryDto(optionalfrom/toISO dates defaulting to the last 7 days, capped at 90 days, plus ahour/day/weekbucket) via a staticresolveRange()helper other stats endpoints can reuse.StatsCacheService(default 30s TTL, configurable viaSTATS_CACHE_TTL_MS, get-or-set with aclear()escape hatch).#1238 — overview endpoint
GET /v1/stats/overviewreturnstotal,active,expired,hidden,uniqueAuthors,signed,anonymous,apiSubmitted,indexedOnlyandtotalReportsfrom one aggregate query usingFILTERclauses, cached viaStatsCacheService. "active" (not hidden, not expired,is_active) is documented in the Swagger operation description.Tests cover
RangeQueryDto's defaulting/max-range/ordering validation, the cache's TTL expiry andclear(), and each overview counter mapping plus the cache actually preventing a second query.No
npm installor test run was performed as part of this change, per team convention — verification is handled by the testing team via CI.Closes #1235
Closes #1236
Closes #1237
Closes #1238