Fix jwt-token
This commit is contained in:
@@ -61,11 +61,16 @@ class AlertService {
|
||||
const droneTypeInfo = getDroneTypeInfo(droneType);
|
||||
|
||||
// Adjust threat level based on drone type and category
|
||||
if (droneType === 2) { // Orlan - always critical regardless of distance
|
||||
if (droneType === 2 && rssi >= -70) { // Orlan - escalate to critical only if within medium range or closer
|
||||
threatLevel = 'critical';
|
||||
description = `CRITICAL THREAT: ${droneTypeInfo.name.toUpperCase()} DETECTED - IMMEDIATE RESPONSE REQUIRED`;
|
||||
actionRequired = true;
|
||||
console.log(`🚨 ORLAN DRONE DETECTED: ${droneTypeInfo.name} - Force escalating to CRITICAL threat level (RSSI: ${rssi})`);
|
||||
console.log(`🚨 ORLAN DRONE DETECTED: ${droneTypeInfo.name} - Escalating to CRITICAL threat level (RSSI: ${rssi})`);
|
||||
} else if (droneType === 2) { // Orlan at long range - still high priority but not critical
|
||||
if (threatLevel === 'low' || threatLevel === 'monitoring') threatLevel = 'medium';
|
||||
if (threatLevel === 'medium') threatLevel = 'high';
|
||||
description += ` - ${droneTypeInfo.name.toUpperCase()} DETECTED AT LONG RANGE`;
|
||||
actionRequired = true;
|
||||
} else if (droneTypeInfo.threat_level === 'high' || droneTypeInfo.category.includes('Professional')) {
|
||||
// Professional/Commercial drone - escalate threat one level only if close enough
|
||||
if (rssi >= -70) { // Only escalate if medium distance or closer
|
||||
|
||||
@@ -108,7 +108,24 @@ async function teardownTestEnvironment() {
|
||||
*/
|
||||
async function cleanDatabase() {
|
||||
if (sequelize) {
|
||||
await sequelize.sync({ force: true });
|
||||
try {
|
||||
// Disable foreign key checks temporarily
|
||||
await sequelize.query('PRAGMA foreign_keys = OFF');
|
||||
|
||||
// Force sync with drop and recreate
|
||||
await sequelize.sync({ force: true });
|
||||
|
||||
// Re-enable foreign key checks
|
||||
await sequelize.query('PRAGMA foreign_keys = ON');
|
||||
|
||||
// Reset test counter to ensure fresh unique IDs
|
||||
testCounter = 0;
|
||||
|
||||
console.log('✅ Database cleaned successfully');
|
||||
} catch (error) {
|
||||
console.error('❌ Database cleanup failed:', error.message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user