validacion.js 439 Bytes
module.exports = function (fileString) {

  return new Promise(function (resolve, reject) {

    var nameFileDest = fileString.split('\\')[fileString.split('\\').length - 1];

    knex('planex_transacciones')
      .where({ archivoRecibido: nameFileDest })
      .then(function (values) {

        if (values.length) {
          reject('Ya existe el comprobante', values);
        } else {
          resolve();
        }
      });
  });
}