Merge branch 'main' of gitea.kerboul.me:timelapse/timelapse-backend
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user