Skip to content

Add stats module scaffold and GET /v1/stats/overview - #1348

Merged
BigBen-7 merged 2 commits into
PinSpace-Org:mainfrom
Essther77-git:feat/stats-scaffold-and-overview
Sep 24, 2026
Merged

BigBen-7 merged 2 commits into
PinSpace-Org:mainfrom
Essther77-git:feat/stats-scaffold-and-overview

Conversation

@Essther77-git

Copy link
Copy Markdown
Contributor

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

  • 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).

#1238 — overview endpoint

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.

No npm install or 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

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.
@drips-wave

drips-wave Bot commented Sep 24, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@BigBen-7
BigBen-7 merged commit 0d15aba into PinSpace-Org:main Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants