feat: implement campaign analytics rollups, trending, and impact metr…#110
Merged
BarryArinze merged 4 commits intoJun 22, 2026
Conversation
…ics (aid-linkk#85) - Add CampaignHourlyStat, CampaignMonthlyStat, CampaignTrending, RollupTracker models - Extend JobType enum with analytics job types - Add analytics config block with configurable cron patterns and feature flag - Add new types: TrendingCampaign, ImpactMetrics, HistoricalStats - Implement Redis-backed cache layer for real-time campaign stats - Add getTrendingCampaigns, getCampaignImpactMetrics, getCampaignHistoricalStats - Add getAggregatedCampaignAnalytics for admin dashboards - Implement hourly/monthly rollup logic (idempotent via upsert) - Implement trending campaign refresh with composite scoring - Add new endpoints: GET /campaigns/trending (period, sortBy, limit) GET /campaigns/:id/impact-metrics GET /campaigns/:id/statistics/historical (granularity, date range) GET /analytics/campaigns (admin, paginated rollup data) - Hook real-time cache updates into DonationService and DistributionService - Create analytics worker with scheduled jobs (hourly, monthly, trending, reconcile) - Feature-flag analytics worker via ANALYTICS_WORKER_ENABLED - Document new endpoints in API.md Closes aid-linkk#85
…type errors - Add missing AnalyticsService imports in donation.service.ts and distribution.service.ts - Remove unused CACHE_PREFIX_TRENDING_ZSET constant in analytics.service.ts - Remove unused 'amount' variable in donation.service.ts refund handler - Fix Prisma JSON null type errors in recovery.service.ts (writeAuditLog helper and create functions)
9 tasks
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.
…ics (#85)
Closes #85