feat: inicializacion de Help Desk segun estandar Telcotronics con bitacora de errores e integracion MCP

This commit is contained in:
2026-10-16 23:29:32 -05:00
commit 0f2708462e
54 changed files with 7590 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
const express = require('express');
const router = express.Router();
const { isAuthenticated } = require('../middleware/auth');
const Company = require('../models/Company');
const User = require('../models/User');
router.get('/', isAuthenticated, async (req, res) => {
try {
const company = await Company.findById(req.session.user.company_id);
const userCount = await Company.countUsers(company.id);
const ticketCount = await Company.countTickets(company.id);
res.render('company/settings', { company, userCount, ticketCount });
} catch (error) {
console.error(error);
req.flash('error_msg', 'Error al cargar configuración');
res.redirect('/');
}
});
router.post('/update', isAuthenticated, async (req, res) => {
const { name } = req.body;
try {
if (name) {
await Company.update(req.session.user.company_id, { name });
}
req.flash('success_msg', 'Empresa actualizada');
res.redirect('/company');
} catch (error) {
console.error(error);
req.flash('error_msg', 'Error al actualizar');
res.redirect('/company');
}
});
module.exports = router;