.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) => {
return models.EventInscription.scope("defaultScope").findAll({
return models.EventInscriptionOnline.scope("defaultScope").findAll({
where: {
eventId: eventId,
//type: ["online", "online group"],
},
});
},

View File

@ -39,33 +39,46 @@ module.exports = function (sequelize, DataTypes) {
email: {
type: DataTypes.STRING,
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: {
type: DataTypes.INTEGER,
},
profile: {
type: DataTypes.STRING,
},
},
{
tableName: "v_events_inscriptions_online",
freezeTableName: true,
timestamps: true,
timestamps: false,
defaultScope: {
order: [["date", "DESC"]],
include: [
{
model: sequelize.models.User,
as: "user",
include: [{ model: sequelize.models.Entity, attributes: ["id", "name"], required: false }],
},
],
// include: [
// {
// model: sequelize.models.User,
// as: "user",
// include: [{ model: sequelize.models.Entity, attributes: ["id", "name"], required: false }],
// },
// ],
},
}
);
EventInscriptionOnline.associate = function (models) {
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;