This commit is contained in:
David Arranz 2019-07-17 17:13:55 +02:00
parent 99ae109865
commit fe60bad86e
4 changed files with 80 additions and 89 deletions

View File

@ -156,11 +156,9 @@ module.exports = function (sequelize, DataTypes) {
return { return {
include: [{ include: [{
model: sequelize.models.EventDetail, model: sequelize.models.EventDetail,
as: 'eventdetail', as: 'details',
where: { where: {
speakerId: { type: 'speaker'
[Sequelize.Op.ne]: null
}
}, },
include: [{ model: sequelize.models.Speaker, as: 'speaker' }] include: [{ model: sequelize.models.Speaker, as: 'speaker' }]
}] }]
@ -169,7 +167,7 @@ module.exports = function (sequelize, DataTypes) {
Event.addScope('next', { Event.addScope('next', {
where: { where: {
date: { init_date: {
[Sequelize.Op.gte]: moment().add(1, 'days').startOf('day').utc() [Sequelize.Op.gte]: moment().add(1, 'days').startOf('day').utc()
} }
}, },
@ -177,7 +175,7 @@ module.exports = function (sequelize, DataTypes) {
Event.addScope('current', { Event.addScope('current', {
where: { where: {
date: { init_date: {
[Sequelize.Op.gte]: moment().startOf('day').utc(), [Sequelize.Op.gte]: moment().startOf('day').utc(),
[Sequelize.Op.lt]: moment().add(1, 'days').startOf('day').utc(), [Sequelize.Op.lt]: moment().add(1, 'days').startOf('day').utc(),
} }
@ -186,7 +184,7 @@ module.exports = function (sequelize, DataTypes) {
Event.addScope('past', { Event.addScope('past', {
where: { where: {
date: { init_date: {
[Sequelize.Op.lt]: moment().startOf('day').utc() [Sequelize.Op.lt]: moment().startOf('day').utc()
} }
} }

View File

@ -35,22 +35,26 @@ routes.get('/events/next',
PaginateMiddleware.middleware(), PaginateMiddleware.middleware(),
SortMiddleware.middleware({ default: "init_available_date" }), SortMiddleware.middleware({ default: "init_available_date" }),
eventController.find({ eventController.find({
scopes: ['defaultScope', 'next', 'includeVenue', 'includeDetails', 'includeSpeakers'], scopes: ['defaultScope', 'next', 'includeVenue', 'includeSpeakers'],
}), }),
//eventController.find //eventController.find , 'includeSpeakers'
// model.scope('next').findAll(); // model.scope('next').findAll();
///SchemaValidator(eventValidation.EventsListOutputType, true), ///SchemaValidator(eventValidation.EventsListOutputType, true),
); );
routes.get('/events/pass', routes.get('/events/past',
isLoggedUser, isLoggedUser,
FieldMiddleware.middleware({ FieldMiddleware.middleware({
invalidFields: generalInvalidFields invalidFields: generalInvalidFields
}), }),
PaginateMiddleware.middleware(), PaginateMiddleware.middleware(),
SortMiddleware.middleware({ default: "-date" }), SortMiddleware.middleware({ default: "-init_date" }),
eventController.findPass eventController.find({
scopes: ['defaultScope', 'past', 'includeVenue', 'includeDetails'],
}),
// eventController.findPass
); );
routes.get('/events/current', routes.get('/events/current',

View File

@ -73,6 +73,16 @@ where videoId in (select id from lqdvi_v2.multimedia_files);
Cargar Cargar
script-carga-bd-events_details.sql script-carga-bd-events_details.sql
update lqdvi_v2.events_details
set type = 'speaker'
where description like'%conference-speaker%';
update lqdvi_v2.events_details
set type = 'info'
where type is null;
//Modificamos la tabla para crear otro campo autoinc que nos rellene el order //Modificamos la tabla para crear otro campo autoinc que nos rellene el order
/* /*
insert into lqdvi_v2.events_schedules (id, eventId, speakerId, description, createdAt, updatedAt) insert into lqdvi_v2.events_schedules (id, eventId, speakerId, description, createdAt, updatedAt)

File diff suppressed because one or more lines are too long