Fix jwt-token
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user