Fix jwt-token

This commit is contained in:
2025-09-20 23:55:56 +02:00
parent 4579bae52e
commit 24bcdf858f

View File

@@ -77,33 +77,39 @@ const setupDatabase = async () => {
console.log('📡 Creating sample devices...'); console.log('📡 Creating sample devices...');
const devices = await Device.bulkCreate([ const devices = await Device.bulkCreate([
{ {
device_id: 1941875381, id: 'device-alpha-001',
name: 'Drone Detector Alpha', name: 'Drone Detector Alpha',
location: 'Stockholm Central', location_description: 'Stockholm Central',
geo_lat: 59.3293, geo_lat: 59.3293,
geo_lon: 18.0686, geo_lon: 18.0686,
status: 'online', is_active: true,
last_seen: new Date(), is_approved: false,
last_heartbeat: new Date(),
heartbeat_interval: 300,
tenant_id: defaultTenant.id tenant_id: defaultTenant.id
}, },
{ {
device_id: 1941875382, id: 'device-beta-002',
name: 'Drone Detector Beta', name: 'Drone Detector Beta',
location: 'Gothenburg Port', location_description: 'Gothenburg Port',
geo_lat: 57.7089, geo_lat: 57.7089,
geo_lon: 11.9746, geo_lon: 11.9746,
status: 'online', is_active: true,
last_seen: new Date(), is_approved: false,
last_heartbeat: new Date(),
heartbeat_interval: 300,
tenant_id: defaultTenant.id tenant_id: defaultTenant.id
}, },
{ {
device_id: 1941875383, id: 'device-gamma-003',
name: 'Drone Detector Gamma', name: 'Drone Detector Gamma',
location: 'Malmö Airport', location_description: 'Malmö Airport',
geo_lat: 55.6050, geo_lat: 55.6050,
geo_lon: 13.0038, geo_lon: 13.0038,
status: 'offline', is_active: false,
last_seen: new Date(Date.now() - 2 * 60 * 60 * 1000), // 2 hours ago is_approved: false,
last_heartbeat: new Date(Date.now() - 2 * 60 * 60 * 1000), // 2 hours ago
heartbeat_interval: 300,
tenant_id: defaultTenant.id tenant_id: defaultTenant.id
} }
]); ]);
@@ -113,14 +119,16 @@ const setupDatabase = async () => {
console.log('💓 Creating sample heartbeats...'); console.log('💓 Creating sample heartbeats...');
const heartbeats = await Heartbeat.bulkCreate([ const heartbeats = await Heartbeat.bulkCreate([
{ {
device_id: 1941875381, device_id: 'device-alpha-001',
status: 'active', status: 'active',
timestamp: new Date() timestamp: new Date(),
tenant_id: defaultTenant.id
}, },
{ {
device_id: 1941875382, device_id: 'device-beta-002',
status: 'active', status: 'active',
timestamp: new Date() timestamp: new Date(),
tenant_id: defaultTenant.id
} }
]); ]);
console.log(`✅ Created ${heartbeats.length} sample heartbeats`); console.log(`✅ Created ${heartbeats.length} sample heartbeats`);