feat(camera): Ajouter le statut 'stopping' pour gérer l'arrêt des projets et mettre à jour la documentation des routes
All checks were successful
SSH Backend Deploy / ssh-deploy (push) Successful in 9s
All checks were successful
SSH Backend Deploy / ssh-deploy (push) Successful in 9s
This commit is contained in:
@@ -158,6 +158,7 @@ module.exports = {
|
||||
brouillon: 0,
|
||||
capturing: 1,
|
||||
idle: 2,
|
||||
stopping: 3 // Projet en cours d'arrêt
|
||||
},
|
||||
|
||||
// Statuts pour les vidéos
|
||||
|
||||
@@ -73,7 +73,12 @@ class CameraController {
|
||||
* Initie l'arrêt de la procédure de capture
|
||||
*/
|
||||
static stopProcedure = asyncHandler(async (req, res) => {
|
||||
const { project_id } = req.body;
|
||||
|
||||
try {
|
||||
// Met à jour le statut du projet en cours d'arrêt
|
||||
await Project.updateProject(project_id, { status: config.projectStatus.stopping });
|
||||
|
||||
// Marque le drapeau d'arrêt
|
||||
await Camera.updateCamera(1, { stop_flag: true });
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@ class Project {
|
||||
static updateProjectStatus = wrapDatabaseOperation(async (id, status) => {
|
||||
const query = `UPDATE projects SET status = $1 WHERE id = $2 RETURNING *;`;
|
||||
const result = await db.query(query, [status, id]);
|
||||
// Ajout du statut stopping pour les projets en cours d'arrêt
|
||||
if (status === config.projectStatus.stopping) {
|
||||
console.log(`[PROJECT] Projet ${id} mis à jour avec le statut 'stopping'.`);
|
||||
}
|
||||
return result.rows[0] || null;
|
||||
});
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ router.get('/camera/status', CameraController.getCameraStatus);
|
||||
* type: integer
|
||||
* description: Nombre total d'images à capturer
|
||||
* example: 48
|
||||
* status:
|
||||
* type: integer
|
||||
* description: Statut du projet (0: brouillon, 1: capturing, 2: idle, 3: stopping)
|
||||
* required:
|
||||
* - project_id
|
||||
* - interval
|
||||
@@ -99,6 +102,9 @@ router.post('/procedure/start', CameraController.startProcedure);
|
||||
* message:
|
||||
* type: string
|
||||
* example: Procédure d'arrêt de la caméra initiée avec succès
|
||||
* status:
|
||||
* type: integer
|
||||
* description: Statut du projet (0: brouillon, 1: capturing, 2: idle, 3: stopping)
|
||||
* 500:
|
||||
* $ref: '#/components/responses/ServerError'
|
||||
*/
|
||||
@@ -123,6 +129,9 @@ router.post('/procedure/stop', CameraController.stopProcedure);
|
||||
* message:
|
||||
* type: string
|
||||
* example: Caméra arrêtée avec succès
|
||||
* status:
|
||||
* type: integer
|
||||
* description: Statut du projet (0: brouillon, 1: capturing, 2: idle, 3: stopping)
|
||||
* 500:
|
||||
* $ref: '#/components/responses/ServerError'
|
||||
*/
|
||||
@@ -147,6 +156,9 @@ router.post('/camera/stop', CameraController.confirmStopProcedure);
|
||||
* message:
|
||||
* type: string
|
||||
* example: Caméra en mode maintenance
|
||||
* status:
|
||||
* type: integer
|
||||
* description: Statut du projet (0: brouillon, 1: capturing, 2: idle, 3: stopping)
|
||||
* 500:
|
||||
* $ref: '#/components/responses/ServerError'
|
||||
*/
|
||||
@@ -171,6 +183,9 @@ router.post('/camera/maintenance', CameraController.activateMaintenance);
|
||||
* message:
|
||||
* type: string
|
||||
* example: Caméra sortie du mode maintenance
|
||||
* status:
|
||||
* type: integer
|
||||
* description: Statut du projet (0: brouillon, 1: capturing, 2: idle, 3: stopping)
|
||||
* 500:
|
||||
* $ref: '#/components/responses/ServerError'
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user