From b65230d5e724820676df5cb57813c48bac1dc016 Mon Sep 17 00:00:00 2001 From: Kerboul Date: Wed, 2 Apr 2025 10:48:56 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20documentation=20Swagger=20pou?= =?UTF-8?q?r=20les=20proc=C3=A9dures=20de=20capture=20et=20restauration,?= =?UTF-8?q?=20et=20r=C3=A9int=C3=A9gration=20de=20la=20fonction=20de=20d?= =?UTF-8?q?=C3=A9marrage=20de=20la=20proc=C3=A9dure=20avec=20gestion=20des?= =?UTF-8?q?=20erreurs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/cameraRoutes.js | 80 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/routes/cameraRoutes.js b/routes/cameraRoutes.js index 1357849..39e27a1 100644 --- a/routes/cameraRoutes.js +++ b/routes/cameraRoutes.js @@ -227,16 +227,6 @@ router.get('/camera/status', async (req, res) => { } }); -router.post('/procedure/start/', async (req, res) => { - const { projectId, interval, maintenance } = req.body; - try { - const result = startProcedure(projectId, interval, maintenance); - res.status(200).json(result); - } catch (err) { - serverError.sendError('Erreur lors du démarrage de la procédure de capture:', res, err, 500); - } -}); - function setCameraSettings(interval, maintenance) { try { const query = ` @@ -288,6 +278,76 @@ function stopProcedure() { } } +/** + * @swagger + * /procedure/start/: + * post: + * summary: Start the capture procedure + * tags: + * - Procedure + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * properties: + * projectId: + * type: integer + * description: ID of the project to start capturing + * interval: + * type: integer + * description: Capture interval in minutes + * maintenance: + * type: integer + * description: Maintenance status (0 = none, 1 = ongoing) + * responses: + * 200: + * description: Successfully started the capture procedure + * content: + * application/json: + * schema: + * type: object + * properties: + * message: + * type: string + * description: Success message + * error: + * type: string + * description: Error message, if any + * 500: + * description: Internal server error + * /procedure/stop/: + * post: + * summary: Stop the capture procedure + * tags: + * - Procedure + * responses: + * 200: + * description: Successfully stopped the capture procedure + * content: + * application/json: + * schema: + * type: object + * properties: + * message: + * type: string + * description: Success message + * error: + * type: string + * description: Error message, if any + * 500: + * description: Internal server error + */ +router.post('/procedure/start/', async (req, res) => { + const { projectId, interval, maintenance } = req.body; + try { + const result = startProcedure(projectId, interval, maintenance); + res.status(200).json(result); + } catch (err) { + serverError.sendError('Erreur lors du démarrage de la procédure de capture:', res, err, 500); + } +}); router.post('/procedure/stop/', async (req, res) => { try {