const { DataTypes, Model } = require('sequelize'); const sequelize = require('../../config/sequelize.conf'); const Premiacion = require('./Premiacion'); const Profesor = require('./Profesor'); class Invitado extends Model {} Invitado.init( { idInvitado: { type: DataTypes.INTEGER, primaryKey: true, allowNull: false, unique: true, autoIncrement: true, }, nombreCompleto: { type: DataTypes.STRING(80), allowNull: false, }, edad: { type: DataTypes.INTEGER, allowNull: false }, }, { sequelize, modelName: 'Invitado', tableName: 'invitado', timestamps: false, } ); Invitado.belongsTo(Profesor, { foreignKey: { name: 'idProfesor', type: DataTypes.INTEGER, allowNull: false, }, }); Invitado.belongsTo(Premiacion, { foreignKey: { name: 'idPremiacion', type: DataTypes.INTEGER, allowNull: false, }, }); module.exports = Invitado;