Fix jwt-token

This commit is contained in:
2025-09-16 06:23:15 +02:00
parent 63635a9adf
commit d14ca128dc

View File

@@ -177,7 +177,6 @@ async function createTestDevice(deviceData = {}) {
} }
const defaultDeviceData = { const defaultDeviceData = {
id: Math.floor(Math.random() * 1000000000),
name: 'Test Device', name: 'Test Device',
geo_lat: 59.3293, geo_lat: 59.3293,
geo_lon: 18.0686, geo_lon: 18.0686,
@@ -188,7 +187,17 @@ async function createTestDevice(deviceData = {}) {
...deviceData ...deviceData
}; };
// If a specific ID is provided, use upsert to ensure it's respected
if (deviceData.id) {
const [device, created] = await Device.upsert(defaultDeviceData, {
returning: true
});
return device;
} else {
// Auto-generate ID when none provided
defaultDeviceData.id = Math.floor(Math.random() * 1000000000);
return await Device.create(defaultDeviceData); return await Device.create(defaultDeviceData);
}
} }
/** /**