From 1fd9f1c7372f30f6ae6d671aca0e4a68b387137c Mon Sep 17 00:00:00 2001 From: Anton Roslund Date: Sun, 5 Oct 2025 12:22:34 +0200 Subject: [PATCH] add channel_id filter to portnum-counts --- src/stats.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stats.js b/src/stats.js index b9d738d..4d5e510 100644 --- a/src/stats.js +++ b/src/stats.js @@ -123,6 +123,7 @@ router.get('/most-active-nodes', async (req, res) => { router.get('/portnum-counts', async (req, res) => { const nodeId = req.query.nodeId ? parseInt(req.query.nodeId, 10) : null; + const channelId = req.query.channel_id; const hours = 24; const now = new Date(); const startTime = new Date(now.getTime() - hours * 60 * 60 * 1000); @@ -132,6 +133,7 @@ router.get('/portnum-counts', async (req, res) => { where: { created_at: { gte: startTime }, ...(Number.isInteger(nodeId) ? { from: nodeId } : {}), + ...(channelId ? { channel_id: channelId } : {}), packet_id: { not: null }, to: { not: 1 }, // Filter out NODENUM_BROADCAST_NO_LORA OR: [