activar cuenta
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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 } }
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user