From b0a700a6cfd51250d96521a85dfdfc9b0992123d Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Tue, 9 Sep 2025 20:00:44 +0200 Subject: [PATCH] Fix jwt-token --- server/services/deviceHealthService.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/services/deviceHealthService.js b/server/services/deviceHealthService.js index ccbe0ee..2f4906b 100644 --- a/server/services/deviceHealthService.js +++ b/server/services/deviceHealthService.js @@ -1,4 +1,4 @@ -const { Device, AlertRule, AlertLog, Heartbeat } = require('../models'); +const { Device, AlertRule, AlertLog, Heartbeat, sequelize } = require('../models'); const { Op } = require('sequelize'); class DeviceHealthService { @@ -133,7 +133,8 @@ class DeviceHealthService { // Rules that monitor all devices (device_ids is null) { device_ids: null }, // Rules that specifically include this device - { device_ids: { [Op.contains]: [device.id] } } + // Use a simple approach - convert device ID to string and check if it's in the JSON array + sequelize.literal(`device_ids::text LIKE '%${device.id}%'`) ] } }); @@ -171,7 +172,8 @@ class DeviceHealthService { // Rules that monitor all devices (device_ids is null) { device_ids: null }, // Rules that specifically include this device - { device_ids: { [Op.contains]: [device.id] } } + // Use a simple approach - convert device ID to string and check if it's in the JSON array + sequelize.literal(`device_ids::text LIKE '%${device.id}%'`) ] } });