actualizacion del registro Persona
This commit is contained in:
@@ -9,7 +9,7 @@ app.post('/registroPersona', async(req, res) => {
|
||||
//console.log(req.body);
|
||||
|
||||
var pass = await bcrypt.hash(req.body.password, 10);
|
||||
console.log(pass);
|
||||
//console.log(pass);
|
||||
let mail = await validator.isEmail(req.body.correo);
|
||||
|
||||
if (!mail) {
|
||||
@@ -52,8 +52,7 @@ app.post('/registroPersona', async(req, res) => {
|
||||
// console.log(results.length);
|
||||
|
||||
if (results.length == 0) {
|
||||
if (req.query.noCuenta == null)
|
||||
req.query.noCuenta = -999;
|
||||
|
||||
await connection.query(`select * from persona where noCuenta=${req.body.noCuenta};`,
|
||||
async(error, results, fields) => {
|
||||
if (error) {
|
||||
@@ -61,13 +60,12 @@ app.post('/registroPersona', async(req, res) => {
|
||||
|
||||
return;
|
||||
}
|
||||
if (results.length > 0) {
|
||||
if (results.length > 0 && req.body.noCuenta != null) {
|
||||
res.status(400).json({ err: true, mjs: 'el numero de cuenta ya esta registrado' });
|
||||
|
||||
return;
|
||||
} else { //insert into persona values(null, '312312', 8.9, 'daniel', 'ramirez', 'homrbe', 21, 'daniel|gmail.com','avanzado', 'externo', 'dasdasda', 'chido', 'acturia', )
|
||||
if (req.query.noCuenta == -999)
|
||||
req.query.noCuenta = null;
|
||||
|
||||
await connection.query(`insert into persona values (${req.body.est}, '${req.body.noCuenta}', ${req.body.promedio},
|
||||
'${req.body.nombre}', '${req.body.apellidos}', '${req.body.sexo}', ${req.body.edad}, '${req.body.correo}',
|
||||
'${req.body.nivelIngles}', '${req.body.comunidad}' , '${pass}', '${req.body.facultad}' , '${req.body.gradoAcademico}',
|
||||
|
||||
Reference in New Issue
Block a user