correo
This commit is contained in:
@@ -17,6 +17,7 @@ const regresar = async (body) => {
|
|||||||
'id operador regreso',
|
'id operador regreso',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
const update = { idOperadorRegreso };
|
||||||
let diferencia = null;
|
let diferencia = null;
|
||||||
|
|
||||||
return Operador.findOne({ where: { idOperador: idOperadorRegreso } })
|
return Operador.findOne({ where: { idOperador: idOperadorRegreso } })
|
||||||
@@ -33,31 +34,30 @@ const regresar = async (body) => {
|
|||||||
throw new Error('Este préstamo ya no esta activo.');
|
throw new Error('Este préstamo ya no esta activo.');
|
||||||
if (res.Equipo.idStatus === 1)
|
if (res.Equipo.idStatus === 1)
|
||||||
throw new Error('Aun no se ha entregado el equipo al usuario.');
|
throw new Error('Aun no se ha entregado el equipo al usuario.');
|
||||||
diferencia = parseInt((ahora - moment(res.horaFin)) / 60000);
|
if (!res.regresoInmediato) {
|
||||||
if (diferencia >= 15)
|
update.horaEntrega = ahora.format();
|
||||||
await Multa.create({
|
update.activo = false;
|
||||||
idPrestamo,
|
diferencia = parseInt((ahora - moment(res.horaFin)) / 60000);
|
||||||
idInfraccion: 1,
|
if (diferencia >= 15)
|
||||||
idOperadorMulta: idOperadorRegreso,
|
await Multa.create({
|
||||||
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
idPrestamo,
|
||||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
idInfraccion: 1,
|
||||||
}).then((res) =>
|
idOperadorMulta: 1,
|
||||||
Usuario.update(
|
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
||||||
{ multa: true },
|
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||||
{ where: { idUsuario: res.idUsuario } }
|
}).then((res) =>
|
||||||
)
|
Usuario.update(
|
||||||
);
|
{ multa: true },
|
||||||
|
{ where: { idUsuario: res.idUsuario } }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
return Equipo.update(
|
return Equipo.update(
|
||||||
{ idStatus: 4 },
|
{ idStatus: 4 },
|
||||||
{ where: { idEquipo: res.idEquipo } }
|
{ where: { idEquipo: res.idEquipo } }
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(() =>
|
.then(() => Prestamo.update(update, { where: { idPrestamo } }))
|
||||||
Prestamo.update(
|
|
||||||
{ idOperadorRegreso, horaEntrega: ahora.format(), activo: false },
|
|
||||||
{ where: { idPrestamo } }
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
io.getIO().emit('actualizar');
|
io.getIO().emit('actualizar');
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const Equipo = require(`${dbPath}/Equipo`);
|
|||||||
const Multa = require(`${dbPath}/Multa`);
|
const Multa = require(`${dbPath}/Multa`);
|
||||||
const Operador = require(`${dbPath}/Operador`);
|
const Operador = require(`${dbPath}/Operador`);
|
||||||
const Prestamo = require(`${dbPath}/Prestamo`);
|
const Prestamo = require(`${dbPath}/Prestamo`);
|
||||||
|
const Usuario = require(`${dbPath}/Usuario`);
|
||||||
|
|
||||||
const regresarNumeroInventario = async (body) => {
|
const regresarNumeroInventario = async (body) => {
|
||||||
const ahora = moment();
|
const ahora = moment();
|
||||||
@@ -22,6 +23,7 @@ const regresarNumeroInventario = async (body) => {
|
|||||||
'id operador regreso',
|
'id operador regreso',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
const update = { idOperadorRegreso };
|
||||||
let diferencia = null;
|
let diferencia = null;
|
||||||
let idPrestamo = null;
|
let idPrestamo = null;
|
||||||
|
|
||||||
@@ -49,25 +51,31 @@ const regresarNumeroInventario = async (body) => {
|
|||||||
if (res.Equipo.idStatus === 1)
|
if (res.Equipo.idStatus === 1)
|
||||||
throw new Error('Aun no se ha entregado el equipo al usuario.');
|
throw new Error('Aun no se ha entregado el equipo al usuario.');
|
||||||
idPrestamo = res.idPrestamo;
|
idPrestamo = res.idPrestamo;
|
||||||
diferencia = parseInt((ahora - moment(res.horaFin)) / 60000);
|
if (!res.regresoInmediato) {
|
||||||
if (diferencia >= 15)
|
update.horaEntrega = ahora.format();
|
||||||
await Multa.create({
|
update.activo = false;
|
||||||
idPrestamo,
|
diferencia = parseInt((ahora - moment(res.horaFin)) / 60000);
|
||||||
idInfraccion: 1,
|
if (diferencia >= 15)
|
||||||
idOperadorMulta: idOperadorRegreso,
|
await Multa.create({
|
||||||
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
idPrestamo,
|
||||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
idInfraccion: 1,
|
||||||
});
|
idOperadorMulta: 1,
|
||||||
|
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
||||||
|
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||||
|
}).then((res) =>
|
||||||
|
Usuario.update(
|
||||||
|
{ multa: true },
|
||||||
|
{ where: { idUsuario: res.idUsuario } }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
return Equipo.update(
|
return Equipo.update(
|
||||||
{ idStatus: 4 },
|
{ idStatus: 4 },
|
||||||
{ where: { idEquipo: res.idEquipo } }
|
{ where: { idEquipo: res.idEquipo } }
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
Prestamo.update(
|
Prestamo.update(update, { where: { idPrestamo } });
|
||||||
{ idOperadorRegreso, horaEntrega: ahora.format(), activo: false },
|
|
||||||
{ where: { idPrestamo } }
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
io.getIO().emit('actualizar');
|
io.getIO().emit('actualizar');
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const regresoInmediato = async (body) => {
|
|||||||
await Multa.create({
|
await Multa.create({
|
||||||
idPrestamo,
|
idPrestamo,
|
||||||
idInfraccion: 1,
|
idInfraccion: 1,
|
||||||
|
idOperadorMulta: 1,
|
||||||
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
||||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||||
}).then((res) =>
|
}).then((res) =>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const regresoInmediatoNumeroInventario = async (body) => {
|
|||||||
await Multa.create({
|
await Multa.create({
|
||||||
idPrestamo,
|
idPrestamo,
|
||||||
idInfraccion: 1,
|
idInfraccion: 1,
|
||||||
|
idOperadorMulta: 1,
|
||||||
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
descripcion: `Se paso por ${diferencia} minutos para entregar el equipo.`,
|
||||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||||
}).then((res) =>
|
}).then((res) =>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const helperPath = '../../helper';
|
const helperPath = '../../helper';
|
||||||
const gmail = require(`${helperPath}/gmail`);
|
const correoPcPuma = require(`${helperPath}/correo`);
|
||||||
const encriptar = require(`${helperPath}/encriptar`);
|
const encriptar = require(`${helperPath}/encriptar`);
|
||||||
|
const gmail = require(`${helperPath}/gmail`);
|
||||||
const validar = require(`${helperPath}/validar`);
|
const validar = require(`${helperPath}/validar`);
|
||||||
const Usuario = require('../../db/tablas/Usuario');
|
const Usuario = require('../../db/tablas/Usuario');
|
||||||
|
|
||||||
@@ -12,15 +13,16 @@ const crear = async (body) => {
|
|||||||
);
|
);
|
||||||
const telefono = validar.validarNumero(body.telefono, 'teléfono', true, 15);
|
const telefono = validar.validarNumero(body.telefono, 'teléfono', true, 15);
|
||||||
const password = encriptar.generarPassword();
|
const password = encriptar.generarPassword();
|
||||||
let correo = '';
|
let correo = {};
|
||||||
|
let email = '';
|
||||||
|
|
||||||
return Usuario.findOne({ where: { idUsuario } })
|
return Usuario.findOne({ where: { idUsuario } })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res) throw new Error('No existe este usuario.');
|
if (!res) throw new Error('No existe este usuario.');
|
||||||
if (res.password) throw new Error('Este usuario ya fue registrado.');
|
if (res.password) throw new Error('Este usuario ya fue registrado.');
|
||||||
if (!res.activo) throw new Error('Este usuario no esta activo.');
|
if (!res.activo) throw new Error('Este usuario no esta activo.');
|
||||||
// correo = `${res.usuario}@pcpuma.acatlan.unam.mx`;
|
email = `${res.usuario}@pcpuma.acatlan.unam.mx`;
|
||||||
correo = 'lemuelhelonmarquezrosas@gmail.com';
|
correo = correoPcPuma(password);
|
||||||
return Usuario.update(
|
return Usuario.update(
|
||||||
{
|
{
|
||||||
password: encriptar.encriptar(password),
|
password: encriptar.encriptar(password),
|
||||||
@@ -29,8 +31,8 @@ const crear = async (body) => {
|
|||||||
{ where: { idUsuario } }
|
{ where: { idUsuario } }
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then((res) => gmail('Contraseña', correo, password))
|
.then(() => gmail(correo.subject, email, correo.msj))
|
||||||
.then((res) => ({
|
.then(() => ({
|
||||||
message:
|
message:
|
||||||
'Se creó correctamente tu cuenta, ingresa a tu correo @pcpuma para consultar tu contraseña para este servicio.',
|
'Se creó correctamente tu cuenta, ingresa a tu correo @pcpuma para consultar tu contraseña para este servicio.',
|
||||||
}));
|
}));
|
||||||
|
|||||||
+12
-2
@@ -174,8 +174,17 @@ const dataPrograma = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const dataSystem = async () => {
|
||||||
|
console.log('\nPaso 8) Insertando system.'.bold.blue);
|
||||||
|
await Operador.create({
|
||||||
|
idTipoUsuario: 1,
|
||||||
|
operador: 'Systema',
|
||||||
|
password: encriptar.encriptar(process.env.SYSTEM_PASSWORD),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const dataAdmin = async () => {
|
const dataAdmin = async () => {
|
||||||
console.log('\nPaso 8) Insertando admin.'.bold.blue);
|
console.log('\nPaso 9) Insertando admin.'.bold.blue);
|
||||||
await Operador.create({
|
await Operador.create({
|
||||||
idTipoUsuario: 1,
|
idTipoUsuario: 1,
|
||||||
operador: 'Araceli',
|
operador: 'Araceli',
|
||||||
@@ -204,7 +213,7 @@ const dataInfraccion = async () => {
|
|||||||
// { infraccion: '', gravedad: '2' },
|
// { infraccion: '', gravedad: '2' },
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log('\nPaso 9) Insertando data infraccion.'.bold.blue);
|
console.log('\nPaso 10) Insertando data infraccion.'.bold.blue);
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
await Infraccion.create({
|
await Infraccion.create({
|
||||||
infraccion: data[i].infraccion,
|
infraccion: data[i].infraccion,
|
||||||
@@ -222,6 +231,7 @@ const exe = async () => {
|
|||||||
await dataTipoCarrito();
|
await dataTipoCarrito();
|
||||||
await dataStatus();
|
await dataStatus();
|
||||||
await dataPrograma();
|
await dataPrograma();
|
||||||
|
await dataSystem();
|
||||||
await dataAdmin();
|
await dataAdmin();
|
||||||
await dataInfraccion();
|
await dataInfraccion();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
const correoPcPuma = (password) => ({
|
||||||
|
subject: `Pc Puma credenciales`,
|
||||||
|
msj: `Estimado usuario, su registro se realizó con éxito.
|
||||||
|
|
||||||
|
Para acceder al servicio debe hacerlo con los siguientes datos:
|
||||||
|
• Usuario: Número de cuenta o número de trabajador
|
||||||
|
• Contraseña: ${password}
|
||||||
|
|
||||||
|
<p style=" text-align: justify; text-justify: inter-word;">
|
||||||
|
El presente registro le permite hacer uso del préstamo del equipo de cómputo seleccionado, el cual puede ser utilizado únicamente al interior de la FES Acatlán.
|
||||||
|
Para acceder al servicio es obligatorio y su responsabilidad leer los lineamientos "pcpuma-solicita" en la siguiente liga: <a href="https://www.acatlan.unam.mx/pcpuma/Lineamientos.html" target="_blank">acatlan.unam.mx/pcpuma/Lineamientos.html</a>
|
||||||
|
Hacemos de su conocimiento que la presente información es confidencial y debe ser tratada como tal, es de uso exclusivo para el usuario al que fue asignada y se encuentra protegida por la normatividad de la Universidad Nacional Autónoma de México en la materia, cualquier uso no autorizado o indebido se hará del conocimiento de la autoridad universitaria.
|
||||||
|
Puede consultar nuestro aviso de privacidad en: <a href="https://www.acatlan.unam.mx/normatividad" target="_blank">acatlan.unam.mx/normatividad</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Para mayor información o duda contáctenos por este medio.
|
||||||
|
|
||||||
|
Atte.
|
||||||
|
|
||||||
|
PCPUMA Solicita`,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = correoPcPuma;
|
||||||
Reference in New Issue
Block a user