manejo de usuarios

This commit is contained in:
2022-04-19 20:43:49 -05:00
parent a55f45cafd
commit 153f2da1f7
21 changed files with 922 additions and 56 deletions

1
.gitignore vendored
View File

@@ -35,6 +35,7 @@ build/Release
# Dependency directories
node_modules/
uploads/
jspm_packages/
# Typescript v1 declaration files

View File

@@ -59,7 +59,7 @@
<template
slot="title"
>
<div class="photo"><img src="img/mdchaparror.png" /></div>
<div class="photo"><img :src=this.$store.state.auth.userData.image.secure_url /></div>
<b class="caret d-none d-lg-block d-xl-block"></b>
<p class="d-lg-none">Log out</p>
</template>
@@ -125,13 +125,15 @@ export default {
this.showMenu = !this.showMenu;
},
salir(){
localStorage.clear('auth');
this.$notify({
type: "danger",
icon: "tim-icons icon-alert-circle-exc",
message: "Sesión cerrada"
});
$nuxt.$router.push('/login');
this.$store.dispatch("salir");
}
}
};

View File

@@ -58,6 +58,17 @@
}"
>
</sidebar-item>
<sidebar-item
:link="{
name: 'Usuarios',
icon: 'tim-icons icon-single-02',
path: '/users',
}"
>
</sidebar-item>
</template>
</side-bar>
<!--Share plugin (for demo purposes). You can remove it if don't plan on using it-->

View File

@@ -0,0 +1,11 @@
//If the user does not have a token, we send it to login
//si el usuario no tiene token lo enviamos a login
export default function({ store, redirect }) {
if (store.state.auth.userData.role !="ADMIN") {
return redirect("/compras");
}
}

View File

@@ -61,8 +61,8 @@ export default {
// Axios module configuration (https://go.nuxtjs.dev/config-axios)
axios: {
//baseURL: "http://192.168.1.111:4000/api"
//baseURL:"http://localhost:4000/api"
// baseURL:"https://finanzasm.herokuapp.com/api"
// baseURL:process.env.BASE_URL
baseURL:"https://finanzasm.herokuapp.com/api"
},
/*

View File

@@ -119,6 +119,7 @@
<select class="form-control" v-model="newItem.tipo">
<option>Cuota</option>
<option>Abono Capital</option>
<option>Intereses</option>
</select>
</base-input>
<base-button
@@ -134,13 +135,16 @@
<card>
<div class="row">
<div class="col-4">
<div class="col-3">
<b>Total Cuotas: </b> {{ formatMoneda(totalCuotas) }}
</div>
<div class="col-4">
<div class="col-3">
<b>Total Abonos a Capital:</b> <span>{{ formatMoneda(totalAbonos) }} </span>
</div>
<div class="col-4">
<div class="col-3">
<b>Total Intereses:</b> <span>{{ formatMoneda(totalIntereses) }} </span>
</div>
<div class="col-3">
<b
>Total:<span :class="[total < 0 ? 'text-danger' : 'text-success']">
{{ formatMoneda(total) }}</span
@@ -189,6 +193,7 @@ export default {
Creditos: [],
totalCuotas: 0,
totalAbonos: 0,
totalIntereses: 0,
total: 0,
};
},
@@ -283,7 +288,11 @@ export default {
(acc, x) => (x.tipo === "Abono Capital" ? acc + Number(x.valor) : acc),
0
);
this.total = this.totalCuotas + this.totalAbonos;
this.totalIntereses = this.selectedCredito.datos.reduce(
(acc, x) => (x.tipo === "Intereses" ? acc + Number(x.valor) : acc),
0
);
this.total = this.totalCuotas + this.totalAbonos + this.totalIntereses;
},
formatMoneda(dato) {
var num = dato;

View File

@@ -60,6 +60,7 @@
</template>
<script>
export default {
middleware: "notAuthenticated",
layout: "auth",
data() {
@@ -71,10 +72,19 @@ export default {
},
};
},
created() {
$nuxt.$router.push("/login")
},
methods: {
register() {
let formData = new FormData();
formData.append("user", JSON.stringify(this.user));
this.$axios
.post("/register", this.user)
.post("/register", formData,{
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((res) => {
this.$notify({
type: "success",

View File

@@ -4,12 +4,15 @@
<card>
<div class="row">
<Badge type="info" class="col-6 p-1 rounded-pill"
<Badge type="info" class="col-4 p-1 rounded-pill"
>Total Ingresos: <br /><b>{{ formatMoneda(ingresos) }}</b></Badge
>
<Badge type="primary" class="col-6 p-1 rounded-pill"
<Badge type="primary" class="col-4 p-1 rounded-pill"
>Total Gastos: <br /><b>{{ formatMoneda(compras) }}</b></Badge
>
<Badge :type="[(ingresos - compras) < 0 ? 'danger' :'success']" class="col-4 p-1 rounded-pill"
>Saldo: <br /><b>{{ formatMoneda(ingresos - compras) }}</b></Badge
>
</div>
<div class="chart-area" style="height: 300px">
<highchart

218
APP/pages/users.vue Normal file
View File

@@ -0,0 +1,218 @@
<template>
<div>
<card class="col-12">
<el-table
:data="Users"
border
empty-text="No hay Ingresos registrados"
stripe
style="width: 100%"
>
<el-TableColumn type="expand">
<template slot-scope="props">
<p>Nombre: {{ props.row.name }}</p>
<p>Correo: {{ props.row.email }}</p>
<p>Permisos: {{ props.row.role }}</p>
<div class="imagen"><img :src=props.row.image.secure_url width="200" height="200" /></div>
</template>
</el-TableColumn>
<el-TableColumn prop="name" label="Nombre" sortable></el-TableColumn>
<el-TableColumn prop="email" label="Correo" sortable></el-TableColumn>
<el-TableColumn prop="role" label="Permisos" sortable></el-TableColumn>
<el-TableColumn fixed="right">
<div slot-scope="{ row, $index }">
<el-tooltip content="Delete" effect="light">
<base-button
type="danger"
icon
size="sm"
class="btn-link"
@click="deleteUser(row._id)"
>
<i class="el-icon-delete-solid"></i>
</base-button>
</el-tooltip>
</div>
</el-TableColumn>
</el-table>
</card>
<card class="card-login card-white">
<template slot="header">
<h1 class="card-title">Nuevo usuario </h1>
</template>
<div>
<base-input
name="name"
v-model="user.name"
placeholder="Name"
addon-left-icon="tim-icons icon-badge"
required
>
</base-input>
<base-input
name="email"
v-model="user.email"
placeholder="Email"
addon-left-icon="tim-icons icon-email-85"
>
</base-input>
<base-input
name="password"
v-model="user.password"
type="password"
placeholder="Password"
addon-left-icon="tim-icons icon-lock-circle"
>
</base-input>
<base-input>
<select class="form-control" v-model="user.role">
<option>USER</option>
<option>ADMIN</option>
</select>
</base-input>
<input ref="upload"
type="file"
name="file-upload"
multiple=""
accept="image/jpeg, image/png"
@change="handleFileUpload( $event )">
</div>
<div slot="footer">
<base-button
native-type="submit"
type="info"
class="mb-3"
size="lg"
@click="register()"
block
>
Register
</base-button>
</div>
</card>
</div>
</div>
</template>
<script>
import { Table, TableColumn } from "element-ui";
import { Select, Option } from "element-ui";
export default {
middleware: ["authenticated","authenticatedAdmin"],
components: {
[Table.name]: Table,
[TableColumn.name]: TableColumn,
[Option.name]: Option,
[Select.name]: Select,
},
//layout: "auth",
data() {
return {
user: {
name: "",
email: "",
password: "",
role:"USER",
files: "",
},
file: "",
Users: [],
};
},
mounted() {
this.getUsers();
},
methods: {
handleFileUpload(event) {
this.user.files = event.target.files[0];
},
getUsers() {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
},
};
this.$axios
.get("/users", axiosHeader)
.then((res) => {
this.Users = res.data.data;
})
.catch((e) => console.log(e));
},
register() {
let formData = new FormData();
formData.append("File", this.user.files);
this.user.files = "";
formData.append("user", JSON.stringify(this.user));
this.$axios
.post("/register", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((res) => {
this.$notify({
type: "success",
icon: "tim-icons icon-check-2",
message: "Success! Now you can login...",
});
this.user.name = "";
this.user.password = "";
this.user.email = "";
this.user.role="USER"
this.getUsers();
})
.catch((e) => {
this.$notify({
type: "danger",
icon: "tim-icons icon-alert-circle-exc",
message:
"No esta permitido la creaciøn de usuarios, o ya existe !!!",
});
});
},
deleteUser(id) {
const axiosHeader = {
headers: {
token: this.$store.state.auth.token,
},
params: {
id: id,
},
};
this.$axios
.delete("/user", axiosHeader)
.then((res) => {
this.getUsers();
})
.catch((e) => console.log(e));
},
},
};
</script>
<style>
</style>

View File

@@ -32,8 +32,8 @@ function fechaString() {
let data = new Date();
let year = data.getFullYear();
let month =
data.getMonth() + 1 < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
let day = data.getDate() < 9 ? "0" + data.getDate() : data.getDate();
data.getMonth() + 1 <= 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
let day = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
let dataF = `${year}-${month}-${day}`;
return dataF;
}
@@ -84,7 +84,11 @@ export const actions = {
localStorage.clear();
const auth = {};
this.commit("setAuth", auth);
window.location.href = "/login";
});
},
salir(){
localStorage.clear();
console.log("saliendo")
}
};

View File

@@ -1 +0,0 @@
{"_type":"export","__export_format":4,"__export_date":"2021-04-24T16:55:10.126Z","__export_source":"insomnia.desktop.app:v2021.2.2","resources":[{"_id":"req_bacdb6fe62fc41d4a66f9954983df3e0","parentId":"fld_5a6d850875f14063941b6444e621d252","modified":1618790367094,"created":1618790000482,"url":"{{ _.host }}/compras","name":"Compras","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","description":"","id":"pair_02cecdd51a164372a1c2ad69c152b9c5"},{"name":"token","value":"{{ _.token }}","description":"","id":"pair_10170987714541bdb47b153d97f6dcf2"}],"authentication":{},"metaSortKey":-1618790000482,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_5a6d850875f14063941b6444e621d252","parentId":"wrk_0a6e28fdd90541048b1ff22740cf2f76","modified":1618791644992,"created":1618786993777,"name":"API_FINANZAS","description":"","environment":{"host":"localhost:4000/api","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyRGF0YSI6eyJfaWQiOiI1Y2EwM2MzM2U4MzAzNjAwMTdmOGRkYjkiLCJuYW1lIjoiTWFydGluIENoYXBhcnJvIiwiZW1haWwiOiJtZGNoYXBhcnJvckB1bmFsLmVkdS5jbyIsImRhdGUiOiIyMDE5LTAzLTMxVDA0OjA0OjAzLjMxNVoiLCJfX3YiOjB9LCJpYXQiOjE2MTg3OTE2MDQsImV4cCI6MTYyMTM4MzYwNH0.Zib1CPwU-McovWyq1IsELxuXs1FDlFUNT3MqV_4l_LE"},"environmentPropertyOrder":{"&":["host","token"]},"metaSortKey":-1618786993777,"_type":"request_group"},{"_id":"wrk_0a6e28fdd90541048b1ff22740cf2f76","parentId":null,"modified":1618786939580,"created":1618786939580,"name":"Insomnia","description":"","scope":"collection","_type":"workspace"},{"_id":"req_9b054b25cd8a44fcb69fd3641c1d1964","parentId":"fld_5a6d850875f14063941b6444e621d252","modified":1618791602686,"created":1618788181720,"url":"{{ _.host }}/login","name":"Login","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\":\"mdchaparror@unal.edu.co\",\n\t\"password\":\"un260874\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","description":"","id":"pair_e165853035d54b15ab880335e6c239b4"}],"authentication":{},"metaSortKey":-1618788181720,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_462c83a2830a45a88e220ad467729798","parentId":"fld_5a6d850875f14063941b6444e621d252","modified":1618791147728,"created":1618787053177,"url":"{{ _.host }}/register","name":"Register","description":"Registro de usuarios","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\":\"Prueba\",\n\t\"password\":\"un260874\",\n\t\"email\":\"mmunevar@gmail.com\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_4fae4b5f40e34c3a9405688cf351928e"}],"authentication":{},"metaSortKey":-1618787053178,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_90e649a7f8f53834ad95ba7c68334fc9919b0028","parentId":"wrk_0a6e28fdd90541048b1ff22740cf2f76","modified":1618786939670,"created":1618786939670,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1618786939670,"_type":"environment"},{"_id":"jar_90e649a7f8f53834ad95ba7c68334fc9919b0028","parentId":"wrk_0a6e28fdd90541048b1ff22740cf2f76","modified":1618786939676,"created":1618786939676,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"spc_54809161a8294aa3ac1b5699085bb91d","parentId":"wrk_0a6e28fdd90541048b1ff22740cf2f76","modified":1618786939584,"created":1618786939584,"fileName":"Insomnia","contents":"","contentType":"yaml","_type":"api_spec"}]}

View File

@@ -23,6 +23,7 @@ app.use(express.urlencoded({
app.set('port',process.env.PORT || 4000);
app.use(cors());
app.use(express.static('public'))
//Rutas
app.use('/api',require('./routes/resumen'));
app.use('/api',require('./routes/users'));
@@ -43,19 +44,7 @@ app.listen(app.get('port') ,() => console.log("service startes, listening on the
//Mongo conecction
var uri;
if(process.env.NODE_ENV=='development'){
uri=process.env.MONGOOSE_URI_LOCAL
}
else{
uri=process.env.MONGOOSE_URI_PRODUCCION
}
uri=process.env.MONGOOSE_URI
const options={
useNewUrlParser:true,
useCreateIndex:true,

View File

@@ -3,7 +3,7 @@ const jwt = require('jsonwebtoken')
let checkAuth = (req,res,next)=>{
let token = req.get('token');
jwt.verify(token,"api finanzas mdchaparror @4050#",(err,decoded)=>{
jwt.verify(token,process.env.TOKEN_SECRET,(err,decoded)=>{
if(err){
return res.status(401).json({

View File

@@ -5,7 +5,12 @@ const UserSchema=new Schema({
name: {type:String,required:true},
email: {type:String, required:true},
password:{type:String, required:true},
date: {type: Date, default: Date.now}
date: {type: Date, default: Date.now},
role: {type: String,default:"USER",enum:["USER","ADMIN"]},
image: {
secure_url: {type: String, default:"https://res.cloudinary.com/mdchaparror/image/upload/v1650399265/avatars/user.jpg"},
public_id: String
}
});
UserSchema.methods.encryptPassword = async (password)=>{
const salt=await bscryptjs.genSalt(10);
@@ -19,6 +24,4 @@ UserSchema.methods.matchPassword=async function (password){
const User = mongoose.model('Users',UserSchema);
module.exports = User

530
package-lock.json generated
View File

@@ -1420,6 +1420,12 @@
"defer-to-connect": "^1.0.1"
}
},
"@tootallnate/once": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
"optional": true
},
"@types/bson": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz",
@@ -1456,6 +1462,18 @@
"negotiator": "0.6.2"
}
},
"acorn": {
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"optional": true
},
"acorn-walk": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"optional": true
},
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -1580,6 +1598,15 @@
"dev": true,
"optional": true
},
"ast-types": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz",
"integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==",
"optional": true,
"requires": {
"tslib": "^2.0.1"
}
},
"async-each": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
@@ -1855,6 +1882,14 @@
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
"busboy": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz",
"integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==",
"requires": {
"dicer": "0.3.0"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
@@ -2026,6 +2061,30 @@
"mimic-response": "^1.0.0"
}
},
"cloudinary": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/cloudinary/-/cloudinary-1.29.0.tgz",
"integrity": "sha512-twqQvC5R5/RHenDVCbGc3ebww/HB/lBaxgoyy2aW2O/5bTzK7VbGpYsTGyV5zoiodlK8Z9SO0my9Gv92y+3K+g==",
"requires": {
"cloudinary-core": "^2.10.2",
"core-js": "3.6.5",
"lodash": "^4.17.11",
"proxy-agent": "^5.0.0",
"q": "^1.5.1"
},
"dependencies": {
"core-js": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz",
"integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA=="
}
}
},
"cloudinary-core": {
"version": "2.12.3",
"resolved": "https://registry.npmjs.org/cloudinary-core/-/cloudinary-core-2.12.3.tgz",
"integrity": "sha512-Ll4eDzcrIVn4zCttMh3Mdi+KNz07p5EEjBT2PQSRx8Eok1lKPt3uBBenOk/w88RKK3B8SFIWcEe/mN4BHQ0p8A=="
},
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
@@ -2212,6 +2271,12 @@
"integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==",
"dev": true
},
"data-uri-to-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz",
"integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==",
"optional": true
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
@@ -2242,6 +2307,12 @@
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"dev": true
},
"deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"optional": true
},
"defer-to-connect": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz",
@@ -2302,6 +2373,18 @@
}
}
},
"degenerator": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.2.tgz",
"integrity": "sha512-c0mef3SNQo56t6urUU6tdQAs+ThoD0o9B9MJ8HEt7NQcGEILCRFqQb7ZbP9JAv+QF1Ky5plydhMR/IrqWDm+TQ==",
"optional": true,
"requires": {
"ast-types": "^0.13.2",
"escodegen": "^1.8.1",
"esprima": "^4.0.0",
"vm2": "^3.9.8"
}
},
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -2327,6 +2410,14 @@
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
},
"dicer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz",
"integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==",
"requires": {
"streamsearch": "0.1.2"
}
},
"dot-prop": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
@@ -2444,11 +2535,43 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"escodegen": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",
"integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",
"optional": true,
"requires": {
"esprima": "^4.0.1",
"estraverse": "^4.2.0",
"esutils": "^2.0.2",
"optionator": "^0.8.1",
"source-map": "~0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"optional": true
}
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"optional": true
},
"estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"optional": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
},
"etag": {
"version": "1.8.1",
@@ -2530,6 +2653,14 @@
"vary": "~1.1.2"
}
},
"express-fileupload": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-1.3.1.tgz",
"integrity": "sha512-LD1yabD3exmWIFujKGDnT1rmxSomaqQSlUvzIsrA1ZgwCJ6ci7lg2YHFGM3Q6DfK+Yk0gAVU7GWLE7qDMwZLkw==",
"requires": {
"busboy": "^0.3.1"
}
},
"extend-shallow": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
@@ -2624,6 +2755,18 @@
}
}
},
"fast-levenshtein": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"optional": true
},
"file-uri-to-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz",
"integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==",
"optional": true
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -2706,6 +2849,16 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs-extra": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@@ -2732,6 +2885,42 @@
"dev": true,
"optional": true
},
"ftp": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
"integrity": "sha1-kZfYYa2BQvPmPVqDv+TFn3MwiF0=",
"optional": true,
"requires": {
"readable-stream": "1.1.x",
"xregexp": "2.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"optional": true
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"optional": true,
"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=",
"optional": true
}
}
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -2812,6 +3001,63 @@
"pump": "^3.0.0"
}
},
"get-uri": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz",
"integrity": "sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg==",
"optional": true,
"requires": {
"@tootallnate/once": "1",
"data-uri-to-buffer": "3",
"debug": "4",
"file-uri-to-path": "2",
"fs-extra": "^8.1.0",
"ftp": "^0.3.10"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"optional": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"optional": true,
"requires": {
"graceful-fs": "^4.1.6"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"optional": true
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"optional": true
}
}
},
"get-value": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
@@ -2878,8 +3124,7 @@
"graceful-fs": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
"dev": true
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ=="
},
"has": {
"version": "1.0.3",
@@ -3003,6 +3248,34 @@
"toidentifier": "1.0.0"
}
},
"http-proxy-agent": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
"optional": true,
"requires": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"optional": true
}
}
},
"https-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
@@ -3073,6 +3346,12 @@
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==",
"dev": true
},
"ip": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
"optional": true
},
"ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
@@ -3375,6 +3654,15 @@
"minimist": "^1.2.5"
}
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"jsonwebtoken": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
@@ -3448,6 +3736,16 @@
"package-json": "^6.3.0"
}
},
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
"integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
"optional": true,
"requires": {
"prelude-ls": "~1.1.2",
"type-check": "~0.3.2"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
@@ -3461,8 +3759,7 @@
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.debounce": {
"version": "4.0.8",
@@ -3912,6 +4209,12 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"netmask": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
"integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
"optional": true
},
"node-addon-api": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz",
@@ -4136,6 +4439,20 @@
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
"integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA=="
},
"optionator": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
"integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
"optional": true,
"requires": {
"deep-is": "~0.1.3",
"fast-levenshtein": "~2.0.6",
"levn": "~0.3.0",
"prelude-ls": "~1.1.2",
"type-check": "~0.3.2",
"word-wrap": "~1.2.3"
}
},
"p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
@@ -4166,6 +4483,51 @@
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"dev": true
},
"pac-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz",
"integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==",
"optional": true,
"requires": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4",
"get-uri": "3",
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "5",
"pac-resolver": "^5.0.0",
"raw-body": "^2.2.0",
"socks-proxy-agent": "5"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"optional": true
}
}
},
"pac-resolver": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.0.tgz",
"integrity": "sha512-H+/A6KitiHNNW+bxBKREk2MCGSxljfqRX76NjummWEYIat7ldVXRU3dhRIE3iXZ0nvGBk6smv3nntxKkzRL8NA==",
"optional": true,
"requires": {
"degenerator": "^3.0.1",
"ip": "^1.1.5",
"netmask": "^2.0.1"
}
},
"package-json": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
@@ -4275,6 +4637,12 @@
"dev": true,
"optional": true
},
"prelude-ls": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
"optional": true
},
"prepend-http": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
@@ -4295,6 +4663,60 @@
"ipaddr.js": "1.9.1"
}
},
"proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz",
"integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==",
"optional": true,
"requires": {
"agent-base": "^6.0.0",
"debug": "4",
"http-proxy-agent": "^4.0.0",
"https-proxy-agent": "^5.0.0",
"lru-cache": "^5.1.1",
"pac-proxy-agent": "^5.0.0",
"proxy-from-env": "^1.0.0",
"socks-proxy-agent": "^5.0.0"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
"optional": true,
"requires": {
"yallist": "^3.0.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"optional": true
},
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"optional": true
}
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"optional": true
},
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
@@ -4320,6 +4742,11 @@
"escape-goat": "^2.0.0"
}
},
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
@@ -4697,6 +5124,12 @@
"resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
"integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
},
"smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"optional": true
},
"snapdragon": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@@ -4814,6 +5247,44 @@
}
}
},
"socks": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
"integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
"optional": true,
"requires": {
"ip": "^1.1.5",
"smart-buffer": "^4.2.0"
}
},
"socks-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz",
"integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==",
"optional": true,
"requires": {
"agent-base": "^6.0.2",
"debug": "4",
"socks": "^2.3.3"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"optional": true
}
}
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@@ -4906,6 +5377,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": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
@@ -5087,6 +5563,21 @@
"nopt": "~1.0.10"
}
},
"tslib": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==",
"optional": true
},
"type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
"integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
"optional": true,
"requires": {
"prelude-ls": "~1.1.2"
}
},
"type-fest": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
@@ -5182,6 +5673,11 @@
"crypto-random-string": "^2.0.0"
}
},
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -5306,6 +5802,16 @@
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"vm2": {
"version": "3.9.9",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.9.tgz",
"integrity": "sha512-xwTm7NLh/uOjARRBs8/95H0e8fT3Ukw5D/JJWhxMbhKzNh1Nu981jQKvkep9iKYNxzlVrdzD0mlBGkDKZWprlw==",
"optional": true,
"requires": {
"acorn": "^8.7.0",
"acorn-walk": "^8.2.0"
}
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -5368,6 +5874,12 @@
"string-width": "^4.0.0"
}
},
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
"optional": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@@ -5391,6 +5903,12 @@
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
"dev": true
},
"xregexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
"integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=",
"optional": true
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",

View File

@@ -12,11 +12,14 @@
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"cloudinary": "^1.29.0",
"colors": "^1.4.0",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-fileupload": "^1.3.1",
"fs-extra": "^10.0.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.12.4",
"mongoose-unique-validator": "^2.0.3",

View File

@@ -22,7 +22,7 @@ router.get("/categoria", checkAuth, async (req, res) => {
const {name, icon} = req.body;
const user= req.userData._id;
var categoria = await Categoria.findOne({ name: name });
var categoria = await Categoria.findOne({ name: name,user:user });
if (categoria) {
return res.status(500).json({ status: "fail", error: "Categoria existente" });
@@ -61,4 +61,4 @@ router.get("/categoria", checkAuth, async (req, res) => {
});
module.exports = router;
module.exports = router;

View File

@@ -22,7 +22,7 @@ router.get("/metodo", checkAuth, async (req, res) => {
const {name, icon} = req.body;
const user= req.userData._id;
var metodo = await Metodo.findOne({ name: name });
var metodo = await Metodo.findOne({ name: name,user:user });
if (metodo) {
return res.status(500).json({ status: "fail", error: "Método de pago existente" });
@@ -61,4 +61,4 @@ router.get("/metodo", checkAuth, async (req, res) => {
});
module.exports = router;
module.exports = router;

View File

@@ -3,13 +3,28 @@ const router = express.Router();
const jwt = require("jsonwebtoken");
const bcrypt = require("bcrypt");
const User = require("../models/user");
//import User from "../models/user.js";
const {loadImage,deleteImageCloud,scaleImage} = require("../utils/cloudinary");
const { checkAuth } = require("../middlewares/authentication");
const {uploadFile} = require('../utils/uploadfiles')
const fs = require("fs-extra");
//AUTH
router.get("/users", checkAuth, async (req, res) => {
var Users;
Users = await User.find({});
return res.send({
status: "ok",
data: Users,
});
});
if (process.env.REGISTER == "true") {
router.post("/register", async (req, res) => {
const { name, email, password } = req.body;
router.post("/register", uploadFile,async (req, res) => {
const { name, email, password } = JSON.parse(req.body.user);
const passEncrypted = bcrypt.hashSync(password, 10);
const newUser = new User({
@@ -20,6 +35,7 @@ if (process.env.REGISTER == "true") {
const emailUser = await User.findOne({ email: email });
if (emailUser) {
deleteImage(req)
return res
.status(500)
.json({ status: "fail", error: "email already exists" });
@@ -27,6 +43,17 @@ if (process.env.REGISTER == "true") {
try {
newUser.password = await newUser.encryptPassword(password);
if (req.files.File) {
console.log(req.files.File.tempFilePath);
const result = await loadImage(req.files.File.tempFilePath);
newUser.image = {
public_id: result.public_id,
secure_url: result.secure_url,
};
deleteImage(req)
}
await newUser.save();
res.json({
@@ -34,23 +61,22 @@ if (process.env.REGISTER == "true") {
msg: "Usuario creado",
});
} catch (error) {
deleteImage(req)
return res
.status(500)
.json({ status: "fail", error: `internal error:${error}` });
}
});
}
else{
} else {
router.post("/register", (req, res) => {
deleteImage(req)
return res
.status(500)
.json({ status: "faill", error: `No tiene permitido crear usuarios nuevos` });
})
.status(500)
.json({
status: "faill",
error: `No tiene permitido crear usuarios nuevos`,
});
});
}
router.post("/login", async (req, res) => {
@@ -85,6 +111,27 @@ router.post("/login", async (req, res) => {
res.json(toSend);
});
router.delete("/user", checkAuth, async (req, res) => {
try {
const id = req.query.id;
const userDelete = await User.findOne({ _id: id })
const resultado = await User.deleteOne({ _id: id });
if(userDelete.image.public_id)
await deleteImageCloud(userDelete.image.public_id).catch(console.error("No existe imagen para borrar"));
return res.json({ status: "ok", data: resultado });
} catch (error) {
console.error(error);
return res.status(500).json({ status: "fail", error: error });
}
});
//CRUD USER
const deleteImage = async (req)=>{
if (req.files.File) {
await fs.unlink(req.files.File.tempFilePath);
}
}
module.exports = router;

29
utils/cloudinary.js Normal file
View File

@@ -0,0 +1,29 @@
var cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
secure: true
});
const loadImage = async (filepath) =>{
return await cloudinary.uploader.upload(filepath,{
folder:'avatars'
})
}
const scaleImage = async (filepath) =>{
return await cloudinary.image(filepath,{
width: 70, height: 53, crop: "scale"
})
}
const deleteImageCloud = async (publicId) => {
return await cloudinary.uploader.destroy(publicId)
}
module.exports.loadImage = loadImage
module.exports.scaleImage = scaleImage
module.exports.deleteImageCloud = deleteImageCloud

9
utils/uploadfiles.js Normal file
View File

@@ -0,0 +1,9 @@
const fileUpload = require('express-fileupload')
const uploadFile = fileUpload({
useTempFiles: true,
tempFileDir: './uploads',
parseNested: true
})
module.exports.uploadFile =uploadFile