Corrección de envió de mail, bugs y filtro por nombre_completo en usuarios

parent 16c1abc3
......@@ -36,7 +36,7 @@ async function enviar (data, template = 'TEMPLATE_CORREO_BASE') {
let mimeType = data.adjuntoBase64.split(';')[0];
mimeType = mimeType.split(':')[1];
settings.attachments = [{
filename: `archivo_adjunto.${mime.getExtension(mimeType)}`,
filename: `archivo_adjunto.${mime.extension(mimeType)}`,
path: data.adjuntoBase64
}];
} else {
......
......@@ -116,11 +116,11 @@ module.exports = function moduloService (repositories, valueObjects, res) {
}
// si la opción de un menu tiene un solo submenu entonces se lo asigna ese submenu a esa opción
for (let i in menu) {
if (menu[i].submenu && menu[i].submenu.length === 1) {
menu[i] = menu[i].submenu[0];
}
}
// for (let i in menu) {
// if (menu[i].submenu && menu[i].submenu.length === 1) {
// menu[i] = menu[i].submenu[0];
// }
// }
return res.success({
permissions,
......@@ -129,7 +129,7 @@ module.exports = function moduloService (repositories, valueObjects, res) {
}
async function findAll (params = {}) {
debug('Lista de modulos|filtros');
debug('Lista de modulos|filtros', params);
return Service.findAll(params, ModuloRepository, res, 'Módulos');
}
......
......@@ -37,7 +37,7 @@ function loadModels (PATH, sequelize, opts = {}) {
array.removeAll(excluir, files);
}
}
files.forEach(function (file) {
let pathFile = path.join(PATH, file);
if (fs.statSync(pathFile).isDirectory()) {
......@@ -139,7 +139,7 @@ function setTimestampsSeeder (arr, idUser = 1) {
return arr;
}
function getQuery (options = {}, arr = []) {
function getQuery (options = {}, excludeOrder = []) {
let query = {};
if (options.limit) {
......@@ -149,7 +149,7 @@ function getQuery (options = {}, arr = []) {
}
}
if (arr.indexOf(options.order ? options.order.replace('-', '') : null) === -1) {
if (excludeOrder.indexOf(options.order ? options.order.replace('-', '') : null) === -1) {
if (options.order) {
if (options.order.startsWith('-')) {
query.order = [[options.order.substring(1), 'DESC']];
......
......@@ -29,7 +29,7 @@ module.exports = function modulosRepository (models, Sequelize) {
query.where.id_modulo = params.id_modulo;
}
if (params.id_modulo !== undefined && params.id_modulo === 0) {
if (params.id_modulo !== undefined && (params.id_modulo === 0 || params.id_modulo === '0')) {
query.where.id_modulo = {
[Op.eq]: null
};
......@@ -39,7 +39,7 @@ module.exports = function modulosRepository (models, Sequelize) {
query.where.id_seccion = params.id_seccion;
}
if (params.id_seccion !== undefined && params.id_seccion === 0) {
if (params.id_seccion !== undefined && (params.id_seccion === 0 || params.id_seccion === '0')) {
query.where.id_seccion = {
[Op.eq]: null
};
......
......@@ -9,7 +9,10 @@ module.exports = function usuariosRepository (models, Sequelize) {
const Op = Sequelize.Op;
async function findAll (params = {}) {
let query = getQuery(params);
let query = getQuery(params, ['nombre_completo']);
if (typeof params.order === 'string' && params.order.indexOf('nombre_completo') !== -1) {
query.order = [['persona', 'primer_apellido', params.order.indexOf('-') !== -1 ? 'DESC' : 'ASC']];
}
query.where = {};
query.include = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment