tablas programas y entidad
This commit is contained in:
@@ -12,9 +12,7 @@ const create = (body) => {
|
||||
console.log(res)
|
||||
return { mensaje: 'Se creo un operador correctamente' }
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error(err)
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
module.exports = create
|
||||
|
||||
@@ -20,9 +20,7 @@ const create = (body) => {
|
||||
console.log(res)
|
||||
return { mensaje: 'Se creo un usuario correctamente' }
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error(err)
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
module.exports = create
|
||||
|
||||
+13
-2
@@ -1,16 +1,21 @@
|
||||
const colors = require('colors')
|
||||
const Carrito = require('./tables/Carrito')
|
||||
const Carrera = require('./tables/Carrera')
|
||||
const CarreraPlantel = require('./tables/CarreraPlantel')
|
||||
const Plantel = require('./tables/Plantel')
|
||||
const Carrito = require('./tables/Carrito')
|
||||
// const Entidad = require('./tables/Entidad')
|
||||
const Equipo = require('./tables/Equipo')
|
||||
const Horario = require('./tables/Horario')
|
||||
const Mesa = require('./tables/Mesa')
|
||||
const Multa = require('./tables/Multa')
|
||||
const Operador = require('./tables/Operador')
|
||||
const Parte = require('./tables/Parte')
|
||||
const Plantel = require('./tables/Plantel')
|
||||
const Prestamo = require('./tables/Prestamo')
|
||||
// const Programa = require('./tables/Programa')
|
||||
// const ProgramaEntidad = require('./tables/ProgramaEntidad')
|
||||
// const ProgramaNivel = require('./tables/ProgramaNivel')
|
||||
const Reporte = require('./tables/Reporte')
|
||||
const ReporteParte = require('./tables/ReporteParte')
|
||||
const Salon = require('./tables/Salon')
|
||||
const Status = require('./tables/Status')
|
||||
const TipoCarrito = require('./tables/TipoCarrito')
|
||||
@@ -28,6 +33,9 @@ const drop = async () => {
|
||||
await TipoMulta.drop()
|
||||
console.log('La tabla TipoMulta se desinstalo correctamente.'.magenta)
|
||||
|
||||
await ReporteParte.drop()
|
||||
console.log('La tabla ReporteParte se desinstalo correctamente.'.magenta)
|
||||
|
||||
await Reporte.drop()
|
||||
console.log('La tabla Reporte se desinstalo correctamente.'.magenta)
|
||||
|
||||
@@ -134,6 +142,9 @@ const sync = async () => {
|
||||
await Reporte.sync()
|
||||
console.log('La tabla Reporte se instalo correctamente.'.magenta)
|
||||
|
||||
await ReporteParte.sync()
|
||||
console.log('La tabla ReporteParte se instalo correctamente.'.magenta)
|
||||
|
||||
await TipoMulta.sync()
|
||||
console.log('La tabla TipoMulta se instalo correctamente.'.magenta)
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const { DataTypes, Model } = require('sequelize')
|
||||
const sequelize = require('../../config/sequelize.conf')
|
||||
|
||||
class Entidad extends Model {}
|
||||
Entidad.init(
|
||||
{
|
||||
idEntidad: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
entidad: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Entidad',
|
||||
tableName: 'entidad',
|
||||
timestamps: false,
|
||||
}
|
||||
)
|
||||
|
||||
module.exports = Entidad
|
||||
@@ -0,0 +1,26 @@
|
||||
const { DataTypes, Model } = require('sequelize')
|
||||
const sequelize = require('../../config/sequelize.conf')
|
||||
|
||||
class Programa extends Model {}
|
||||
Programa.init(
|
||||
{
|
||||
idPrograma: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
programa: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Programa',
|
||||
tableName: 'programa',
|
||||
timestamps: false,
|
||||
}
|
||||
)
|
||||
|
||||
module.exports = Programa
|
||||
@@ -0,0 +1,32 @@
|
||||
const { DataTypes, Model } = require('sequelize')
|
||||
const sequelize = require('../../config/sequelize.conf')
|
||||
const Entidad = require('./Entidad')
|
||||
const Programa = require('./Programa')
|
||||
|
||||
class ProgramaEntidad extends Model {}
|
||||
ProgramaEntidad.init(
|
||||
{
|
||||
idProgramaEntidad: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
unique: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'ProgramaEntidad',
|
||||
tableName: 'programa_entidad',
|
||||
}
|
||||
)
|
||||
|
||||
ProgramaEntidad.belongsTo(Entidad, {
|
||||
foreignKey: { type: DataTypes.INTEGER, name: 'idEntidad', allowNull: false },
|
||||
})
|
||||
|
||||
ProgramaEntidad.belongsTo(Programa, {
|
||||
foreignKey: { type: DataTypes.INTEGER, name: 'idPrograma', allowNull: false },
|
||||
})
|
||||
|
||||
module.exports = ProgramaEntidad
|
||||
@@ -0,0 +1,31 @@
|
||||
const { DataTypes, Model } = require('sequelize')
|
||||
const sequelize = require('../../config/sequelize.conf')
|
||||
const Programa = require('./Programa')
|
||||
|
||||
class ProgramaNivel extends Model {}
|
||||
ProgramaNivel.init(
|
||||
{
|
||||
idPrograma: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
},
|
||||
nivel: {
|
||||
type: DataTypes.STRING(1),
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'ProgramaNivel',
|
||||
tableName: 'programa_nivel',
|
||||
}
|
||||
)
|
||||
|
||||
ProgramaNivel.belongsTo(Programa, {
|
||||
foreignKey: {
|
||||
name: 'idPrograma',
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = ProgramaNivel
|
||||
@@ -0,0 +1,36 @@
|
||||
const { DataTypes, Model } = require('sequelize')
|
||||
const sequelize = require('../../config/sequelize.conf')
|
||||
const Reporte = require('./Reporte')
|
||||
const Parte = require('./Parte')
|
||||
|
||||
class ReporteParte extends Model {}
|
||||
ReporteParte.init(
|
||||
{
|
||||
idReporte: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'ReporteParte',
|
||||
tableName: 'reporte_parte',
|
||||
}
|
||||
)
|
||||
|
||||
ReporteParte.belongsTo(Reporte, {
|
||||
foreignKey: {
|
||||
name: 'idReporte',
|
||||
},
|
||||
})
|
||||
|
||||
ReporteParte.belongsTo(Parte, {
|
||||
foreignKey: {
|
||||
name: 'idParte',
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = ReporteParte
|
||||
Reference in New Issue
Block a user