Files
inscripciones_api/server/db/tablas/Inscripcion.js
T
2022-02-03 00:11:03 -06:00

87 lines
1.7 KiB
JavaScript

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.BOOLEAN,
allowNull: true,
defaultValue: null,
},
confirmacion: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
folio: {
type: DataTypes.STRING(5),
allowNull: true,
defaultValue: null,
unique: true,
},
monto: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
fechaInscripcion: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
},
fechaTicket: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
},
rutaTicket: {
type: DataTypes.STRING(100),
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,
},
});
// Inscripcion.belongsTo(FechaInscripcion, {
// foreignKey: {
// name: 'idFechaInscripcion',
// type: DataTypes.INTEGER,
// allowNull: false,
// },
// });
module.exports = Inscripcion;