diff --git a/server/seedDatabase.js b/server/seedDatabase.js index ddeace1..d395047 100644 --- a/server/seedDatabase.js +++ b/server/seedDatabase.js @@ -1,4 +1,4 @@ -const bcrypt = require('bcrypt'); +const bcrypt = require('bcryptjs'); const { User, Device, AlertRule } = require('./models'); async function seedDatabase() { diff --git a/server/services/alertService.js b/server/services/alertService.js index 0074955..ee39ca2 100644 --- a/server/services/alertService.js +++ b/server/services/alertService.js @@ -1,5 +1,5 @@ const twilio = require('twilio'); -const { AlertRule, AlertLog, User, Device } = require('../models'); +const { AlertRule, AlertLog, User, Device, DroneDetection } = require('../models'); const { Op } = require('sequelize'); class AlertService { @@ -97,19 +97,19 @@ class AlertService { const authToken = process.env.TWILIO_AUTH_TOKEN; const phoneNumber = process.env.TWILIO_PHONE_NUMBER; - // If any Twilio credential is missing, disable SMS functionality + // If any Twilio credential is missing or empty, disable SMS functionality if (!accountSid || !authToken || !phoneNumber || accountSid.trim() === '' || authToken.trim() === '' || phoneNumber.trim() === '') { - console.log('📱 Twilio credentials not configured - SMS alerts disabled'); + console.log('📱 Twilio credentials not configured - SMS alerts disabled (Development Mode)'); console.log('ℹ️ To enable SMS alerts, set TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE_NUMBER'); this.twilioEnabled = false; this.twilioClient = null; return; } - // Validate Twilio Account SID format - if (!accountSid.startsWith('AC')) { - console.log('⚠️ Invalid Twilio Account SID format - SMS alerts disabled'); + // Validate Twilio Account SID format (only if provided) + if (accountSid && !accountSid.startsWith('AC')) { + console.log('⚠️ Invalid Twilio Account SID format - SMS alerts disabled (Development Mode)'); console.log('ℹ️ Account SID must start with "AC"'); this.twilioEnabled = false; this.twilioClient = null;