Fix jwt-token

This commit is contained in:
2025-09-15 13:50:59 +02:00
parent 4f0ce39c69
commit 44f2607773
2 changed files with 25 additions and 3 deletions

View File

@@ -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

View File

@@ -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;
}
}
}