This commit is contained in:
David Arranz 2019-08-31 11:36:31 +02:00
parent 7e6c644a35
commit 2f953e2838

View File

@ -192,6 +192,11 @@ module.exports = function (sequelize, DataTypes) {
model: sequelize.models.EventType,
as: 'type',
attributes: ['name', 'title'],
},
{
association: 'location',
attributes: ['country', 'city'],
require:false,
}],
},
});
@ -367,9 +372,6 @@ module.exports = function (sequelize, DataTypes) {
Event.addScope('onlyOfLocation', (location) => {
return {
include: [{
model: sequelize.models.Location, as: 'location',
}],
where: { locationId: { [Sequelize.Op.eq]: location } },
}
});