Fix jwt-token

This commit is contained in:
2025-09-15 14:24:17 +02:00
parent 6034aac1a7
commit c8428d5415
2 changed files with 17 additions and 23 deletions

View File

@@ -267,7 +267,22 @@ async function createTestDetection(detectionData = {}) {
...detectionData
};
return await DroneDetection.create(defaultDetectionData);
// Remove any id field to let Sequelize auto-generate UUID
delete defaultDetectionData.id;
// Additional safety check - remove any UUIDV4 function objects
Object.keys(defaultDetectionData).forEach(key => {
if (defaultDetectionData[key] && typeof defaultDetectionData[key] === 'object' &&
defaultDetectionData[key].constructor && defaultDetectionData[key].constructor.name === 'UUIDV4') {
delete defaultDetectionData[key];
}
});
// Try manual UUID generation as a workaround
const { v4: uuidv4 } = require('uuid');
const detectionWithId = { ...defaultDetectionData, id: uuidv4() };
return await DroneDetection.create(detectionWithId);
}
/**