Fix jwt-token

This commit is contained in:
2025-09-09 20:00:44 +02:00
parent 447ac39fc1
commit b0a700a6cf

View File

@@ -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}%'`)
]
}
});