correcciones y nueva base

This commit is contained in:
2022-05-13 17:23:10 -05:00
parent 71dce1f4fe
commit f9fa0ac0ca
5 changed files with 67 additions and 12 deletions
+9
View File
@@ -1,5 +1,6 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Premiacion = require('./Premiacion');
const Profesor = require('./Profesor');
class Invitado extends Model {}
@@ -37,4 +38,12 @@ Invitado.belongsTo(Profesor, {
},
});
Invitado.belongsTo(Premiacion, {
foreignKey: {
name: 'idPremiacion',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = Invitado;
+31
View File
@@ -0,0 +1,31 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
class Premiacion extends Model {}
Premiacion.init(
{
idPremiacion: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
premiacion: {
type: DataTypes.STRING(50),
allowNull: false,
},
fecha: {
type: DataTypes.DATEONLY,
allowNull: false,
},
},
{
sequelize,
modelName: 'Premiacion',
tableName: 'premiacion',
timestamps: false,
}
);
module.exports = Premiacion;