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 = {
id: Math.floor(Math.random() * 1000000000),
name: 'Test Device',
geo_lat: 59.3293,
geo_lon: 18.0686,
@@ -187,8 +186,18 @@ async function createTestDevice(deviceData = {}) {
is_approved: true,
...deviceData
};
return await Device.create(defaultDeviceData);
// 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);
}
}
/**