Files
2022-05-13 22:10:54 -05:00

49 lines
1.0 KiB
JavaScript

const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Premiacion = require('./Premiacion');
const Profesor = require('./Profesor');
class ProfesorPremiacion extends Model {}
ProfesorPremiacion.init(
{
idProfesorPremiacion: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true,
},
numeroInvitados: {
type: DataTypes.INTEGER,
allowNull: true,
},
numeroInvitadosDentro: {
type: DataTypes.INTEGER,
allowNull: true,
},
},
{
sequelize,
modelName: 'ProfesorPremiacion',
tableName: 'profesor_premiacion',
timestamps: false,
}
);
ProfesorPremiacion.belongsTo(Profesor, {
foreignKey: {
name: 'idProfesor',
type: DataTypes.INTEGER,
allowNull: false,
},
});
ProfesorPremiacion.belongsTo(Premiacion, {
foreignKey: {
name: 'idPremiacion',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = ProfesorPremiacion;