Nettoyage des routes : suppression des anciennes définitions Swagger et des variables inutilisées dans cameraRoutes.js

This commit is contained in:
2025-04-02 09:50:08 +02:00
parent 73922d8afc
commit 647dd72b5b
2 changed files with 4 additions and 69 deletions

View File

@@ -146,61 +146,6 @@
* description: Erreur serveur. * 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 * @swagger
* /smile: * /smile:

View File

@@ -6,17 +6,13 @@ const dbTester = require('../test/tester');
const db = require('../db'); const db = require('../db');
const serverError = require('../utils/serverError'); const serverError = require('../utils/serverError');
const minInterval = 3; // Minutes //const minInterval = 3; // Minutes
//const maxInterval = 60; // Minutes //const maxInterval = 60; // Minutes
var defaultCaptureInterval = 5; // 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 defaultMaintenance = 0;
var captureInterval = defaultCaptureInterval; // intervalle de capture en minutes 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 var maintenance = defaultMaintenance; // 0 = pas de maintenance, 1 = maintenance
function initCamera() { function initCamera() {
@@ -31,10 +27,10 @@ function initCamera() {
if (result.rows.length === 0) { if (result.rows.length === 0) {
const insertQuery = ` const insertQuery = `
INSERT INTO public.camera (id, interval, project_id, capture_status, maintenance) INSERT INTO public.camera (id, interval, maintenance)
VALUES ($1, $2, $3, $4, $5) VALUES ($1, $2, $3)
`; `;
const insertValues = [1, defaultCaptureInterval, defaultCaptureProjectID, defaultCaptureStatus, defaultMaintenance]; const insertValues = [1, defaultCaptureInterval, defaultMaintenance];
db.query(insertQuery, insertValues, (err) => { db.query(insertQuery, insertValues, (err) => {
if (err) { if (err) {
@@ -66,16 +62,12 @@ function getCamera() {
const camera = result.rows[0]; const camera = result.rows[0];
captureInterval = camera.interval; captureInterval = camera.interval;
captureProjectID = camera.project_id;
captureStatus = camera.capture_status;
maintenance = camera.maintenance; maintenance = camera.maintenance;
console.log('Caméra récupérée avec succès:', camera); console.log('Caméra récupérée avec succès:', camera);
}); });
return { return {
captureInterval: captureInterval, captureInterval: captureInterval,
captureProjectID: captureProjectID,
captureStatus: captureStatus,
maintenance: maintenance maintenance: maintenance
}; };
} }
@@ -84,8 +76,6 @@ function printCameraStatus() {
let camera = getCamera(); let camera = getCamera();
console.log('Statut de la caméra:'); console.log('Statut de la caméra:');
console.log('Intervalle de capture:', camera.captureInterval, 'minutes'); 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('Maintenance:', camera.maintenance === 1 ? 'En cours' : 'Aucune');
console.log('-----------------------------------'); console.log('-----------------------------------');
} }