Modificaciones pero no son las finales
This commit is contained in:
Generated
+16
-12
@@ -1082,6 +1082,15 @@
|
||||
"nodemailer": "^6.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/gmail-send/node_modules/nodemailer": {
|
||||
"version": "6.10.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz",
|
||||
"integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==",
|
||||
"license": "MIT-0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||
@@ -1769,16 +1778,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
<<<<<<< HEAD
|
||||
"version": "6.7.2",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz",
|
||||
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q==",
|
||||
=======
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.5.tgz",
|
||||
"integrity": "sha512-nsrh2lO3j4GkLLXoeEksAMgAOqxOv6QumNRVQTJwKH4nuiww6iC2y7GyANs9kRAxCexg3+lTWM3PZ91iLlVjfg==",
|
||||
"license": "MIT-0",
|
||||
>>>>>>> origin/santiago
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
@@ -3591,6 +3594,13 @@
|
||||
"requires": {
|
||||
"lodash": "^4.17.21",
|
||||
"nodemailer": "^6.6.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"nodemailer": {
|
||||
"version": "6.10.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz",
|
||||
"integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"got": {
|
||||
@@ -4128,15 +4138,9 @@
|
||||
}
|
||||
},
|
||||
"nodemailer": {
|
||||
<<<<<<< HEAD
|
||||
"version": "6.7.2",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz",
|
||||
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q=="
|
||||
=======
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.5.tgz",
|
||||
"integrity": "sha512-nsrh2lO3j4GkLLXoeEksAMgAOqxOv6QumNRVQTJwKH4nuiww6iC2y7GyANs9kRAxCexg3+lTWM3PZ91iLlVjfg=="
|
||||
>>>>>>> origin/santiago
|
||||
},
|
||||
"nodemon": {
|
||||
"version": "2.0.15",
|
||||
|
||||
@@ -27,118 +27,14 @@ const obtenerDatosUsr = async (numeroCuenta) => {
|
||||
});
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const usuarioInscrito = async (numeroCuenta, idArea) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
=======
|
||||
// Agregue para profesores
|
||||
const buscarProfesorPorNumero = async (numeroTrabajador) => {
|
||||
const conn = await pool2.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la base de datos. ' + err);
|
||||
>>>>>>> origin/santiago
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
<<<<<<< HEAD
|
||||
`INSERT INTO alumno_inscrito(realizo_pago, id_cuenta, id_periodo, id_plataforma) values(1, ${numeroCuenta}, 22, ${idArea})`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const agregarRecibo = async (folio, monto, fechaTicket, numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
console.log(fechaTicket)
|
||||
return conn
|
||||
.query(
|
||||
`INSERT INTO recibo(folio_recibo, monto, fecha_recibo, fecha_registro, id_cuenta, id_usuario) values(${folio}, ${monto}, '${fechaTicket}', now() ,${numeroCuenta}, 134)`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const agregarDetalleServicio = async (monto, numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`INSERT INTO detalle_servicio(monto, numero_hojas, id_cuenta, id_servicio, id_usuario, id_periodo) values(${monto}, 0, ${numeroCuenta}, 4, 134, 22)`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const borrarRecibo = async (folio, numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`DELETE FROM recibo WHERE folio_recibo = ${folio} AND id_cuenta = ${numeroCuenta} AND id_usuario = 134`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const borrarDetalleServicio = async (numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`DELETE FROM detalle_servicio WHERE id_Cuenta = ${numeroCuenta} AND id_servicio = 4 AND id_periodo = 22`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
obtenerDatosUsr,
|
||||
usuarioInscrito,
|
||||
agregarRecibo,
|
||||
agregarDetalleServicio,
|
||||
borrarRecibo,
|
||||
borrarDetalleServicio,
|
||||
};
|
||||
=======
|
||||
`SELECT nombre, idUsuario, numeroCuenta FROM usuario WHERE numeroCuenta = ?`,
|
||||
[numeroTrabajador] // NUmero de cuenta
|
||||
)
|
||||
@@ -160,11 +56,13 @@ const enviarCorreoInscripcion = async (destinatario, nombreProfesor) => {
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail', // o smtp host como 'smtp.mailtrap.io'
|
||||
auth: {
|
||||
user: process.env.CORREO_ORIGEN, // tu correo
|
||||
pass: process.env.CORREO_PASSWORD, // tu contraseña o app password
|
||||
type: 'OAuth2',
|
||||
user: process.env.CORREO_ORIGEN,
|
||||
clientId: process.env.CLIENT_ID,
|
||||
clientSecret: process.env.CLIENT_SECRET,
|
||||
refreshToken: process.env.REFRESH_TOKEN,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { obtenerIdCarrera, obtenerCarrera, usuarioInscrito, buscarProfesorPorNumero };
|
||||
>>>>>>> origin/santiago
|
||||
module.exports = { buscarProfesorPorNumero };
|
||||
|
||||
@@ -4,8 +4,11 @@ async function enviarCorreoInscripcion(correo, nombre) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
type: 'OAuth2',
|
||||
user: process.env.CORREO_ORIGEN,
|
||||
pass: process.env.CORREO_PASSWORD
|
||||
clientId: process.env.CLIENT_ID,
|
||||
clientSecret: process.env.CLIENT_SECRET,
|
||||
refreshToken: process.env.REFRESH_TOKEN,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -44,19 +44,11 @@ Usuario.init(
|
||||
);
|
||||
|
||||
Usuario.belongsTo(Carrera, {
|
||||
<<<<<<< HEAD
|
||||
foreignKey: {
|
||||
name: 'idCarrera',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
=======
|
||||
foreignKey: {
|
||||
name: 'idCarrera',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
>>>>>>> origin/santiago
|
||||
});
|
||||
|
||||
module.exports = Usuario;
|
||||
|
||||
@@ -37,8 +37,6 @@ const crearTokenAdmin = (data) => {
|
||||
});
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
const crearTokenOperador = (data) => {
|
||||
return jwt.sign({ data }, process.env.KEY, {
|
||||
expiresIn: Number(process.env.CADUCIDAD_TOKEN_OPERADOR),
|
||||
@@ -49,5 +47,4 @@ const crearTokenOperador = (data) => {
|
||||
|
||||
|
||||
|
||||
>>>>>>> origin/santiago
|
||||
module.exports = { verificaToken, crearToken, crearTokenAdmin };
|
||||
|
||||
Reference in New Issue
Block a user