Files
servicio_social_api/server/db/tablas/Servicio.js
T
2020-11-16 12:47:46 -06:00

150 lines
3.0 KiB
JavaScript

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,
},
nombre: {
type: DataTypes.STRING(30),
allowNull: false,
},
correo: {
type: DataTypes.STRING(30),
allowNull: false,
},
telefono: {
type: DataTypes.STRING(10),
allowNull: true,
defaultValue: null,
},
direccion: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: null,
},
fechaInicio: {
type: DataTypes.DATE,
allowNull: false,
},
fechaFin: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
},
fechaNacimiento: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
},
carpeta: {
type: DataTypes.STRING(30),
allowNull: false,
},
cartaAceptacion: {
type: DataTypes.STRING(30),
allowNull: false,
},
cartaTermino: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: null,
},
informeGlobal: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: null,
},
programaInterno: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: null,
},
profesor: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: null,
},
vistoBuenoAcatlan: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
},
},
{
sequelize,
modelName: 'Servicio',
tableName: 'servicio',
timestamps: false,
}
);
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;