feat: admin stats - unique publishing/scheduled users per platform - #1843
Open
giladresisi wants to merge 1 commit into
Open
feat: admin stats - unique publishing/scheduled users per platform#1843giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
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>
✅ 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. |
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 - 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,
publishingAccountsandscheduledAccounts: 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:
🤖 Generated with Claude Code