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)
|
console.log('La tabla TipoUsuario se desinstalo correctamente.'.magenta)
|
||||||
|
|
||||||
await CarreraPlantel.drop()
|
await CarreraPlantel.drop()
|
||||||
console.log(
|
console.log('La tabla CarreraPlantel se desinstalo correctamente.'.magenta)
|
||||||
'La tabla CarreraPlantel se desinstalo correctamente.'.magenta
|
|
||||||
)
|
|
||||||
|
|
||||||
await Carrera.drop()
|
await Carrera.drop()
|
||||||
console.log('La tabla Carrera se desinstalo correctamente.'.magenta)
|
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)
|
console.log('La tabla Plantel se instalo correctamente.'.magenta)
|
||||||
|
|
||||||
await CarreraPlantel.sync()
|
await CarreraPlantel.sync()
|
||||||
console.log(
|
console.log('La tabla CarreraPlantel se instalo correctamente.'.magenta)
|
||||||
'La tabla CarreraPlantel se instalo correctamente.'.magenta
|
|
||||||
)
|
|
||||||
|
|
||||||
await TipoUsuario.sync()
|
await TipoUsuario.sync()
|
||||||
console.log('La tabla TipoUsuario se instalo correctamente.'.magenta)
|
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)
|
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 () => {
|
const install = async () => {
|
||||||
await drop()
|
await drop()
|
||||||
await sync()
|
await sync()
|
||||||
|
|
||||||
|
await dataTipoCarrito()
|
||||||
|
await dataTipoMulta()
|
||||||
|
await dataTipoUsuario()
|
||||||
|
await dataTipoOperador()
|
||||||
|
await dataStatus()
|
||||||
|
await dataMesa()
|
||||||
|
await dataSalon()
|
||||||
|
await dataHorario()
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
|
'\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
|
module.exports = CarreraPlantel
|
||||||
|
|||||||
+5
-5
@@ -12,10 +12,10 @@ Mesa.init(
|
|||||||
autoIncrement: true,
|
autoIncrement: true,
|
||||||
unique: true,
|
unique: true,
|
||||||
},
|
},
|
||||||
mesa: {
|
// mesa: {
|
||||||
type: DataTypes.STRING(50),
|
// type: DataTypes.STRING(50),
|
||||||
allowNull: false,
|
// allowNull: false,
|
||||||
},
|
// },
|
||||||
activo: {
|
activo: {
|
||||||
type: DataTypes.BOOLEAN,
|
type: DataTypes.BOOLEAN,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
@@ -27,7 +27,7 @@ Mesa.init(
|
|||||||
key: 'idStatus',
|
key: 'idStatus',
|
||||||
},
|
},
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
// defaultValue: 1,
|
defaultValue: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ Prestamo.init(
|
|||||||
key: 'idOperador',
|
key: 'idOperador',
|
||||||
},
|
},
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
defaultValue: NULL,
|
|
||||||
},
|
},
|
||||||
idOperadorRegreso: {
|
idOperadorRegreso: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
@@ -53,7 +52,6 @@ Prestamo.init(
|
|||||||
key: 'idOperador',
|
key: 'idOperador',
|
||||||
},
|
},
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
defaultValue: NULL,
|
|
||||||
},
|
},
|
||||||
idEquipo: {
|
idEquipo: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
@@ -62,7 +60,6 @@ Prestamo.init(
|
|||||||
key: 'idEquipo',
|
key: 'idEquipo',
|
||||||
},
|
},
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
defaultValue: NULL,
|
|
||||||
},
|
},
|
||||||
idHorario: {
|
idHorario: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
@@ -79,7 +76,6 @@ Prestamo.init(
|
|||||||
key: 'idMesa',
|
key: 'idMesa',
|
||||||
},
|
},
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
defaultValue: NULL,
|
|
||||||
},
|
},
|
||||||
idSalon: {
|
idSalon: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
@@ -88,7 +84,6 @@ Prestamo.init(
|
|||||||
key: 'idSalon',
|
key: 'idSalon',
|
||||||
},
|
},
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
defaultValue: NULL,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -27,13 +27,13 @@ Salon.init(
|
|||||||
key: 'idStatus',
|
key: 'idStatus',
|
||||||
},
|
},
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
|
defaultValue: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sequelize,
|
sequelize,
|
||||||
modelName: 'Salon',
|
modelName: 'Salon',
|
||||||
tableName: 'salon',
|
tableName: 'salon',
|
||||||
timestamps: false,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user