const { DataTypes, Model } = require('sequelize'); const sequelize = require('../../config/sequelize.conf'); const Usuario = require('./Usuario'); const Carrera = require('./Carrera'); const Programa = require('./Programa'); const Status = require('./Status'); const CuestionarioAlumno = require('./CuestionarioAlumno'); const CuestionarioPrograma = require('./CuestionarioPrograma'); class Servicio extends Model {} Servicio.init( { idServicio: { type: DataTypes.INTEGER, primaryKey: true, allowNull: false, unique: true, autoIncrement: true, }, creditos: { type: DataTypes.STRING(3), allowNull: false, }, correo: { type: DataTypes.STRING(60), allowNull: false, }, telefono: { type: DataTypes.STRING(15), allowNull: true, defaultValue: null, }, direccion: { type: DataTypes.STRING(200), allowNull: true, defaultValue: null, }, fechaInicio: { type: DataTypes.DATE, allowNull: false, }, fechaFin: { type: DataTypes.DATE, allowNull: false, }, fechaLiberacion: { type: DataTypes.DATE, allowNull: true, defaultValue: null, }, fechaNacimiento: { type: DataTypes.DATE, allowNull: true, defaultValue: null, }, carpeta: { type: DataTypes.STRING(60), allowNull: false, }, cartaAceptacion: { type: DataTypes.STRING(60), allowNull: false, }, cartaTermino: { type: DataTypes.STRING(60), allowNull: true, defaultValue: null, }, informeGlobal: { type: DataTypes.STRING(60), allowNull: true, defaultValue: null, }, programaInterno: { type: DataTypes.STRING(250), allowNull: true, defaultValue: null, }, profesor: { type: DataTypes.STRING(50), allowNull: true, defaultValue: null, }, vistoBuenoAcatlan: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null, }, }, { sequelize, modelName: 'Servicio', tableName: 'servicio', timestamps: true, } ); Servicio.belongsTo(Usuario, { foreignKey: { name: 'idUsuario', type: DataTypes.INTEGER, allowNull: false, }, }); Servicio.belongsTo(Carrera, { foreignKey: { name: 'idCarrera', type: DataTypes.INTEGER, allowNull: false, }, }); Servicio.belongsTo(Status, { foreignKey: { name: 'idStatus', type: DataTypes.INTEGER, allowNull: false, defaultValue: 1, }, }); Servicio.belongsTo(Programa, { foreignKey: { name: 'idPrograma', type: DataTypes.INTEGER, allowNull: false, }, }); Servicio.belongsTo(CuestionarioAlumno, { foreignKey: { name: 'idCuestionarioAlumno', type: DataTypes.INTEGER, allowNull: true, defaultValue: null, }, }); Servicio.belongsTo(CuestionarioPrograma, { foreignKey: { name: 'idCuestionarioPrograma', type: DataTypes.INTEGER, allowNull: true, defaultValue: null, }, }); module.exports = Servicio;