feat(admin-stats): active orgs per post creation source - #1997
Merged
Merged
Conversation
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Adds activeOrgsBySource to /admin/stats (distinct orgs with a QUEUE, PUBLISHED or ERROR post in the range, grouped by Post.creationMethod) and renders it as a summary card and table on the admin stats page.
giladresisi
force-pushed
the
admin-daily-account-stats
branch
from
September 1, 2026 08:38
c491393 to
d0c5d7c
Compare
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.
What kind of change does this PR introduce?
Feature (backend + frontend, super-admin stats page). Adds a new
activeOrgsBySourceblock to the/admin/statsresponse: the number of distinct organizations with at least one top-level post in the selected range whose state isQUEUE,PUBLISHEDorERROR, grouped byPost.creationMethod(WEB/API/MCP/CLI/AUTOPOST/UNKNOWN). Implemented assourceStats()inadmin-stats.repository.ts(a single PrismagroupByonorganizationId+creationMethod, folded into per-source sets like the existingaccountStats) and wired intogetStats(). The frontendadmin-stats.component.tsxrenders it as one more summary card ("Unique users - active (all sources combined)") and one more table ("Active users per source"). Existing fields, params, gating, service and controller are unchanged; no schema change.Why was this change needed?
We want to see, per day, how many organizations actually use Postiz through each entry point (web UI, public API, MCP, CLI), not only how many posts exist. The total is distinct across all sources (an org using both web and API on one day counts once), while each source row counts that org once, so the table always accounts for the total. Posts created before the
creationMethodcolumn existed (2026-05-12) show up underUNKNOWN.Other information:
Drafts and soft-deleted posts are excluded. Back-filling
creationMethodfor old posts is out of scope.QA
/admin/statswith the "Today" preset; note the new card "Unique users - active (all sources combined)" and the table "Active users per source" at the end of each rowPOST /public/v1/posts, same org), schedule one post for today and two posts for the day after tomorrow, one of them with"creationMethod": "CLI"; via MCP (integrationSchedulePostTool) schedule one for the day after tomorrowWEB 1andAPI 1, the card shows1(same org on two sources counts once in the total)API 1,CLI 1,MCP 1, card1APIrow becomes2and the card becomes2Checklist: