.inscripciones online

This commit is contained in:
David Arranz 2022-06-13 16:01:42 +02:00
parent dbfa733f5d
commit c22a469ae5
2 changed files with 25 additions and 11 deletions

View File

@ -61,9 +61,10 @@ const extraMethods = {
}, },
_getInscriptionOnlineByEvent: (eventId) => { _getInscriptionOnlineByEvent: (eventId) => {
return models.EventInscription.scope("defaultScope").findAll({ return models.EventInscriptionOnline.scope("defaultScope").findAll({
where: { where: {
eventId: eventId, eventId: eventId,
//type: ["online", "online group"],
}, },
}); });
}, },

View File

@ -39,33 +39,46 @@ module.exports = function (sequelize, DataTypes) {
email: { email: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
// defaultValue: "regular", //grupal, invitacion-regular, invitation-grupal, online, online group, onsite, onsite group },
name: {
type: DataTypes.STRING,
allowNull: false,
},
surname: {
type: DataTypes.STRING,
},
entity_name: {
type: DataTypes.STRING,
}, },
assistants: { assistants: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
}, },
profile: {
type: DataTypes.STRING,
},
}, },
{ {
tableName: "v_events_inscriptions_online", tableName: "v_events_inscriptions_online",
freezeTableName: true, freezeTableName: true,
timestamps: true, timestamps: false,
defaultScope: { defaultScope: {
order: [["date", "DESC"]], order: [["date", "DESC"]],
include: [ // include: [
{ // {
model: sequelize.models.User, // model: sequelize.models.User,
as: "user", // as: "user",
include: [{ model: sequelize.models.Entity, attributes: ["id", "name"], required: false }], // include: [{ model: sequelize.models.Entity, attributes: ["id", "name"], required: false }],
}, // },
], // ],
}, },
} }
); );
EventInscriptionOnline.associate = function (models) { EventInscriptionOnline.associate = function (models) {
EventInscriptionOnline.Event = EventInscriptionOnline.belongsTo(models.Event, { foreignKey: "eventId", as: "event" }); EventInscriptionOnline.Event = EventInscriptionOnline.belongsTo(models.Event, { foreignKey: "eventId", as: "event" });
EventInscriptionOnline.User = EventInscriptionOnline.belongsTo(models.User, { foreignKey: "userId", as: "user" }); // EventInscriptionOnline.User = EventInscriptionOnline.belongsTo(models.User, { foreignKey: "userId", as: "user" });
}; };
return EventInscriptionOnline; return EventInscriptionOnline;