From 490bd86d0cacac7f91e34e99948e444ca3991100 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Wed, 17 Sep 2025 18:47:16 +0200 Subject: [PATCH] Fix jwt-token --- create_stockholm_device.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/create_stockholm_device.js b/create_stockholm_device.js index d5cbce0..05fc7ec 100644 --- a/create_stockholm_device.js +++ b/create_stockholm_device.js @@ -9,10 +9,10 @@ async function createStockholmDevice() { return; } - // Check if device "1" already exists - const existingDevice = await Device.findOne({ where: { id: '1' } }); + // Check if device "1941875381" already exists (from your test packet) + const existingDevice = await Device.findOne({ where: { id: '1941875381' } }); if (existingDevice) { - console.log('✅ Stockholm Castle device already exists'); + console.log('✅ Test device already exists'); console.log(` ID: ${existingDevice.id}`); console.log(` Name: ${existingDevice.name}`); console.log(` Approved: ${existingDevice.is_approved}`); @@ -21,33 +21,33 @@ async function createStockholmDevice() { return; } - // Create Stockholm Castle device - const stockholmDevice = await Device.create({ - id: '1', - name: 'Stockholm Castle', + // Create test device with the ID from your packet + const testDevice = await Device.create({ + id: '1941875381', + name: 'Test Device 1941875381', type: 'drone_detector', - location: 'Stockholm Castle, Sweden', - description: 'Drone detector at Stockholm Castle monitoring royal grounds', + location: 'Test Location', + description: 'Test drone detector device', is_approved: true, is_active: true, tenant_id: tenant.id, coordinates: JSON.stringify({ - latitude: 59.3251, - longitude: 18.0719 + latitude: 0, + longitude: 0 }), config: JSON.stringify({ - detection_range: 25000, // 25km range - alert_threshold: 5000, // Alert when within 5km + detection_range: 25000, + alert_threshold: 5000, frequency_bands: ['2.4GHz', '5.8GHz'], sensitivity: 'high' }) }); - console.log('✅ Stockholm Castle device created successfully'); - console.log(` ID: ${stockholmDevice.id}`); - console.log(` Name: ${stockholmDevice.name}`); - console.log(` Tenant: ${stockholmDevice.tenant_id}`); - console.log(` Approved: ${stockholmDevice.is_approved}`); + console.log('✅ Test device created successfully'); + console.log(` ID: ${testDevice.id}`); + console.log(` Name: ${testDevice.name}`); + console.log(` Tenant: ${testDevice.tenant_id}`); + console.log(` Approved: ${testDevice.is_approved}`); } catch (error) { console.error('❌ Error creating Stockholm device:', error.message); @@ -56,7 +56,7 @@ async function createStockholmDevice() { createStockholmDevice() .then(() => { - console.log('✅ Stockholm device setup completed'); + console.log('✅ Test device setup completed'); process.exit(0); }) .catch(error => {