From 0db5dec5ec3c56d02b6b6378e8412a3f4c9cb50e Mon Sep 17 00:00:00 2001 From: Michilis Date: Sun, 21 Dec 2025 01:49:05 -0300 Subject: [PATCH] Fix /stats route: make async and correct trending mints response - Make /stats route handler async - Await getTrendingMints call - Fix trending mints response to use view_count instead of views_7d --- src/routes/system.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/system.js b/src/routes/system.js index c980b8d..1ffb7d2 100644 --- a/src/routes/system.js +++ b/src/routes/system.js @@ -59,7 +59,7 @@ router.get('/health', (req, res) => { * GET /stats * System statistics */ -router.get('/stats', (req, res) => { +router.get('/stats', async(req, res) => { try { // Mint counts by status const mintCounts = countMintsByStatus(); @@ -102,7 +102,7 @@ router.get('/stats', (req, res) => { const recentReviews = getRecentReviews(5); // Trending mints - const trending = getTrendingMints(5); + const trending = await getTrendingMints(5); res.json({ mints: { @@ -121,7 +121,7 @@ router.get('/stats', (req, res) => { trending_mints: trending.map(m => ({ mint_id: m.mint_id, name: m.name, - views_7d: m.views_7d + views_7d: m.view_count })), computed_at: nowISO() });