}; queryParams.include[0].where = queryParams.include[0].where ? Sequelize.and(queryParams.include[0].where, condition) : condition; service_id: service.id, }; queryParams.where = queryParams.where ? Sequelize.and(queryParams.where, condition) : condition; model: optionsWithDefault.model, }; queryParams.where = queryParams.where ? Sequelize.and(queryParams.where, condition) : condition;
Promise.method(function userExists(userAttributes) { /** * Look for user with provider=local, and * username OR email matching the ones provided * in the userAttributes to determine if a user * does in fact exist. These are the only attributes * we consider unique right now */ return User.findOne({where: Sequelize.and({provider: 'local'}, Sequelize.or({username: userAttributes.username}, {email: userAttributes.email}))}).then(function(user) { console.log(user); if (!user) return false; return true; }).catch(function(error) { console.log(error); throw error; }); })