add channel_id filter to portnum-counts
This commit is contained in:
parent
57d962ae89
commit
1fd9f1c737
1 changed files with 2 additions and 0 deletions
|
|
@ -123,6 +123,7 @@ router.get('/most-active-nodes', async (req, res) => {
|
||||||
|
|
||||||
router.get('/portnum-counts', async (req, res) => {
|
router.get('/portnum-counts', async (req, res) => {
|
||||||
const nodeId = req.query.nodeId ? parseInt(req.query.nodeId, 10) : null;
|
const nodeId = req.query.nodeId ? parseInt(req.query.nodeId, 10) : null;
|
||||||
|
const channelId = req.query.channel_id;
|
||||||
const hours = 24;
|
const hours = 24;
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const startTime = new Date(now.getTime() - hours * 60 * 60 * 1000);
|
const startTime = new Date(now.getTime() - hours * 60 * 60 * 1000);
|
||||||
|
|
@ -132,6 +133,7 @@ router.get('/portnum-counts', async (req, res) => {
|
||||||
where: {
|
where: {
|
||||||
created_at: { gte: startTime },
|
created_at: { gte: startTime },
|
||||||
...(Number.isInteger(nodeId) ? { from: nodeId } : {}),
|
...(Number.isInteger(nodeId) ? { from: nodeId } : {}),
|
||||||
|
...(channelId ? { channel_id: channelId } : {}),
|
||||||
packet_id: { not: null },
|
packet_id: { not: null },
|
||||||
to: { not: 1 }, // Filter out NODENUM_BROADCAST_NO_LORA
|
to: { not: 1 }, // Filter out NODENUM_BROADCAST_NO_LORA
|
||||||
OR: [
|
OR: [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue