From 24bcdf858ff99a573efa1119d702dff670b433ea Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Sat, 20 Sep 2025 23:55:56 +0200 Subject: [PATCH] Fix jwt-token --- server/scripts/setup-database.js | 40 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/server/scripts/setup-database.js b/server/scripts/setup-database.js index c0989a8..6bff6b3 100644 --- a/server/scripts/setup-database.js +++ b/server/scripts/setup-database.js @@ -77,33 +77,39 @@ const setupDatabase = async () => { console.log('📡 Creating sample devices...'); const devices = await Device.bulkCreate([ { - device_id: 1941875381, + id: 'device-alpha-001', name: 'Drone Detector Alpha', - location: 'Stockholm Central', + location_description: 'Stockholm Central', geo_lat: 59.3293, geo_lon: 18.0686, - status: 'online', - last_seen: new Date(), + is_active: true, + is_approved: false, + last_heartbeat: new Date(), + heartbeat_interval: 300, tenant_id: defaultTenant.id }, { - device_id: 1941875382, + id: 'device-beta-002', name: 'Drone Detector Beta', - location: 'Gothenburg Port', + location_description: 'Gothenburg Port', geo_lat: 57.7089, geo_lon: 11.9746, - status: 'online', - last_seen: new Date(), + is_active: true, + is_approved: false, + last_heartbeat: new Date(), + heartbeat_interval: 300, tenant_id: defaultTenant.id }, { - device_id: 1941875383, + id: 'device-gamma-003', name: 'Drone Detector Gamma', - location: 'Malmö Airport', + location_description: 'Malmö Airport', geo_lat: 55.6050, geo_lon: 13.0038, - status: 'offline', - last_seen: new Date(Date.now() - 2 * 60 * 60 * 1000), // 2 hours ago + is_active: false, + is_approved: false, + last_heartbeat: new Date(Date.now() - 2 * 60 * 60 * 1000), // 2 hours ago + heartbeat_interval: 300, tenant_id: defaultTenant.id } ]); @@ -113,14 +119,16 @@ const setupDatabase = async () => { console.log('💓 Creating sample heartbeats...'); const heartbeats = await Heartbeat.bulkCreate([ { - device_id: 1941875381, + device_id: 'device-alpha-001', status: 'active', - timestamp: new Date() + timestamp: new Date(), + tenant_id: defaultTenant.id }, { - device_id: 1941875382, + device_id: 'device-beta-002', status: 'active', - timestamp: new Date() + timestamp: new Date(), + tenant_id: defaultTenant.id } ]); console.log(`✅ Created ${heartbeats.length} sample heartbeats`);