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:
+3
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user