Fix jwt-token
This commit is contained in:
@@ -58,43 +58,9 @@ async function seedDatabase() {
|
|||||||
// Create sample devices if none exist
|
// Create sample devices if none exist
|
||||||
const deviceCount = await Device.count();
|
const deviceCount = await Device.count();
|
||||||
if (deviceCount === 0) {
|
if (deviceCount === 0) {
|
||||||
await Device.bulkCreate([
|
// REMOVED: Automatic device creation
|
||||||
{
|
// No longer creating sample devices automatically
|
||||||
id: 1,
|
console.log('📝 No sample devices created - add devices manually through the UI');
|
||||||
name: 'Arlanda Airport Detector',
|
|
||||||
geo_lat: 59.6519,
|
|
||||||
geo_lon: 17.9186,
|
|
||||||
location_description: 'Arlanda Airport Security Zone',
|
|
||||||
is_active: true,
|
|
||||||
last_heartbeat: new Date(),
|
|
||||||
heartbeat_interval: 300,
|
|
||||||
firmware_version: '1.0.0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: 'Muskö Naval Base Detector',
|
|
||||||
geo_lat: 58.971724,
|
|
||||||
geo_lon: 18.121915,
|
|
||||||
location_description: 'Muskö Naval Base Perimeter',
|
|
||||||
is_active: true,
|
|
||||||
last_heartbeat: new Date(),
|
|
||||||
heartbeat_interval: 300,
|
|
||||||
firmware_version: '1.0.0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: 'Royal Castle Detector',
|
|
||||||
geo_lat: 59.3268,
|
|
||||||
geo_lon: 18.0717,
|
|
||||||
location_description: 'Royal Castle Security Zone',
|
|
||||||
is_active: true,
|
|
||||||
last_heartbeat: new Date(),
|
|
||||||
heartbeat_interval: 300,
|
|
||||||
firmware_version: '1.0.0'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
console.log('✅ Three detector devices created (Arlanda, Naval Base, Royal Castle)');
|
|
||||||
} else {
|
} else {
|
||||||
console.log('✅ Devices already exist');
|
console.log('✅ Devices already exist');
|
||||||
}
|
}
|
||||||
@@ -105,74 +71,9 @@ async function seedDatabase() {
|
|||||||
// Create location-specific alert rules
|
// Create location-specific alert rules
|
||||||
const alertRuleCount = await AlertRule.count();
|
const alertRuleCount = await AlertRule.count();
|
||||||
if (alertRuleCount === 0) {
|
if (alertRuleCount === 0) {
|
||||||
await AlertRule.bulkCreate([
|
// REMOVED: Automatic alert rule creation
|
||||||
{
|
// No longer creating sample alert rules automatically
|
||||||
user_id: adminUser.id,
|
console.log('📝 No sample alert rules created - add alert rules manually through the UI');
|
||||||
name: 'Arlanda Airport Security Alert',
|
|
||||||
description: 'High-priority drone detection alert for Arlanda Airport',
|
|
||||||
is_active: true,
|
|
||||||
device_ids: [1], // Arlanda detector only
|
|
||||||
min_rssi: -85, // Alert on any detection
|
|
||||||
priority: 'critical',
|
|
||||||
min_threat_level: 'critical', // Only alert on critical threats
|
|
||||||
alert_channels: ['sms'],
|
|
||||||
sms_phone_number: '0736419592',
|
|
||||||
cooldown_period: 300, // 5 minutes between alerts
|
|
||||||
min_detections: 1,
|
|
||||||
time_window: 60 // 1 minute window
|
|
||||||
},
|
|
||||||
{
|
|
||||||
user_id: adminUser.id,
|
|
||||||
name: 'Muskö Naval Base Security Alert',
|
|
||||||
description: 'High-priority drone detection alert for Muskö Naval Base',
|
|
||||||
is_active: true,
|
|
||||||
device_ids: [2], // Muskö detector only
|
|
||||||
min_rssi: -85, // Alert on any detection
|
|
||||||
priority: 'critical',
|
|
||||||
min_threat_level: 'critical', // Only alert on critical threats
|
|
||||||
alert_channels: ['sms'],
|
|
||||||
sms_phone_number: '0739999999',
|
|
||||||
cooldown_period: 300, // 5 minutes between alerts
|
|
||||||
min_detections: 1,
|
|
||||||
time_window: 60 // 1 minute window
|
|
||||||
},
|
|
||||||
{
|
|
||||||
user_id: adminUser.id,
|
|
||||||
name: 'Royal Castle Security Alert',
|
|
||||||
description: 'High-priority drone detection alert for Royal Castle',
|
|
||||||
is_active: true,
|
|
||||||
device_ids: [3], // Royal Castle detector only
|
|
||||||
min_rssi: -85, // Alert on any detection
|
|
||||||
priority: 'critical',
|
|
||||||
min_threat_level: 'critical', // Only alert on critical threats
|
|
||||||
alert_channels: ['sms'],
|
|
||||||
sms_phone_number: '0739999999',
|
|
||||||
cooldown_period: 300, // 5 minutes between alerts
|
|
||||||
min_detections: 1,
|
|
||||||
time_window: 60 // 1 minute window
|
|
||||||
},
|
|
||||||
{
|
|
||||||
user_id: adminUser.id,
|
|
||||||
name: 'Orlan Military Drone Detection Alert',
|
|
||||||
description: 'Emergency alert for any Orlan military drone detection regardless of location',
|
|
||||||
is_active: true,
|
|
||||||
device_ids: [], // All devices
|
|
||||||
drone_types: [1], // Only Orlan drones (type 1)
|
|
||||||
min_rssi: -100, // Any RSSI level
|
|
||||||
priority: 'critical',
|
|
||||||
min_threat_level: null, // No minimum threat level (will trigger on any Orlan)
|
|
||||||
alert_channels: ['sms'],
|
|
||||||
sms_phone_number: '0736419592', // Emergency contact
|
|
||||||
cooldown_period: 60, // Short cooldown for critical threats
|
|
||||||
min_detections: 1,
|
|
||||||
time_window: 30 // Short time window for immediate response
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
console.log('✅ Location-specific alert rules created:');
|
|
||||||
console.log(' - Arlanda Airport → 0736419592');
|
|
||||||
console.log(' - Muskö Naval Base → 073999999');
|
|
||||||
console.log(' - Royal Castle → 073999999');
|
|
||||||
} else {
|
} else {
|
||||||
console.log('✅ Alert rules already exist');
|
console.log('✅ Alert rules already exist');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user