feat(database): Implement DatabaseManager for managing database structure and initialization
All checks were successful
SSH Backend Deploy / ssh-deploy (push) Successful in 1m51s

feat(routes): Add camera, image, measurement, project, and video routes with Swagger documentation

feat(services): Create storageService and videoService for file management and video processing

fix(errorHandler): Enhance error handling with standardized responses and database operation wrappers
This commit is contained in:
2025-04-27 01:02:33 +02:00
parent 792bdca965
commit 4513af3aa0
30 changed files with 3006 additions and 763 deletions

70
src/config/index.js Normal file
View File

@@ -0,0 +1,70 @@
// src/config/index.js
const path = require('path');
// Configuration centralisée de l'application
module.exports = {
// Configuration du serveur
server: {
port: process.env.PORT || 3000,
cors: {
origins: ['http://127.0.0.1:5500', 'http://localhost:5500', 'http://localhost:3000'],
methods: ['GET', 'POST', 'PUT', 'DELETE'],
allowedHeaders: ['Content-Type'],
credentials: true
}
},
// Configuration de la base de données
database: {
host: process.env.DB_HOST || 'timelapse-db',
port: process.env.DB_PORT || 5432,
user: process.env.DB_USER || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
database: process.env.DB_NAME || 'timelapse',
reconnectInterval: 3000
},
// Configuration de Swagger
swagger: {
definition: {
openapi: '3.0.0',
info: {
title: 'API Documentation',
version: '1.0.0',
description: 'Documentation de l\'API avec Swagger'
},
servers: [
{ url: 'https://timelapse.kerboul.me/api' },
{ url: 'http://localhost:3000/api' }
]
},
apis: ['./src/routes/*.js', './src/controllers/*.js'] // Chemins pour la documentation
},
// Chemins des répertoires
paths: {
storage: path.join(process.cwd(), 'storage'),
uploads: path.join(process.cwd(), 'uploads'),
samples: path.join(process.cwd(), 'sample')
},
// Statuts pour les projets et vidéos
status: {
waiting: 0,
completed: 1,
failed: 2,
inProgress: 3
},
// Paramètres par défaut pour la caméra
camera: {
defaultSettings: {
id: 1,
interval: null,
nbImages: null,
maintenance: false,
stopFlag: false,
idle: true
}
}
};