Base a medias
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Alumno extends Model {}
|
||||
Alumno.init(
|
||||
{
|
||||
idAlumno: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
numeroCuenta: {
|
||||
type: DataTypes.STRING(10),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
fechaNacimiento: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
nombre: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
apellidoMaterno: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
apellidoPaterno: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Alumno',
|
||||
tableName: 'alumno',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
module.exports = Alumno;
|
||||
@@ -0,0 +1,27 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Carrera extends Model {}
|
||||
Carrera.init(
|
||||
{
|
||||
idCarrera: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
carrera: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Carrera',
|
||||
tableName: 'carrera',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = Carrera;
|
||||
@@ -0,0 +1,46 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const Carrera = require('./Carrera');
|
||||
const Periodo = require('./Periodo');
|
||||
|
||||
class CarreraPeriodo extends Model {}
|
||||
CarreraPeriodo.init(
|
||||
{
|
||||
idCarreraPeriodo: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
vistoBueno: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: true,
|
||||
defaultValue: false
|
||||
}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'CarreraPeriodo',
|
||||
tableName: 'carrera_periodo',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
CarreraPeriodo.belongsTo(Carrera, {
|
||||
foreignKey: {
|
||||
name: 'idCarrera',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
CarreraPeriodo.belongsTo(Periodo, {
|
||||
foreignKey: {
|
||||
name: 'idPeriodo',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = CarreraPeriodo;
|
||||
@@ -0,0 +1,41 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const CarreraPeriodo = require('./CarreraPeriodo');
|
||||
const Grupo = require('./Grupo');
|
||||
|
||||
class CarreraPeriodoGrupo extends Model {}
|
||||
CarreraPeriodoGrupo.init(
|
||||
{
|
||||
idCarreraPeriodoGrupo: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'CarreraPeriodoGrupo',
|
||||
tableName: 'carrera_periodo_grupo',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
CarreraPeriodoGrupo.belongsTo(CarreraPeriodo, {
|
||||
foreignKey: {
|
||||
name: 'idCarreraPeriodo',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
CarreraPeriodoGrupo.belongsTo(Grupo, {
|
||||
foreignKey: {
|
||||
name: 'idGrupo',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = CarreraPeriodoGrupo;
|
||||
@@ -0,0 +1,60 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const TipoCuestionario = require('./TipoCuestionario');
|
||||
const Usuario = require('./Usuario');
|
||||
|
||||
|
||||
class Cuestionario extends Model {}
|
||||
Cuestionario.init(
|
||||
{
|
||||
idCuestionario: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
fechaInicio: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
fechaFin: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
titulo: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
descripcion: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Cuestionario',
|
||||
tableName: 'cuestionario',
|
||||
timestamps: true,
|
||||
createdAt: true,
|
||||
updatedAt: false,
|
||||
}
|
||||
);
|
||||
|
||||
Cuestionario.belongsTo(Usuario, {
|
||||
foreignKey: {
|
||||
name: 'idUsuario',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
Cuestionario.belongsTo(TipoCuestionario, {
|
||||
foreignKey: {
|
||||
name: 'idTipoCuestionario',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = Cuestionario;
|
||||
@@ -0,0 +1,41 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const Carrera = require('./Carrera');
|
||||
const Cuestionario = require('./Cuestionario');
|
||||
|
||||
class CuestionarioCarrera extends Model {}
|
||||
CuestionarioCarrera.init(
|
||||
{
|
||||
idCuestionarioCarrera: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'CuestionarioCarrera',
|
||||
tableName: 'cuestionario_carrera',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
CuestionarioCarrera.belongsTo(Carrera, {
|
||||
foreignKey: {
|
||||
name: 'idCarrera',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
CuestionarioCarrera.belongsTo(Cuestionario, {
|
||||
foreignKey: {
|
||||
name: 'idCuestionario',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = CuestionarioCarrera;
|
||||
@@ -0,0 +1,27 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Grupo extends Model {}
|
||||
Grupo.init(
|
||||
{
|
||||
idGrupo: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
grupo: {
|
||||
type: DataTypes.STRING(10),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Grupo',
|
||||
tableName: 'grupo',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = Grupo;
|
||||
@@ -0,0 +1,50 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const CarreraPeriodoGrupo = require('./CarreraPeriodoGrupo');
|
||||
const Materia = require('./Materia');
|
||||
const Trabajador = require('./Trabajador');
|
||||
|
||||
class GrupoMateria extends Model {}
|
||||
GrupoMateria.init(
|
||||
{
|
||||
idGrupoMateria: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'GrupoMateria',
|
||||
tableName: 'grupo_materia',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
GrupoMateria.belongsTo(CarreraPeriodoGrupo, {
|
||||
foreignKey: {
|
||||
name: 'idCarreraPeriodoGrupo',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
GrupoMateria.belongsTo(Trabajador, {
|
||||
foreignKey: {
|
||||
name: 'idProfesor',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
GrupoMateria.belongsTo(Materia, {
|
||||
foreignKey: {
|
||||
name: 'idMateria',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = GrupoMateria;
|
||||
@@ -0,0 +1,27 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Materia extends Model {}
|
||||
Materia.init(
|
||||
{
|
||||
idMateria: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
materia: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Materia',
|
||||
tableName: 'materia',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = Materia;
|
||||
@@ -0,0 +1,31 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class Periodo extends Model {}
|
||||
Periodo.init(
|
||||
{
|
||||
idPeriodo: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
periodo: {
|
||||
type: DataTypes.STRING(15),
|
||||
allowNull: false,
|
||||
},
|
||||
activo: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Periodo',
|
||||
tableName: 'periodo',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = Periodo;
|
||||
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
@@ -0,0 +1,27 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class TipoCuestionario extends Model {}
|
||||
TipoCuestionario.init(
|
||||
{
|
||||
idTipoCuestionario: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
tipoCuestionario: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'TipoCuestionario',
|
||||
tableName: 'tipo_cuestionario',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = TipoCuestionario;
|
||||
@@ -0,0 +1,27 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
|
||||
class TipoPregunta extends Model {}
|
||||
TipoPregunta.init(
|
||||
{
|
||||
idTipoPregunta: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
tipoPregunta: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'TipoPregunta',
|
||||
tableName: 'tipo_pregunta',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = TipoPregunta;
|
||||
@@ -0,0 +1,57 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const TipoUsuario = require('./TipoUsuario');
|
||||
|
||||
class Trabajador extends Model {}
|
||||
Trabajador.init(
|
||||
{
|
||||
idTrabajador: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
numeroTrabajador: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
nombre: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
apellidoMaterno: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
apellidoPaterno: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
},
|
||||
rfc: {
|
||||
type: DataTypes.STRING(7),
|
||||
allowNull: false,
|
||||
},
|
||||
homoclave: {
|
||||
type: DataTypes.STRING(3),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Trabajador',
|
||||
tableName: 'trabajador',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
Trabajador.belongsTo(TipoUsuario, {
|
||||
foreignKey: {
|
||||
name: 'idTipoUsuario',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = Trabajador;
|
||||
@@ -22,15 +22,6 @@ Usuario.init(
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
nombre: {
|
||||
type: DataTypes.STRING(70),
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
activo: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
const { DataTypes, Model } = require('sequelize');
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const Carrera = require('./Carrera');
|
||||
const Usuario = require('./Usuario');
|
||||
|
||||
class UsuarioCarrera extends Model {}
|
||||
UsuarioCarrera.init(
|
||||
{
|
||||
idUsuarioCarrera: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'UsuarioCarrera',
|
||||
tableName: 'usuario_carrera',
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
||||
|
||||
UsuarioCarrera.belongsTo(Carrera, {
|
||||
foreignKey: {
|
||||
name: 'idCarrera',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
UsuarioCarrera.belongsTo(Usuario, {
|
||||
foreignKey: {
|
||||
name: 'idUsuario',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = UsuarioCarrera;
|
||||
Reference in New Issue
Block a user