Fix jwt-token
This commit is contained in:
65
create_stockholm_device.js
Normal file
65
create_stockholm_device.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const { Device, Tenant } = require('./models');
|
||||
|
||||
async function createStockholmDevice() {
|
||||
try {
|
||||
// Find the uamils-ab tenant
|
||||
const tenant = await Tenant.findOne({ where: { slug: 'uamils-ab' } });
|
||||
if (!tenant) {
|
||||
console.log('❌ Tenant uamils-ab not found');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if device "1" already exists
|
||||
const existingDevice = await Device.findOne({ where: { id: '1' } });
|
||||
if (existingDevice) {
|
||||
console.log('✅ Stockholm Castle device already exists');
|
||||
console.log(` ID: ${existingDevice.id}`);
|
||||
console.log(` Name: ${existingDevice.name}`);
|
||||
console.log(` Approved: ${existingDevice.is_approved}`);
|
||||
console.log(` Active: ${existingDevice.is_active}`);
|
||||
console.log(` Tenant: ${existingDevice.tenant_id}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Stockholm Castle device
|
||||
const stockholmDevice = await Device.create({
|
||||
id: '1',
|
||||
name: 'Stockholm Castle',
|
||||
type: 'drone_detector',
|
||||
location: 'Stockholm Castle, Sweden',
|
||||
description: 'Drone detector at Stockholm Castle monitoring royal grounds',
|
||||
is_approved: true,
|
||||
is_active: true,
|
||||
tenant_id: tenant.id,
|
||||
coordinates: JSON.stringify({
|
||||
latitude: 59.3251,
|
||||
longitude: 18.0719
|
||||
}),
|
||||
config: JSON.stringify({
|
||||
detection_range: 25000, // 25km range
|
||||
alert_threshold: 5000, // Alert when within 5km
|
||||
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}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error creating Stockholm device:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
createStockholmDevice()
|
||||
.then(() => {
|
||||
console.log('✅ Stockholm device setup completed');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('❌ Setup failed:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user