feat(admin): Add dynamic recent activities and system health fetching#258
feat(admin): Add dynamic recent activities and system health fetching#258codeunia-dev merged 1 commit intomainfrom
Conversation
- Refactor admin dashboard to dynamically fetch recent activities via API - Create new API route `/api/admin/recent-activities` to retrieve system events - Add state management for recent activities and system health data - Implement authorization checks in recent activities API route - Fetch activities from multiple sources: user signups, blog posts, events, and hackathons - Sort and limit activities to display most recent system events - Remove hardcoded activities and replace with dynamic data fetching - Improve type safety with explicit type definitions for activities and system health
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThis change introduces a new data layer for the admin dashboard. Two new API endpoints expose admin-authenticated access to recent activities and system health information. The admin page now uses typed state to store this data instead of hardcoded values. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AdminPage as Admin Page
participant RecentAPI as Recent Activities API
participant SystemAPI as System Health API
participant Supabase
participant Services as External Services
User->>AdminPage: Load dashboard
rect rgb(200, 220, 255)
Note over AdminPage,RecentAPI: Fetch Recent Activities
AdminPage->>RecentAPI: GET /api/admin/recent-activities
RecentAPI->>Supabase: Verify user & admin status
alt Admin verified
RecentAPI->>Supabase: Query activities (profiles, blogs, events, hackathons)
Supabase-->>RecentAPI: Activity data
RecentAPI-->>AdminPage: { activities: [...] }
AdminPage->>AdminPage: Update recentActivities state
else Not authorized
RecentAPI-->>AdminPage: 401/403 error
end
end
rect rgb(220, 255, 200)
Note over AdminPage,SystemAPI: Fetch System Health
AdminPage->>SystemAPI: GET /api/admin/system-health
SystemAPI->>Supabase: Verify user & admin status
alt Admin verified
par Database Check
SystemAPI->>Supabase: Measure query time
Supabase-->>SystemAPI: Response time
and API Check
SystemAPI->>SystemAPI: Self-time check
and Storage Check
SystemAPI->>Services: List objects (blog-images)
Services-->>SystemAPI: Response time
and Email Check
SystemAPI->>SystemAPI: Verify RESEND_API_KEY
end
SystemAPI-->>AdminPage: { health: [{service, status, uptime, responseTime}, ...] }
AdminPage->>AdminPage: Update systemHealth state
else Not authorized
SystemAPI-->>AdminPage: 401/403 error
end
end
AdminPage->>User: Render dashboard with data
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Areas requiring attention:
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
/api/admin/recent-activitiesto retrieve system eventsSummary by CodeRabbit