22 lines
731 B
JavaScript
22 lines
731 B
JavaScript
import Conexion from './Conexion.js';
|
|
import logger from '../utils/logger.js';
|
|
|
|
class DAORegistro {
|
|
static async registrar(usuario, descripcion, day) {
|
|
const conexion = new Conexion();
|
|
const conexionEstablecida = await conexion.conectar();
|
|
try {
|
|
const sql = "INSERT INTO registro (matricula, descripcion) VALUES (?, ?)";
|
|
const stm = await conexionEstablecida.query(sql, [usuario, descripcion + day]);
|
|
return stm.affectedRows > 0;
|
|
} catch (error) {
|
|
logger.error(`Error en DAORegistro.registrar: ${error.message}`);
|
|
return false;
|
|
} finally {
|
|
conexion.cerrarConexion();
|
|
}
|
|
}
|
|
}
|
|
|
|
export default DAORegistro;
|