Skip to content

feat: admin stats - unique publishing/scheduled users per platform - #1843

Open
giladresisi wants to merge 1 commit into
mainfrom
feat/admin-daily-account-stats
Open

feat: admin stats - unique publishing/scheduled users per platform#1843
giladresisi wants to merge 1 commit into
mainfrom
feat/admin-daily-account-stats

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Feature - two new metrics on the super-admin stats page.

Why was this change needed?

We need to know, per platform, how many unique customer accounts (organizations) are publishing or have posts scheduled each day, so we can tell how close we are to each platform's daily unique-users limit - especially TikTok, where we hit that wall several times in the last few days.

The /admin/stats response gains two additive blocks, publishingAccounts and scheduledAccounts: distinct organizations per platform plus an all-platforms-combined total (distinct across platforms, not a summation - an org posting on two platforms counts once in the total). Scheduled counts QUEUE + PUBLISHED top-level posts, so it always includes the published set; DRAFT and ERROR are excluded (drafts aren't scheduled, errored posts failed) - if that needs adjusting it's a one-line where-clause change. Same filters as the existing post stats (top-level posts only, not deleted, publishDate in range), same Prisma groupBy pattern, added to the existing Promise.all fan-out. Existing response fields and tables are unchanged, so the change is backward compatible.

Verified end-to-end locally: seeded scenarios confirm dup channels dedup (org with 2 LinkedIn channels counts once), combined totals are distinct not summed, scheduled >= published, queued-only platforms still get a row, and the real Instagram/TikTok posts in the local DB show correctly per date range.

Other information:

Super-admin only page; strings untranslated like the rest of the page, so no lingo.dev run needed.

Checklist:

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA) (ICLA for individuals, CCLA for entities).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue

🤖 Generated with Claude Code

Adds two additive blocks to the /admin/stats response - publishingAccounts
and scheduledAccounts - each with a distinct-organization count per platform
plus an all-platforms-combined total (distinct, not a summation). Scheduled
counts QUEUE + PUBLISHED top-level posts (drafts and errored posts excluded),
so it always includes the published set. Rendered as two extra summary cards
and breakdown tables on the Admin Stats page, to the right of the existing
ones. Existing response fields and tables are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Aug 4, 2026
@postiz-agent

postiz-agent Bot commented Aug 4, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant