subri fotos
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
.env
|
||||
carpeta
|
||||
upload/*
|
||||
src/upload/*
|
||||
Generated
+115
@@ -122,6 +122,11 @@
|
||||
"picomatch": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"append-field": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
|
||||
"integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY="
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
|
||||
@@ -267,6 +272,43 @@
|
||||
"fill-range": "^7.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
|
||||
},
|
||||
"busboy": {
|
||||
"version": "0.2.14",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
|
||||
"integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=",
|
||||
"requires": {
|
||||
"dicer": "0.2.5",
|
||||
"readable-stream": "1.1.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.1.14",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.1",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "~0.10.x"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||
@@ -409,6 +451,17 @@
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"concat-stream": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
|
||||
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^2.2.2",
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"configstore": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz",
|
||||
@@ -533,6 +586,38 @@
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
|
||||
},
|
||||
"dicer": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz",
|
||||
"integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=",
|
||||
"requires": {
|
||||
"readable-stream": "1.1.x",
|
||||
"streamsearch": "0.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.1.14",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.1",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "~0.10.x"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"dot-prop": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
|
||||
@@ -1172,6 +1257,21 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"multer": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz",
|
||||
"integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==",
|
||||
"requires": {
|
||||
"append-field": "^1.0.0",
|
||||
"busboy": "^0.2.11",
|
||||
"concat-stream": "^1.5.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"object-assign": "^4.1.1",
|
||||
"on-finished": "^2.3.0",
|
||||
"type-is": "^1.6.4",
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"needle": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/needle/-/needle-2.5.2.tgz",
|
||||
@@ -1685,6 +1785,11 @@
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
||||
},
|
||||
"streamsearch": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
|
||||
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
@@ -1814,6 +1919,11 @@
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"typedarray": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
||||
},
|
||||
"typedarray-to-buffer": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
|
||||
@@ -2006,6 +2116,11 @@
|
||||
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"express": "^4.17.1",
|
||||
"mariadb": "^2.4.2",
|
||||
"moment": "^2.29.0",
|
||||
"multer": "^1.4.2",
|
||||
"sequelize": "^6.3.5",
|
||||
"validator": "^13.1.17"
|
||||
},
|
||||
|
||||
@@ -35,12 +35,30 @@ const equipo = async (body) => {
|
||||
{ idEquipo: { [Op.not]: null } },
|
||||
],
|
||||
},
|
||||
include: [{ model: Equipo }],
|
||||
include: [
|
||||
{ model: Horario, where: { idHorario } },
|
||||
{
|
||||
model: Equipo,
|
||||
include: [
|
||||
{
|
||||
model: Carrito,
|
||||
include: [{ model: TipoCarrito, where: { idTipoCarrito } }],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
.then(async (res) => {
|
||||
let idEquipo = await Equipo.findAll({
|
||||
where: { idStatus: 1 },
|
||||
include: [
|
||||
{ model: Status, where: { idStatus: 1 } },
|
||||
{
|
||||
model: Carrito,
|
||||
where: { kiosko },
|
||||
include: [{ model: TipoCarrito, where: { idTipoCarrito } }],
|
||||
},
|
||||
],
|
||||
order: [['updatedAt', 'ASC']],
|
||||
}).then((res2) => {
|
||||
for (let i = 0; i < res2.length; i++) {
|
||||
|
||||
@@ -3,7 +3,7 @@ const bcrypt = require('bcrypt')
|
||||
const validador = require('../validador')
|
||||
const Usuario = require('../../db/tables/Usuario')
|
||||
|
||||
const create = async (body) => {
|
||||
const create = async (body, file) => {
|
||||
let idUsuario = await validador.validarId(body.idUsuario).then((res) => res)
|
||||
let password = await validador
|
||||
.validarTexto(body.password)
|
||||
@@ -38,7 +38,7 @@ const create = async (body) => {
|
||||
apMaterno,
|
||||
correo,
|
||||
telefono,
|
||||
identificacion: '',
|
||||
identificacion: file.path,
|
||||
foto: '',
|
||||
idTipoUsuario,
|
||||
idCarreraPlantel,
|
||||
|
||||
+78
-64
@@ -1,5 +1,6 @@
|
||||
const colors = require('colors')
|
||||
const { Op } = require('sequelize')
|
||||
const moment = require('moment')
|
||||
const csv = require('csv-parser')
|
||||
const fs = require('fs')
|
||||
const Carrito = require('./tables/Carrito')
|
||||
@@ -75,8 +76,18 @@ const dataStatus = async () => {
|
||||
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({})
|
||||
let now = moment()
|
||||
let repetir = true
|
||||
|
||||
while (repetir) {
|
||||
let newNow = moment()
|
||||
|
||||
if (now.second() !== newNow.second()) {
|
||||
console.log(`Se ha creado la mesa ${i}`.magenta)
|
||||
await Mesa.create({})
|
||||
repetir = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +106,18 @@ const dataSalon = async () => {
|
||||
|
||||
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] })
|
||||
let now = moment()
|
||||
let repetir = true
|
||||
|
||||
while (repetir) {
|
||||
let newNow = moment()
|
||||
|
||||
if (now.second() !== newNow.second()) {
|
||||
console.log(`Se ha creado el Salon ${data[i]}`.magenta)
|
||||
await Salon.create({ salon: data[i] })
|
||||
repetir = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,29 +206,14 @@ const dataCarreraPlantel = async () => {
|
||||
|
||||
console.log('\nInstalando catalogo CarreraPlantel'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
await CarreraPlantel.findOne({
|
||||
where: {
|
||||
[Op.and]: [
|
||||
{ idPlantel: Number(data[i].plantel) },
|
||||
{ idCarrera: Number(data[i].carrera) },
|
||||
],
|
||||
},
|
||||
console.log(
|
||||
`Se ha creado la CarreraPlantel con carrera ${data[i].carrera} y plantel ${data[i].plantel}`
|
||||
.magenta
|
||||
)
|
||||
await CarreraPlantel.create({
|
||||
idCarrera: data[i].carrera,
|
||||
idPlantel: data[i].plantel,
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res) {
|
||||
console.log(
|
||||
`Se ha creado la CarreraPlantel con carrera ${data[i].carrera} y plantel ${data[i].plantel}`
|
||||
.magenta
|
||||
)
|
||||
await CarreraPlantel.create({
|
||||
idCarrera: data[i].carrera,
|
||||
idPlantel: data[i].plantel,
|
||||
})
|
||||
} else console.log('Repetido')
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,46 +224,54 @@ const dataEquipo = async () => {
|
||||
|
||||
console.log('\nInstalando catalogo Equipo'.bold.blue)
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let tipo
|
||||
let tipo = data[i].Tipo === 'CHROMEBOOK' ? 1 : 3
|
||||
let now = moment()
|
||||
let repetir = true
|
||||
|
||||
if (data[i].Tipo === 'CHROMEBOOK') tipo = 1
|
||||
else if (data[i].Tipo === 'LAPTOP') tipo = 3
|
||||
|
||||
await Carrito.findOne({
|
||||
where: {
|
||||
[Op.and]: [{ sobrenombre: data[i].Carrito }, { idTipoCarrito: tipo }],
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
let idCarrito
|
||||
|
||||
if (!res) {
|
||||
console.log(
|
||||
`\nSe ha creado el Carrito ${data[i].Carrito} de tipo ${data[i].Tipo}`
|
||||
.magenta
|
||||
)
|
||||
await Carrito.create({
|
||||
sobrenombre: data[i].Carrito,
|
||||
kiosko: 1,
|
||||
idTipoCarrito: tipo,
|
||||
}).then((res) => {
|
||||
idCarrito = res.idCarrito
|
||||
})
|
||||
} else idCarrito = res.idCarrito
|
||||
console.log(
|
||||
`Se ha creado el Equipo con noSerie ${data[i].NoSerie} noInventario ${data[i].NoInventario} sobrenombre ${data[i].Sobrenombre}`
|
||||
.magenta
|
||||
)
|
||||
await Equipo.create({
|
||||
noSerie: data[i].NoSerie,
|
||||
noInventario: data[i].NoInventario,
|
||||
sobrenombre: data[i].Sobrenombre,
|
||||
idCarrito: idCarrito,
|
||||
while (repetir) {
|
||||
let newNow = moment()
|
||||
if (now.second() !== newNow.second()) {
|
||||
await Carrito.findOne({
|
||||
where: {
|
||||
[Op.and]: [
|
||||
{ sobrenombre: data[i].Carrito },
|
||||
{ idTipoCarrito: tipo },
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
.then(async (res) => {
|
||||
let idCarrito
|
||||
|
||||
if (!res) {
|
||||
console.log(
|
||||
`\nSe ha creado el Carrito ${data[i].Carrito} de tipo ${data[i].Tipo}`
|
||||
.magenta
|
||||
)
|
||||
await Carrito.create({
|
||||
sobrenombre: data[i].Carrito,
|
||||
kiosko: 1,
|
||||
idTipoCarrito: tipo,
|
||||
}).then((res) => {
|
||||
idCarrito = res.idCarrito
|
||||
})
|
||||
} else idCarrito = res.idCarrito
|
||||
console.log(
|
||||
`Se ha creado el Equipo con noSerie ${data[i].NoSerie} noInventario ${data[i].NoInventario} sobrenombre ${data[i].Sobrenombre}`
|
||||
.magenta
|
||||
)
|
||||
await Equipo.create({
|
||||
noSerie: data[i].NoSerie,
|
||||
noInventario: data[i].NoInventario,
|
||||
sobrenombre: data[i].Sobrenombre,
|
||||
idCarrito: idCarrito,
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
repetir = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Parte
|
||||
|
||||
@@ -10,10 +10,9 @@ const regreso = require('../controller/prestamo/regreso')
|
||||
const route = '/prestamo'
|
||||
|
||||
app.get(`${route}`, (req, res) => {
|
||||
return get()
|
||||
.then((data) => {
|
||||
res.status(data.code).json({ prestamos: data.data })
|
||||
})
|
||||
return get().then((data) => {
|
||||
res.status(data.code).json({ prestamos: data.data })
|
||||
})
|
||||
})
|
||||
|
||||
app.get(`${route}/status`, (req, res) => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const express = require('express')
|
||||
const multer = require('multer')
|
||||
const app = express()
|
||||
let upload = multer({ dest: 'src/upload' })
|
||||
const get = require('../controller/usuario/get')
|
||||
const create = require('../controller/usuario/create')
|
||||
const login = require('../controller/usuario/login')
|
||||
@@ -16,8 +18,8 @@ app.get(`${route}`, (req, res) => {
|
||||
})
|
||||
})
|
||||
|
||||
app.post(`${route}/create`, (req, res) => {
|
||||
return create(req.body)
|
||||
app.post(`${route}/create`, upload.single('identificacion'), (req, res) => {
|
||||
return create(JSON.parse(req.body.usuario, req.file))
|
||||
.then((data) => {
|
||||
res.status(data.code).json({ message: data.message })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user