Fix jwt-token
This commit is contained in:
@@ -741,11 +741,18 @@ class AlertService {
|
||||
async checkAlertRules(detection) {
|
||||
try {
|
||||
// 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) {
|
||||
// Try with string conversion if numeric lookup failed
|
||||
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({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user