Display video counts and total views from Bunny CDN in admin

Update client-side query to fetch Bunny.net stats and video data, and adjust server-side logic in routes.ts to correctly aggregate total video views and counts from storage.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/aPgXP9Q
This commit is contained in:
sebastjanartic
2025-08-08 21:12:18 +00:00
parent 78b5327e59
commit 756a77ca57
2 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -132,8 +132,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
// Bunny.net administration routes
app.get("/api/bunny/stats", async (req, res) => {
try {
const { videos } = await storage.getVideos(1, 1000);
const totalViews = videos.reduce((sum, video) => sum + video.views, 0);
const result = await storage.getVideos(1, 1000);
const videos = result?.videos || [];
const totalViews = videos.length > 0 ? videos.reduce((sum, video) => sum + video.views, 0) : 0;
const stats = {
totalVideos: videos.length,