Fix jwt-token
This commit is contained in:
@@ -207,7 +207,19 @@ async function handleDetection(req, res) {
|
||||
console.log('🔍 Complete detection data:', JSON.stringify(detectionData, null, 2));
|
||||
|
||||
// Check if device exists and is approved
|
||||
console.log(`🔍 DEBUG: Looking for device with ID: ${detectionData.device_id} (type: ${typeof detectionData.device_id})`);
|
||||
console.log(`🔍 DEBUG: Device model being used:`, Device);
|
||||
console.log(`🔍 DEBUG: Sequelize instance:`, Device.sequelize.constructor.name);
|
||||
|
||||
// Get all devices to see what's actually in the database
|
||||
const allDevices = await Device.findAll();
|
||||
console.log(`🔍 DEBUG: Total devices in database: ${allDevices.length}`);
|
||||
allDevices.forEach(d => {
|
||||
console.log(` - Device ID: ${d.id} (type: ${typeof d.id}), name: ${d.name}, approved: ${d.is_approved}, active: ${d.is_active}`);
|
||||
});
|
||||
|
||||
let device = await Device.findOne({ where: { id: detectionData.device_id } });
|
||||
console.log(`🔍 DEBUG: Device lookup result:`, device ? `Found device ${device.id}` : 'Device not found');
|
||||
|
||||
if (!device) {
|
||||
// Device not found - reject detection and require manual registration
|
||||
|
||||
Reference in New Issue
Block a user