Fix jwt-token
This commit is contained in:
@@ -199,61 +199,69 @@ const setupDatabase = async () => {
|
|||||||
const alertRules = await AlertRule.bulkCreate([
|
const alertRules = await AlertRule.bulkCreate([
|
||||||
{
|
{
|
||||||
user_id: adminUser.id,
|
user_id: adminUser.id,
|
||||||
|
tenant_id: defaultTenant.id,
|
||||||
name: 'Critical Security Threat',
|
name: 'Critical Security Threat',
|
||||||
description: 'Immediate alert for critical and high threats to government facilities',
|
description: 'Immediate alert for critical and high threats to government facilities',
|
||||||
conditions: {
|
|
||||||
min_threat_level: 'high',
|
|
||||||
rssi_threshold: -55,
|
|
||||||
max_distance: 200,
|
|
||||||
drone_types: [0, 1, 2],
|
|
||||||
device_ids: []
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
sms: true,
|
|
||||||
phone_number: '+46701234567',
|
|
||||||
email: true,
|
|
||||||
channels: ['sms', 'email']
|
|
||||||
},
|
|
||||||
cooldown_minutes: 2,
|
|
||||||
is_active: true,
|
is_active: true,
|
||||||
tenant_id: defaultTenant.id
|
device_ids: [],
|
||||||
|
drone_types: [0, 1, 2],
|
||||||
|
min_rssi: -55,
|
||||||
|
max_rssi: null,
|
||||||
|
frequency_ranges: null,
|
||||||
|
time_window: 300,
|
||||||
|
min_detections: 1,
|
||||||
|
cooldown_period: 120,
|
||||||
|
alert_channels: ['sms', 'email'],
|
||||||
|
sms_phone_number: '+46701234567',
|
||||||
|
webhook_url: null,
|
||||||
|
active_hours: null,
|
||||||
|
active_days: [1, 2, 3, 4, 5, 6, 7],
|
||||||
|
priority: 'high',
|
||||||
|
min_threat_level: 'high'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
user_id: operatorUser.id,
|
user_id: operatorUser.id,
|
||||||
|
tenant_id: defaultTenant.id,
|
||||||
name: 'Medium Threat Monitoring',
|
name: 'Medium Threat Monitoring',
|
||||||
description: 'Monitor medium threat drones in facility vicinity',
|
description: 'Monitor medium threat drones in facility vicinity',
|
||||||
conditions: {
|
|
||||||
min_threat_level: 'medium',
|
|
||||||
rssi_threshold: -70,
|
|
||||||
max_distance: 1000,
|
|
||||||
drone_types: [1, 2],
|
|
||||||
device_ids: ['device-alpha-001', 'device-beta-002']
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
sms: true,
|
|
||||||
phone_number: '+46709876543',
|
|
||||||
channels: ['sms']
|
|
||||||
},
|
|
||||||
cooldown_minutes: 10,
|
|
||||||
is_active: true,
|
is_active: true,
|
||||||
tenant_id: defaultTenant.id
|
device_ids: ['device-alpha-001', 'device-beta-002'],
|
||||||
|
drone_types: [1, 2],
|
||||||
|
min_rssi: -70,
|
||||||
|
max_rssi: null,
|
||||||
|
frequency_ranges: null,
|
||||||
|
time_window: 300,
|
||||||
|
min_detections: 1,
|
||||||
|
cooldown_period: 600,
|
||||||
|
alert_channels: ['sms'],
|
||||||
|
sms_phone_number: '+46709876543',
|
||||||
|
webhook_url: null,
|
||||||
|
active_hours: null,
|
||||||
|
active_days: [1, 2, 3, 4, 5, 6, 7],
|
||||||
|
priority: 'medium',
|
||||||
|
min_threat_level: 'medium'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
user_id: adminUser.id,
|
user_id: adminUser.id,
|
||||||
|
tenant_id: defaultTenant.id,
|
||||||
name: 'Device Offline Alert',
|
name: 'Device Offline Alert',
|
||||||
description: 'Alert when security devices go offline',
|
description: 'Alert when security devices go offline',
|
||||||
conditions: {
|
|
||||||
device_offline: true,
|
|
||||||
device_ids: ['device-alpha-001', 'device-beta-002', 'device-gamma-003']
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
sms: true,
|
|
||||||
phone_number: '+46701234567',
|
|
||||||
channels: ['sms']
|
|
||||||
},
|
|
||||||
cooldown_minutes: 30,
|
|
||||||
is_active: true,
|
is_active: true,
|
||||||
tenant_id: defaultTenant.id
|
device_ids: ['device-alpha-001', 'device-beta-002', 'device-gamma-003'],
|
||||||
|
drone_types: null,
|
||||||
|
min_rssi: null,
|
||||||
|
max_rssi: null,
|
||||||
|
frequency_ranges: null,
|
||||||
|
time_window: 300,
|
||||||
|
min_detections: 1,
|
||||||
|
cooldown_period: 1800,
|
||||||
|
alert_channels: ['sms'],
|
||||||
|
sms_phone_number: '+46701234567',
|
||||||
|
webhook_url: null,
|
||||||
|
active_hours: null,
|
||||||
|
active_days: [1, 2, 3, 4, 5, 6, 7],
|
||||||
|
priority: 'medium',
|
||||||
|
min_threat_level: null
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
console.log(`✅ Created ${alertRules.length} sample alert rules`);
|
console.log(`✅ Created ${alertRules.length} sample alert rules`);
|
||||||
|
|||||||
Reference in New Issue
Block a user