Fix jwt-token
This commit is contained in:
@@ -741,10 +741,17 @@ class AlertService {
|
|||||||
async checkAlertRules(detection) {
|
async checkAlertRules(detection) {
|
||||||
try {
|
try {
|
||||||
// Get the device to determine tenant context
|
// Get the device to determine tenant context
|
||||||
const device = await Device.findByPk(detection.device_id);
|
console.log(`🔍 Looking for device with ID: ${detection.device_id} (type: ${typeof detection.device_id})`);
|
||||||
|
let device = await Device.findByPk(detection.device_id);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
console.log(`Device ${detection.device_id} not found for detection`);
|
// Try with string conversion if numeric lookup failed
|
||||||
return [];
|
const deviceIdStr = String(detection.device_id);
|
||||||
|
device = await Device.findByPk(deviceIdStr);
|
||||||
|
if (!device) {
|
||||||
|
console.log(`Device ${detection.device_id} not found for detection`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
console.log(`✅ Found device with string conversion: ${deviceIdStr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rules = await AlertRule.findAll({
|
const rules = await AlertRule.findAll({
|
||||||
|
|||||||
Reference in New Issue
Block a user