42 lines
795 B
JavaScript
42 lines
795 B
JavaScript
const { DataTypes, Model } = require('sequelize');
|
|
const sequelize = require('../../config/sequelize.conf');
|
|
const Cuestionario = require('./Cuestionario');
|
|
|
|
class Seccion extends Model {}
|
|
Seccion.init(
|
|
{
|
|
idSeccion: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
allowNull: false,
|
|
unique: true,
|
|
autoIncrement: true,
|
|
},
|
|
titulo: {
|
|
type: DataTypes.STRING(100),
|
|
allowNull: false,
|
|
},
|
|
descripcion: {
|
|
type: DataTypes.STRING(100),
|
|
allowNull: false,
|
|
},
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: 'Seccion',
|
|
tableName: 'seccion',
|
|
timestamps: false,
|
|
}
|
|
);
|
|
|
|
Seccion.belongsTo(Cuestionario, {
|
|
foreignKey: {
|
|
name: 'idCuestionario',
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
},
|
|
});
|
|
|
|
|
|
module.exports = Seccion;
|