vicinityManager/server/services/registrations/register.js
/*
Looking for duplicates in company registration
*/
Looking for duplicates in company registration
Looking for duplicates in company registration
function findDuplicatesCompany(data) {
  companyName = data.companyName;
  bid = data.businessId;
  var query = {
    $or:[ {name: companyName},
          {businessId: bid} ] };
  return new Promise(function(resolve, reject) {
    userAccountOp.find(query, {cid:1}, function(err, output) {
      if (err) {
        reject(err);
      } else {
        if(output.length === 0){
          resolve(false); 
        } else {
          resolve(true); 
        }
      }
    });
  });
}
function findDuplicatesCompany ( data ) { companyName = data . companyName ; bid = data . businessId ; var query = { $or : [ { name : companyName } , { businessId : bid } ] } ; return new Promise ( function ( resolve , reject ) { userAccountOp . find ( query , { cid : 1 } , function ( err , output ) { if ( err ) { reject ( err ) ; } else { if ( output . length === 0 ) { resolve ( false ) ; } else { resolve ( true ) ; } } } ) ; } ) ; }
Looking for duplicates in company registration
Looking for duplicates in company registration
// No duplicates // Duplicates found