activar cuenta

This commit is contained in:
2020-11-23 12:56:24 -06:00
parent 08610054db
commit 5df8e9e00d
6 changed files with 30 additions and 25 deletions
+4
View File
@@ -1,5 +1,6 @@
const validar = require('../../helper/validar');
const Servicio = require('../../db/tablas/Servicio');
const Usuario = require('../../db/tablas/Usuario');
const cancelar = async (body) => {
let idServicio = validar.validarId(body.idServicio);
@@ -9,6 +10,9 @@ const cancelar = async (body) => {
if (!res) throw new Error('No existe este servicio.');
if (res.idStatus === 10)
throw new Error('Este servicio ya fue cancelado');
return Usuario.update({ activo: false }, { where: res.idUsuario });
})
.then((res) => {
return Servicio.update({ idStatus: 10 }, { where: { idServicio } });
})
.then((res) => {
+1 -1
View File
@@ -43,7 +43,7 @@ const registro = async (body) => {
})
.then((res) => {
return Usuario.update(
{ password: encriptar.encriptar(password) },
{ password: encriptar.encriptar(password), activo: true },
{ where: { idUsuario } }
);
})
+1 -1
View File
@@ -9,7 +9,7 @@ const login = async (body) => {
let password = validar.validar(body.password, 'El password');
return Usuario.findOne({
where: { usuario },
where: { usuario, activo: true },
include: [{ model: TipoUsuario }],
}).then((res) => {
if (!res) throw new Error('No existe este usuario.');
+11 -11
View File
@@ -1,16 +1,16 @@
const express = require('express');
const app = express();
const route = '/arrendamiento';
// const get = require('../controller/TipoCuarto/get');
const route = '/cuestionario_alumno';
const nuevo = require('../controller/CuestionarioAlumno');
// app.get(`${route}`, (req, res) => {
// return get()
// .then((data) => {
// res.status(200).json(data);
// })
// .catch((err) => {
// res.status(400).json(err);
// });
// });
app.post(`${route}`, (req, res) => {
return nuevo(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json(err);
});
});
module.exports = app;
+11 -11
View File
@@ -1,16 +1,16 @@
const express = require('express');
const app = express();
const route = '/inmueble';
// const get = require('../controller/TipoCuarto/get');
const route = '/cuestionario_programa';
const nuevo = require('../controller/CuestionarioPrograma');
// app.get(`${route}`, (req, res) => {
// return get()
// .then((data) => {
// res.status(200).json(data);
// })
// .catch((err) => {
// res.status(400).json(err);
// });
// });
app.post(`${route}`, (req, res) => {
return nuevo(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json(err);
});
});
module.exports = app;
+2 -1
View File
@@ -1,10 +1,11 @@
const express = require('express');
const app = express();
// app.use(require('./'))
app.use(require('./Status'));
app.use(require('./Usuario'));
app.use(require('./Servicio'));
app.use(require('./Programa'));
// app.use(require('./CuestionarioAlumno'))
// app.use(require('./CuestionarioPrograma'))
module.exports = app;