From 647dd72b5b334dd20fff0b7a689b389e56c1c638 Mon Sep 17 00:00:00 2001 From: Kerboul Date: Wed, 2 Apr 2025 09:50:08 +0200 Subject: [PATCH] =?UTF-8?q?Nettoyage=20des=20routes=20:=20suppression=20de?= =?UTF-8?q?s=20anciennes=20d=C3=A9finitions=20Swagger=20et=20des=20variabl?= =?UTF-8?q?es=20inutilis=C3=A9es=20dans=20cameraRoutes.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/_swaggerRoutes.js | 55 ---------------------------------------- routes/cameraRoutes.js | 18 +++---------- 2 files changed, 4 insertions(+), 69 deletions(-) diff --git a/routes/_swaggerRoutes.js b/routes/_swaggerRoutes.js index 59a4e21..34a92a3 100644 --- a/routes/_swaggerRoutes.js +++ b/routes/_swaggerRoutes.js @@ -146,61 +146,6 @@ * description: Erreur serveur. */ -/** - * @swagger - * /procedure/start/: - * post: - * summary: Start the capture procedure - * description: Starts the capture procedure with the given project ID and interval. - * requestBody: - * required: true - * content: - * application/json: - * schema: - * type: object - * properties: - * projectId: - * type: integer - * description: The ID of the project to start capturing. - * interval: - * type: integer - * description: The interval in minutes for the capture. - * responses: - * 200: - * description: Capture procedure started successfully. - * content: - * application/json: - * schema: - * type: object - * properties: - * message: - * type: string - * example: "Procédure de capture démarrée avec succès, projet ID: 1, interval: 10 minutes." - * 500: - * description: Internal server error. - */ - -/** - * @swagger - * /procedure/stop/: - * post: - * summary: Stop the capture procedure - * description: Stops the capture procedure. - * responses: - * 200: - * description: Capture procedure stopped successfully. - * content: - * application/json: - * schema: - * type: object - * properties: - * message: - * type: string - * example: "Procédure de capture arrêtée avec succès." - * 500: - * description: Internal server error. - */ - /** * @swagger * /smile: diff --git a/routes/cameraRoutes.js b/routes/cameraRoutes.js index 7e3b92e..b275599 100644 --- a/routes/cameraRoutes.js +++ b/routes/cameraRoutes.js @@ -6,17 +6,13 @@ const dbTester = require('../test/tester'); const db = require('../db'); const serverError = require('../utils/serverError'); -const minInterval = 3; // Minutes +//const minInterval = 3; // Minutes //const maxInterval = 60; // Minutes var defaultCaptureInterval = 5; // minutes -var defaultCaptureProjectID = -1; // -1 = pas de projet en cours de capture -var defaultCaptureStatus = 0; // 0 = pas de capture, 1 = capture en cours var defaultMaintenance = 0; var captureInterval = defaultCaptureInterval; // intervalle de capture en minutes -var captureProjectID = defaultCaptureProjectID; // ID du projet en cours de capture -var captureStatus = defaultCaptureStatus; // 0 = pas de capture, 1 = capture en cours var maintenance = defaultMaintenance; // 0 = pas de maintenance, 1 = maintenance function initCamera() { @@ -31,10 +27,10 @@ function initCamera() { if (result.rows.length === 0) { const insertQuery = ` - INSERT INTO public.camera (id, interval, project_id, capture_status, maintenance) - VALUES ($1, $2, $3, $4, $5) + INSERT INTO public.camera (id, interval, maintenance) + VALUES ($1, $2, $3) `; - const insertValues = [1, defaultCaptureInterval, defaultCaptureProjectID, defaultCaptureStatus, defaultMaintenance]; + const insertValues = [1, defaultCaptureInterval, defaultMaintenance]; db.query(insertQuery, insertValues, (err) => { if (err) { @@ -66,16 +62,12 @@ function getCamera() { const camera = result.rows[0]; captureInterval = camera.interval; - captureProjectID = camera.project_id; - captureStatus = camera.capture_status; maintenance = camera.maintenance; console.log('Caméra récupérée avec succès:', camera); }); return { captureInterval: captureInterval, - captureProjectID: captureProjectID, - captureStatus: captureStatus, maintenance: maintenance }; } @@ -84,8 +76,6 @@ function printCameraStatus() { let camera = getCamera(); console.log('Statut de la caméra:'); console.log('Intervalle de capture:', camera.captureInterval, 'minutes'); - console.log('ID du projet en cours de capture:', camera.captureProjectID); - console.log('Statut de la capture:', camera.captureStatus === 1 ? 'En cours' : 'Arrêté'); console.log('Maintenance:', camera.maintenance === 1 ? 'En cours' : 'Aucune'); console.log('-----------------------------------'); }