diff --git a/db.js b/db.js index 02fc70c..7483067 100644 --- a/db.js +++ b/db.js @@ -1,10 +1,8 @@ const { Client } = require('pg'); -const local = false; -// Connexion à la base de données PostgreSQL const client = new Client({ - host: local ? 'mikoshi' : '172.30.0.2', - port: local ? 54322 : 5432, + host: '172.30.0.2', + port: 5432, user: 'timelapse', password: 'timelapse', database: 'timelapse' @@ -14,7 +12,7 @@ function connectWithRetry() { client.connect(err => { if (err) { console.error('Erreur de connexion à la base de données:', err); - setTimeout(connectWithRetry, 30000); // Réessayer après 30 secondes + setTimeout(connectWithRetry, 30000); } else { console.log('[DB] Connecté à la base de données PostgreSQL.'); } diff --git a/routes/uploadRoutes.js b/routes/uploadRoutes.js index a8615ae..25b5907 100644 --- a/routes/uploadRoutes.js +++ b/routes/uploadRoutes.js @@ -6,61 +6,6 @@ const serverError = require('../utils/serverError'); const upload = multer({ storage: multer.memoryStorage() }); -/** - * @swagger - * /upload: - * post: - * summary: Télécharger une image - * description: Télécharge une image pour un projet et un ordre spécifiques. - * requestBody: - * content: - * multipart/form-data: - * schema: - * type: object - * properties: - * image: - * type: string - * format: binary - * description: Fichier image à télécharger - * projectId: - * type: integer - * description: ID du projet - * orderId: - * type: integer - * description: ID de la commande - * responses: - * 200: - * description: Image téléchargée avec succès. - * content: - * application/json: - * schema: - * type: object - * properties: - * message: - * type: string - * path: - * type: string - * 400: - * description: Tous les champs sont requis. - * 500: - * description: Erreur serveur. - */ -router.post('/upload', upload.single('image'), async (req, res) => { - const { projectId, orderId } = req.body; - const image = req.file; - - if (!image || !projectId || !orderId) { - return res.status(400).json({ error: 'All fields are required' }); - } - - try { - const imagePath = await measureManager.uploadMeasureImage(image, projectId, orderId); - res.json({ message: 'Image uploaded successfully', path: imagePath }); - } catch (error) { - serverError.sendError('Error uploading image:', res, error); - } -}); - /** * @swagger * /uploadmeasurement: