instala la mayoria de catalogos
This commit is contained in:
+110
-6
@@ -71,9 +71,7 @@ const drop = async () => {
|
||||
console.log('La tabla TipoUsuario se desinstalo correctamente.'.magenta)
|
||||
|
||||
await CarreraPlantel.drop()
|
||||
console.log(
|
||||
'La tabla CarreraPlantel se desinstalo correctamente.'.magenta
|
||||
)
|
||||
console.log('La tabla CarreraPlantel se desinstalo correctamente.'.magenta)
|
||||
|
||||
await Carrera.drop()
|
||||
console.log('La tabla Carrera se desinstalo correctamente.'.magenta)
|
||||
@@ -92,9 +90,7 @@ const sync = async () => {
|
||||
console.log('La tabla Plantel se instalo correctamente.'.magenta)
|
||||
|
||||
await CarreraPlantel.sync()
|
||||
console.log(
|
||||
'La tabla CarreraPlantel se instalo correctamente.'.magenta
|
||||
)
|
||||
console.log('La tabla CarreraPlantel se instalo correctamente.'.magenta)
|
||||
|
||||
await TipoUsuario.sync()
|
||||
console.log('La tabla TipoUsuario se instalo correctamente.'.magenta)
|
||||
@@ -145,10 +141,118 @@ const sync = async () => {
|
||||
console.log('La tabla Multa se instalo correctamente.'.magenta)
|
||||
}
|
||||
|
||||
const dataTipoCarrito = async () => {
|
||||
const data = ['Chromebook', 'iPad']
|
||||
|
||||
console.log('\nInstalando catalogo tipo_carrito'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el registro ${data[i]}`.magenta)
|
||||
await TipoCarrito.create({ nombre: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataTipoMulta = async () => {
|
||||
const data = ['Servicio', 'Red']
|
||||
|
||||
console.log('\nInstalando catalogo tipo_Multa'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el registro ${data[i]}`.magenta)
|
||||
await TipoMulta.create({ nombre: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataTipoOperador = async () => {
|
||||
const data = ['admin', 'operador']
|
||||
|
||||
console.log('\nInstalando catalogo tipo_operador'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el registro ${data[i]}`.magenta)
|
||||
await TipoOperador.create({ nombre: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataTipoUsuario = async () => {
|
||||
const data = [
|
||||
'alumno_interno',
|
||||
'alumno_externo',
|
||||
'profesor_interno',
|
||||
'profesor_externo',
|
||||
]
|
||||
|
||||
console.log('\nInstalando catalogo tipo_usuario'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el registro ${data[i]}`.magenta)
|
||||
await TipoUsuario.create({ nombre: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataStatus = async () => {
|
||||
const data = ['Activo', 'Mantenimiento', 'Dañado', 'Cargando']
|
||||
|
||||
console.log('\nInstalando catalogo Status'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el registro ${data[i]}`.magenta)
|
||||
await Status.create({ status: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataMesa = async () => {
|
||||
console.log('\nInstalando catalogo Mesa'.bold.blue)
|
||||
for (let i = 1; i <= 150; i++) {
|
||||
console.log(`Se ha creado la mesa ${i}`.magenta)
|
||||
await Mesa.create({})
|
||||
}
|
||||
}
|
||||
|
||||
const dataSalon = async () => {
|
||||
const data = ['nombreUno', 'nombreDos', 'nombreTres']
|
||||
|
||||
console.log('\nInstalando catalogo Salon'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el Salon ${data[i]}`.magenta)
|
||||
await Salon.create({ salon: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
const dataHorario = async () => {
|
||||
const data = [
|
||||
'8:00-10:00',
|
||||
'10:00-12:00',
|
||||
'12:00-14:00',
|
||||
'14:00-16:00',
|
||||
'16:00-18:00',
|
||||
'18:00-20:00',
|
||||
]
|
||||
|
||||
console.log('\nInstalando catalogo Horario'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(`Se ha creado el Horario ${data[i]}`.magenta)
|
||||
await Horario.create({ horario: data[i] })
|
||||
}
|
||||
}
|
||||
|
||||
// Horario
|
||||
|
||||
// Parte
|
||||
// Carrito
|
||||
// Equipo
|
||||
// Carrera
|
||||
// CarreraPlantel
|
||||
// Plantel
|
||||
|
||||
const install = async () => {
|
||||
await drop()
|
||||
await sync()
|
||||
|
||||
await dataTipoCarrito()
|
||||
await dataTipoMulta()
|
||||
await dataTipoUsuario()
|
||||
await dataTipoOperador()
|
||||
await dataStatus()
|
||||
await dataMesa()
|
||||
await dataSalon()
|
||||
await dataHorario()
|
||||
|
||||
console.log(
|
||||
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
|
||||
)
|
||||
|
||||
@@ -38,4 +38,7 @@ CarreraPlantel.init(
|
||||
}
|
||||
)
|
||||
|
||||
CarreraPlantel.belongsTo(Carrera, { foreignKey: 'idCarrera' })
|
||||
CarreraPlantel.belongsTo(Plantel, { foreignKey: 'idPlantel' })
|
||||
|
||||
module.exports = CarreraPlantel
|
||||
|
||||
+5
-5
@@ -12,10 +12,10 @@ Mesa.init(
|
||||
autoIncrement: true,
|
||||
unique: true,
|
||||
},
|
||||
mesa: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
// mesa: {
|
||||
// type: DataTypes.STRING(50),
|
||||
// allowNull: false,
|
||||
// },
|
||||
activo: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false,
|
||||
@@ -27,7 +27,7 @@ Mesa.init(
|
||||
key: 'idStatus',
|
||||
},
|
||||
allowNull: false,
|
||||
// defaultValue: 1,
|
||||
defaultValue: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -44,7 +44,6 @@ Prestamo.init(
|
||||
key: 'idOperador',
|
||||
},
|
||||
allowNull: true,
|
||||
defaultValue: NULL,
|
||||
},
|
||||
idOperadorRegreso: {
|
||||
type: DataTypes.INTEGER,
|
||||
@@ -53,7 +52,6 @@ Prestamo.init(
|
||||
key: 'idOperador',
|
||||
},
|
||||
allowNull: true,
|
||||
defaultValue: NULL,
|
||||
},
|
||||
idEquipo: {
|
||||
type: DataTypes.INTEGER,
|
||||
@@ -62,7 +60,6 @@ Prestamo.init(
|
||||
key: 'idEquipo',
|
||||
},
|
||||
allowNull: true,
|
||||
defaultValue: NULL,
|
||||
},
|
||||
idHorario: {
|
||||
type: DataTypes.INTEGER,
|
||||
@@ -79,7 +76,6 @@ Prestamo.init(
|
||||
key: 'idMesa',
|
||||
},
|
||||
allowNull: true,
|
||||
defaultValue: NULL,
|
||||
},
|
||||
idSalon: {
|
||||
type: DataTypes.INTEGER,
|
||||
@@ -88,7 +84,6 @@ Prestamo.init(
|
||||
key: 'idSalon',
|
||||
},
|
||||
allowNull: true,
|
||||
defaultValue: NULL,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
+1
-1
@@ -27,13 +27,13 @@ Salon.init(
|
||||
key: 'idStatus',
|
||||
},
|
||||
allowNull: false,
|
||||
defaultValue: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'Salon',
|
||||
tableName: 'salon',
|
||||
timestamps: false,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user