const { DataTypes, Model } = require('sequelize'); const sequelize = require('../../config/sequelize.conf'); const Usuario = require('./Usuario'); const Area = require('./Area'); const FechaInscripcion = require('./FechaInscripcion'); class Inscripcion extends Model {} Inscripcion.init( { idInscripcion: { type: DataTypes.INTEGER, primaryKey: true, allowNull: false, unique: true, autoIncrement: true, }, validacion: { type: DataTypes.INTEGER, defaultValue: 2, }, cancelacion: { type: DataTypes.BOOLEAN, defaultValue: 0, }, motivo: { type: DataTypes.STRING(100), defaultValue: null, }, folio: { type: DataTypes.STRING(10), allowNull: true, defaultValue: null, }, monto: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null, }, hizoPago: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null, }, rutaTicket: { type: DataTypes.STRING(100), allowNull: true, defaultValue: null, }, extension: { type: DataTypes.STRING(6), allowNull: true, defaultValue: null, }, fechaInscripcion: { type: DataTypes.DATE, allowNull: true, defaultValue: null, }, fechaTicket: { type: DataTypes.DATE, allowNull: true, defaultValue: null, }, idPeriodo: { type: DataTypes.INTEGER(8), allowNull: true, defaultValue: null, }, }, { sequelize, modelName: 'Inscripcion', tableName: 'inscripcion', timestamps: false, } ); Inscripcion.belongsTo(Usuario, { foreignKey: { name: 'idUsuario', type: DataTypes.INTEGER, allowNull: false, }, }); Inscripcion.belongsTo(Area, { foreignKey: { name: 'idArea', type: DataTypes.INTEGER, allowNull: false, }, }); module.exports = Inscripcion;