Ajout Logs routes

This commit is contained in:
2025-02-12 08:56:49 +01:00
parent efaa49912e
commit c050a1744f

View File

@@ -119,12 +119,22 @@ router.post('/uploadmeasurement', upload.single('image'), async (req, res) => {
try { try {
const nextOrderId = await measureManager.getNextOrderId(projectId); const nextOrderId = await measureManager.getNextOrderId(projectId);
// Log types for debugging
console.log('Types:', {
image: typeof image,
projectId: typeof projectId,
nextOrderId: typeof nextOrderId
});
const imagePath = await measureManager.uploadMeasureImage(image, projectId, nextOrderId); const imagePath = await measureManager.uploadMeasureImage(image, projectId, nextOrderId);
const measurement = await measureManager.addMeasureToProject(projectId, timestamp, imagePath, temperature, humidity, nextOrderId); const measurement = await measureManager.addMeasureToProject(projectId, timestamp, imagePath, temperature, humidity, nextOrderId);
res.json({ message: 'Measurement uploaded successfully', path: imagePath, id: measurement.id }); res.json({ message: 'Measurement uploaded successfully', path: imagePath, id: measurement.id });
} catch (error) { } catch (error) {
console.error('Error uploading measurement:', error);
serverError.sendError('Error uploading measurement:', res, error); serverError.sendError('Error uploading measurement:', res, error);
} }
}); });
module.exports = router; module.exports = router;