This commit is contained in:
David Arranz 2019-08-28 13:41:47 +02:00
parent c36b593327
commit d1cbf79c26
2 changed files with 6 additions and 14 deletions

View File

@ -367,11 +367,10 @@ module.exports = function (sequelize, DataTypes) {
Event.addScope('onlyOfCity', (city) => { Event.addScope('onlyOfCity', (city) => {
return { return {
where: { include: [{
city: { model: sequelize.models.Location, as: 'location',
[Sequelize.Op.eq]: city where: { city: {[Sequelize.Op.eq]: city} },
} }],
},
} }
}); });

View File

@ -35,18 +35,11 @@ routes.get('/events',
})(req, res, next) })(req, res, next)
else else
return eventController.find({ return eventController.find({
// scopes: ['defaultScope', 'includeVenue', 'includeMultimedias', 'includeDetails', { method: ['onlyOfCity', req.body.city] }] scopes: ['defaultScope', 'includeVenue', 'includeMultimedias', 'includeDetails', { method: ['onlyOfCity', req.body.city] }]
// scopes: ['defaultScope', 'includeVenue', 'includeMultimedias', 'includeDetails', { method: {where: {}}]
})(req, res, next); })(req, res, next);
} }
); );
/*
where: {
city: {
[Sequelize.Op.eq]: city
}
},
*/
routes.get('/events/cities', routes.get('/events/cities',
isLoggedUser, isLoggedUser,
eventController.find({ eventController.find({