Eliminando codigo redundante v3
This commit is contained in:
parent
4267b5fe0a
commit
5f1066ff03
|
@ -16,3 +16,5 @@ rules:
|
||||||
camelcase: 0
|
camelcase: 0
|
||||||
default-case: 0
|
default-case: 0
|
||||||
no-eq-null: 0
|
no-eq-null: 0
|
||||||
|
no-console: 0
|
||||||
|
no-warning-comments: 0
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
spliting.js
|
|
||||||
build
|
build
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
debug.log
|
debug.log
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"name": "Iniciar",
|
"name": "Iniciar",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/services/client/server/server.js",
|
"program": "${workspaceRoot}/services/auth/server/server.js",
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
*.csv
|
|
||||||
*.dat
|
|
||||||
*.iml
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.sublime-*
|
|
||||||
*.swo
|
|
||||||
*.swp
|
|
||||||
*.tgz
|
|
||||||
*.xml
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.strong-pm
|
|
||||||
coverage
|
|
||||||
node_modules
|
|
||||||
npm-debug.log
|
|
||||||
db.json
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"generator-loopback": {}
|
|
||||||
}
|
|
|
@ -8,20 +8,7 @@
|
||||||
"posttest": "npm run lint && nsp check"
|
"posttest": "npm run lint && nsp check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compression": "^1.0.3",
|
"md5": "^2.2.1"
|
||||||
"cors": "^2.5.2",
|
|
||||||
"helmet": "^1.3.0",
|
|
||||||
"loopback": "^3.8.0",
|
|
||||||
"loopback-boot": "^2.24.0",
|
|
||||||
"loopback-component-explorer": "^4.2.0",
|
|
||||||
"loopback-connector-mysql": "^3.0.0",
|
|
||||||
"loopback-context": "^3.1.0",
|
|
||||||
"md5": "^2.2.1",
|
|
||||||
"serve-favicon": "^2.0.1",
|
|
||||||
"strong-error-handler": "^2.1.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nsp": "^2.1.0"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(server) {
|
|
||||||
require('../../../service/boot/root.js')(server);
|
|
||||||
};
|
|
|
@ -39,17 +39,19 @@ module.exports = function(app) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let loginUrl;
|
let apiKey;
|
||||||
let continueUrl;
|
let continueUrl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let query = url.parse(req.body.location, true).query;
|
let query = url.parse(req.body.location, true).query;
|
||||||
loginUrl = applications[query.apiKey];
|
apiKey = query.apiKey;
|
||||||
continueUrl = query.continue;
|
continueUrl = query.continue;
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
apiKey = 'default';
|
||||||
if (!loginUrl)
|
continueUrl = null;
|
||||||
loginUrl = applications.default;
|
}
|
||||||
|
|
||||||
|
loginUrl = applications[apiKey];
|
||||||
|
|
||||||
res.send(JSON.stringify({
|
res.send(JSON.stringify({
|
||||||
token: token.id,
|
token: token.id,
|
||||||
|
@ -58,7 +60,7 @@ module.exports = function(app) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
function findCb(err, instance) {
|
function findCb(err, instance) {
|
||||||
if (!instance || instance.password !== md5(password)) {
|
if (err || !instance || instance.password !== md5(password)) {
|
||||||
badLogin();
|
badLogin();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"loopback-component-explorer": {
|
|
||||||
"mountPath": "/explorer"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +1,3 @@
|
||||||
{
|
{
|
||||||
"restApiRoot": "/api",
|
"port": 3000
|
||||||
"host": "0.0.0.0",
|
}
|
||||||
"port": 3000,
|
|
||||||
"aclErrorStatus": 403,
|
|
||||||
"logoutSessionsOnSensitiveChanges": true,
|
|
||||||
"remoting": {
|
|
||||||
"context": false,
|
|
||||||
"rest": {
|
|
||||||
"normalizeHttpPath": false,
|
|
||||||
"xml": false
|
|
||||||
},
|
|
||||||
"json": {
|
|
||||||
"strict": false,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"urlencoded": {
|
|
||||||
"extended": true,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"cors": false,
|
|
||||||
"handleErrors": false
|
|
||||||
},
|
|
||||||
"legacyExplorer": false
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"db": {
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"db":
|
|
||||||
{
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {
|
|
||||||
"params": {
|
|
||||||
"debug": true,
|
|
||||||
"log": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
{
|
|
||||||
"initial:before": {
|
|
||||||
"loopback#favicon": {}
|
|
||||||
},
|
|
||||||
"initial": {
|
|
||||||
"compression": {},
|
|
||||||
"cors": {
|
|
||||||
"params": {
|
|
||||||
"origin": "*",
|
|
||||||
"credentials": true,
|
|
||||||
"maxAge": 86400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#xssFilter": {},
|
|
||||||
"helmet#frameguard": {
|
|
||||||
"params": [
|
|
||||||
"deny"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"helmet#hsts": {
|
|
||||||
"params": {
|
|
||||||
"maxAge": 0,
|
|
||||||
"includeSubdomains": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#hidePoweredBy": {},
|
|
||||||
"helmet#ieNoOpen": {},
|
|
||||||
"helmet#noSniff": {},
|
|
||||||
"helmet#noCache": {
|
|
||||||
"enabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"session": {},
|
|
||||||
"auth": {},
|
|
||||||
"parse": {
|
|
||||||
"body-parser#json":{}
|
|
||||||
},
|
|
||||||
"routes": {
|
|
||||||
"loopback#rest": {
|
|
||||||
"paths": [
|
|
||||||
"${restApiRoot}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {},
|
|
||||||
"final": {
|
|
||||||
"loopback#urlNotFound": {}
|
|
||||||
},
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +1,4 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
|
||||||
"sources": [
|
|
||||||
"loopback/common/models",
|
|
||||||
"loopback/server/models",
|
|
||||||
"../../service/models",
|
|
||||||
"../common/models",
|
|
||||||
"./models"
|
|
||||||
],
|
|
||||||
"mixins": [
|
|
||||||
"loopback/common/mixins",
|
|
||||||
"loopback/server/mixins",
|
|
||||||
"../common/mixins",
|
|
||||||
"./mixins"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"user": {
|
"user": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,32 +1,5 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var loopback = require('loopback');
|
var vnLoopback = require('../../loopback/server/server.js');
|
||||||
var boot = require('loopback-boot');
|
|
||||||
var express=require('express');
|
|
||||||
var path = require('path');
|
|
||||||
var app = module.exports = loopback();
|
|
||||||
|
|
||||||
// modificado
|
var app = module.exports = vnLoopback(__dirname, true);
|
||||||
app.set('view engine', 'ejs');
|
|
||||||
app.set('views', path.join(__dirname,'../client'));
|
|
||||||
app.use(loopback.static(path.resolve(__dirname, '../client')));
|
|
||||||
app.set('applications', require('./application.json'));
|
app.set('applications', require('./application.json'));
|
||||||
// fin
|
|
||||||
|
|
||||||
app.start = function() {
|
|
||||||
return app.listen(function() {
|
|
||||||
app.emit('started');
|
|
||||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
|
||||||
console.log('Web server LOGIN listening at: %s', baseUrl);
|
|
||||||
if (app.get('loopback-component-explorer')) {
|
|
||||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
|
||||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
boot(app, __dirname, function(err) {
|
|
||||||
if (err) throw err;
|
|
||||||
if (require.main === module)
|
|
||||||
app.start();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
*.csv
|
|
||||||
*.dat
|
|
||||||
*.iml
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.sublime-*
|
|
||||||
*.swo
|
|
||||||
*.swp
|
|
||||||
*.tgz
|
|
||||||
*.xml
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.strong-pm
|
|
||||||
coverage
|
|
||||||
node_modules
|
|
||||||
npm-debug.log
|
|
||||||
db.json
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"generator-loopback": {}
|
|
||||||
}
|
|
|
@ -1,17 +1,13 @@
|
||||||
module.exports = function (iban){
|
module.exports = function(iban) {
|
||||||
|
|
||||||
if (iban == null) return true;
|
if (iban == null) return true;
|
||||||
if (typeof iban != 'string') return false;
|
if (typeof iban != 'string') return false;
|
||||||
|
|
||||||
//Se pasa a Mayusculas
|
|
||||||
iban = iban.toUpperCase();
|
iban = iban.toUpperCase();
|
||||||
//Se quita los blancos de principio y final.
|
|
||||||
iban = trim(iban);
|
iban = trim(iban);
|
||||||
iban = iban.replace(/\s/g, ""); //Y se quita los espacios en blanco dentro de la cadena
|
iban = iban.replace(/\s/g, "");
|
||||||
|
|
||||||
//La longitud debe ser siempre de 24 caracteres
|
|
||||||
if (iban.length != 24) {
|
if (iban.length != 24) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se coge las primeras dos letras y se pasan a números
|
// Se coge las primeras dos letras y se pasan a números
|
||||||
|
@ -19,27 +15,30 @@ module.exports = function (iban){
|
||||||
var letter2 = iban.substring(1, 2);
|
var letter2 = iban.substring(1, 2);
|
||||||
var num1 = getIbanNumber(letter1);
|
var num1 = getIbanNumber(letter1);
|
||||||
var num2 = getIbanNumber(letter2);
|
var num2 = getIbanNumber(letter2);
|
||||||
//Se sustituye las letras por números.
|
|
||||||
var isbanaux = String(num1) + String(num2) + iban.substring(2);
|
|
||||||
// Se mueve los 6 primeros caracteres al final de la cadena.
|
|
||||||
isbanaux = isbanaux.substring(6) + isbanaux.substring(0,6);
|
|
||||||
|
|
||||||
//Se calcula el resto, llamando a la función module97, definida más abajo
|
// Se sustituye las letras por números.
|
||||||
|
var isbanaux = String(num1) + String(num2) + iban.substring(2);
|
||||||
|
|
||||||
|
// Se mueve los 6 primeros caracteres al final de la cadena.
|
||||||
|
isbanaux = isbanaux.substring(6) + isbanaux.substring(0, 6);
|
||||||
|
|
||||||
|
// Se calcula el resto, llamando a la función module97, definida más abajo
|
||||||
var resto = module97(isbanaux);
|
var resto = module97(isbanaux);
|
||||||
if (resto == 1){
|
|
||||||
|
if (resto == 1) {
|
||||||
return true;
|
return true;
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
function module97(iban) {
|
function module97(iban) {
|
||||||
var parts = Math.ceil(iban.length/7);
|
var parts = Math.ceil(iban.length / 7);
|
||||||
var remainer = "";
|
var remainer = "";
|
||||||
|
|
||||||
for (var i = 1; i <= parts; i++) {
|
for (var i = 1; i <= parts; i++) {
|
||||||
remainer = String(parseFloat(remainer+iban.substr((i-1)*7, 7))%97);
|
remainer = String(parseFloat(remainer + iban.substr((i - 1) * 7, 7)) % 97);
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainer;
|
return remainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +47,7 @@ module.exports = function (iban){
|
||||||
return letters.search(letra) + 10;
|
return letters.search(letra) + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
function trim (text) {
|
function trim(text) {
|
||||||
return (text || "").replace( /^(\s|\u00A0)+|(\s|\u00A0)+$/g, "" );
|
return (text || "").replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, "" );
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,18 @@
|
||||||
{
|
{
|
||||||
"name": "vn-client",
|
"name": "vn-client",
|
||||||
|
"description": "Client service",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
"license": "GPL-3.0",
|
||||||
"main": "server/server.js",
|
"main": "server/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"posttest": "npm run lint && nsp check"
|
"posttest": "npm run lint && nsp check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"compression": "^1.0.3",
|
|
||||||
"cors": "^2.5.2",
|
|
||||||
"helmet": "^1.3.0",
|
|
||||||
"i18n": "^0.8.3",
|
|
||||||
"loopback": "^3.8.0",
|
|
||||||
"loopback-boot": "^2.24.0",
|
|
||||||
"loopback-component-explorer": "^4.2.0",
|
|
||||||
"loopback-connector-mysql": "^3.0.0",
|
|
||||||
"loopback-context": "^3.1.0",
|
|
||||||
"serve-favicon": "^2.0.1",
|
|
||||||
"strong-error-handler": "^2.1.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nsp": "^2.1.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.verdnatura.es/salix"
|
"url": "https://git.verdnatura.es/salix"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"dependencies": {
|
||||||
"description": "Client service"
|
"loopback-context": "^3.3.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(server) {
|
|
||||||
require('../../../service/boot/root.js')(server);
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"loopback-component-explorer": {
|
|
||||||
"mountPath": "/explorer"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +1,3 @@
|
||||||
{
|
{
|
||||||
"restApiRoot": "/api",
|
"port": 3002
|
||||||
"host": "0.0.0.0",
|
|
||||||
"port": 3002,
|
|
||||||
"aclErrorStatus": 403,
|
|
||||||
"logoutSessionsOnSensitiveChanges": true,
|
|
||||||
"remoting": {
|
|
||||||
"context": false,
|
|
||||||
"rest": {
|
|
||||||
"normalizeHttpPath": false,
|
|
||||||
"xml": false
|
|
||||||
},
|
|
||||||
"json": {
|
|
||||||
"strict": false,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"urlencoded": {
|
|
||||||
"extended": true,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"cors": false,
|
|
||||||
"handleErrors": false
|
|
||||||
},
|
|
||||||
"legacyExplorer": false
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"db": {
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"db":
|
|
||||||
{
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth":
|
|
||||||
{
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": ""
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {
|
|
||||||
"params": {
|
|
||||||
"debug": true,
|
|
||||||
"log": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
{
|
|
||||||
"initial:before": {
|
|
||||||
"loopback#favicon": {}
|
|
||||||
},
|
|
||||||
"initial": {
|
|
||||||
"compression": {},
|
|
||||||
"./middleware/cors": {},
|
|
||||||
"helmet#xssFilter": {},
|
|
||||||
"helmet#frameguard": {
|
|
||||||
"params": [
|
|
||||||
"deny"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"helmet#hsts": {
|
|
||||||
"params": {
|
|
||||||
"maxAge": 0,
|
|
||||||
"includeSubdomains": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#hidePoweredBy": {},
|
|
||||||
"helmet#ieNoOpen": {},
|
|
||||||
"helmet#noSniff": {},
|
|
||||||
"helmet#noCache": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"loopback-context#per-request": {
|
|
||||||
"params": {
|
|
||||||
"enableHttpContext": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"session": {},
|
|
||||||
"auth": {
|
|
||||||
"loopback#token": {}
|
|
||||||
},
|
|
||||||
"auth:after": {
|
|
||||||
"./middleware/currentUser": {}
|
|
||||||
},
|
|
||||||
"parse": {},
|
|
||||||
"routes": {
|
|
||||||
"loopback#rest": {
|
|
||||||
"paths": [
|
|
||||||
"${restApiRoot}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {},
|
|
||||||
"final": {
|
|
||||||
"loopback#urlNotFound": {}
|
|
||||||
},
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
var cors = require('cors');
|
|
||||||
|
|
||||||
var whitelist = ['http://localhost:8080'];
|
|
||||||
var corsOptions = {
|
|
||||||
origin: function(origin, callback){
|
|
||||||
var originIsWhitelisted = whitelist.indexOf(origin) !== -1;
|
|
||||||
callback(originIsWhitelisted ? null : 'Bad Request', originIsWhitelisted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function() {
|
|
||||||
return cors({origin: true});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
module.exports = function(options) {
|
|
||||||
return function storeCurrentUser(req, res, next) {
|
|
||||||
if (!req.accessToken) {
|
|
||||||
return next();
|
|
||||||
}
|
|
||||||
let LoopBackContext = require('loopback-context');
|
|
||||||
let loopbackContext = LoopBackContext.getCurrentContext();
|
|
||||||
if (loopbackContext) {
|
|
||||||
loopbackContext.set('currentUser', req.accessToken.userId);
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = function() {
|
|
||||||
console.log('Date time middleware triggered.');
|
|
||||||
res.json({datetime: new Date()});
|
|
||||||
};
|
|
|
@ -1,19 +1,4 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
|
||||||
"sources": [
|
|
||||||
"loopback/common/models",
|
|
||||||
"loopback/server/models",
|
|
||||||
"../../service/models",
|
|
||||||
"../common/models",
|
|
||||||
"./models"
|
|
||||||
],
|
|
||||||
"mixins": [
|
|
||||||
"loopback/common/mixins",
|
|
||||||
"loopback/server/mixins",
|
|
||||||
"../common/mixins",
|
|
||||||
"./mixins"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"user": {
|
"user": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
|
@ -28,16 +13,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACL": {
|
"ACL": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"RoleMapping": {
|
"RoleMapping": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Role": {
|
"Role": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Account": {
|
"Account": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
|
|
|
@ -1,44 +1,4 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var loopback = require('loopback');
|
var vnLoopback = require('../../loopback/server/server.js');
|
||||||
var boot = require('loopback-boot');
|
|
||||||
|
|
||||||
var app = module.exports = loopback();
|
module.exports = vnLoopback(__dirname);
|
||||||
|
|
||||||
/*i18n*/
|
|
||||||
var i18n = require("i18n");
|
|
||||||
i18n.configure({
|
|
||||||
directory: __dirname + '/i18n',
|
|
||||||
defaultLocale: "es"
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Prueba i18n */
|
|
||||||
app.get('/prueba', function (req,res){
|
|
||||||
i18n.setLocale(req.get('Accept-Language').substring(0,2));
|
|
||||||
res.send(i18n.__("Hello"));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
app.start = function() {
|
|
||||||
// start the web server
|
|
||||||
return app.listen(function() {
|
|
||||||
app.emit('started');
|
|
||||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
|
||||||
console.log('Web server listening at: %s', baseUrl);
|
|
||||||
|
|
||||||
if (app.get('loopback-component-explorer')) {
|
|
||||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
|
||||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bootstrap the application, configure models, datasources and middleware.
|
|
||||||
// Sub-apps like REST API are mounted via boot scripts.
|
|
||||||
boot(app, __dirname, function(err) {
|
|
||||||
if (err) throw err;
|
|
||||||
|
|
||||||
// start the server if `$ node server.js`
|
|
||||||
if (require.main === module)
|
|
||||||
app.start();
|
|
||||||
});
|
|
||||||
|
|
|
@ -22,10 +22,11 @@ app.start = function() {
|
||||||
database.init();
|
database.init();
|
||||||
database.testEmail();
|
database.testEmail();
|
||||||
|
|
||||||
console.log('Web server ' + settings.app().name.toUpperCase() + ' listening at: ' + servicePath);
|
let packageJson = require('./package.json');
|
||||||
console.log('Browse your REST API at: ' + servicePath + '/mailer');
|
console.log(`Web server ${packageJson.name} listening at: ${servicePath}`);
|
||||||
|
|
||||||
if (settings.app().debug) {
|
if (settings.app().debug) {
|
||||||
console.log(settings.app().name.toUpperCase() + ' service debug mode enabled');
|
console.log(`${packageJson.name} service debug mode enabled`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return listener;
|
return listener;
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# EditorConfig helps developers define and maintain consistent
|
|
||||||
# coding styles between different editors and IDEs
|
|
||||||
# http://editorconfig.org
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
|
@ -1 +0,0 @@
|
||||||
/client/
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "loopback"
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
*.csv
|
|
||||||
*.dat
|
|
||||||
*.iml
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.sublime-*
|
|
||||||
*.swo
|
|
||||||
*.swp
|
|
||||||
*.tgz
|
|
||||||
*.xml
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.strong-pm
|
|
||||||
coverage
|
|
||||||
node_modules
|
|
||||||
npm-debug.log
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"generator-loopback": {}
|
|
||||||
}
|
|
|
@ -7,23 +7,6 @@
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"posttest": "npm run lint && nsp check"
|
"posttest": "npm run lint && nsp check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"compression": "^1.0.3",
|
|
||||||
"cors": "^2.5.2",
|
|
||||||
"helmet": "^1.3.0",
|
|
||||||
"i18n": "^0.8.3",
|
|
||||||
"loopback": "^3.8.0",
|
|
||||||
"loopback-boot": "^2.24.0",
|
|
||||||
"loopback-component-explorer": "^4.2.0",
|
|
||||||
"loopback-connector-mysql": "^3.0.0",
|
|
||||||
"loopback-connector-remote": "^3.1.1",
|
|
||||||
"loopback-context": "^3.1.0",
|
|
||||||
"serve-favicon": "^2.0.1",
|
|
||||||
"strong-error-handler": "^2.1.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nsp": "^2.1.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.verdnatura.es/salix"
|
"url": "https://git.verdnatura.es/salix"
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(server) {
|
|
||||||
require('../../../service/boot/root.js')(server);
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"loopback-component-explorer": {
|
|
||||||
"mountPath": "/explorer"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +1,3 @@
|
||||||
{
|
{
|
||||||
"restApiRoot": "/api",
|
"port": 3004
|
||||||
"host": "0.0.0.0",
|
|
||||||
"port": 3004,
|
|
||||||
"remoting": {
|
|
||||||
"context": false,
|
|
||||||
"rest": {
|
|
||||||
"normalizeHttpPath": false,
|
|
||||||
"xml": false
|
|
||||||
},
|
|
||||||
"json": {
|
|
||||||
"strict": false,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"urlencoded": {
|
|
||||||
"extended": true,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"cors": false,
|
|
||||||
"handleErrors": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
"db": {
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"name": "client",
|
|
||||||
"connector": "remote",
|
|
||||||
"url": "http://localhost:3002/api"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
"db":
|
|
||||||
{
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth":
|
|
||||||
{
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": ""
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"name": "client",
|
|
||||||
"connector": "remote",
|
|
||||||
"url": "http://localhost:3002/api"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {
|
|
||||||
"params": {
|
|
||||||
"debug": true,
|
|
||||||
"log": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
{
|
|
||||||
"initial:before": {
|
|
||||||
"loopback#favicon": {}
|
|
||||||
},
|
|
||||||
"initial": {
|
|
||||||
"compression": {},
|
|
||||||
"cors": {
|
|
||||||
"params": {
|
|
||||||
"origin": true,
|
|
||||||
"credentials": true,
|
|
||||||
"maxAge": 86400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#xssFilter": {},
|
|
||||||
"helmet#frameguard": {
|
|
||||||
"params": [
|
|
||||||
"deny"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"helmet#hsts": {
|
|
||||||
"params": {
|
|
||||||
"maxAge": 0,
|
|
||||||
"includeSubdomains": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#hidePoweredBy": {},
|
|
||||||
"helmet#ieNoOpen": {},
|
|
||||||
"helmet#noSniff": {},
|
|
||||||
"helmet#noCache": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"loopback-context#per-request": {
|
|
||||||
"params": {
|
|
||||||
"enableHttpContext": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"session": {},
|
|
||||||
"auth": {
|
|
||||||
"loopback#token": {}
|
|
||||||
},
|
|
||||||
"auth:after": {
|
|
||||||
"./middleware/currentUser": {}
|
|
||||||
},
|
|
||||||
"parse": {},
|
|
||||||
"routes": {
|
|
||||||
"loopback#rest": {
|
|
||||||
"paths": [
|
|
||||||
"${restApiRoot}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {},
|
|
||||||
"final": {
|
|
||||||
"loopback#urlNotFound": {}
|
|
||||||
},
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
module.exports = function(options) {
|
|
||||||
return function storeCurrentUser(req, res, next) {
|
|
||||||
if (!req.accessToken) {
|
|
||||||
return next();
|
|
||||||
}
|
|
||||||
let LoopBackContext = require('loopback-context');
|
|
||||||
let loopbackContext = LoopBackContext.getCurrentContext();
|
|
||||||
if (loopbackContext) {
|
|
||||||
loopbackContext.set('currentUser', req.accessToken.userId);
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,19 +1,4 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
|
||||||
"sources": [
|
|
||||||
"loopback/common/models",
|
|
||||||
"loopback/server/models",
|
|
||||||
"../../service/models",
|
|
||||||
"../common/models",
|
|
||||||
"./models"
|
|
||||||
],
|
|
||||||
"mixins": [
|
|
||||||
"loopback/common/mixins",
|
|
||||||
"loopback/server/mixins",
|
|
||||||
"../common/mixins",
|
|
||||||
"./mixins"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"user": {
|
"user": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
|
@ -28,67 +13,52 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACL": {
|
"ACL": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"RoleMapping": {
|
"RoleMapping": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Role": {
|
"Role": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Account": {
|
"Account": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
"Ticket": {
|
"Ticket": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"State":{
|
"State":{
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"TicketState":{
|
"TicketState":{
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Warehouse":{
|
"Warehouse":{
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Employee":{
|
"Employee":{
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Client":{
|
"Client":{
|
||||||
"dataSource": "client",
|
"dataSource": "client"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Province":{
|
"Province":{
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Agency": {
|
"Agency": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"FakeProduction": {
|
"FakeProduction": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Message": {
|
"Message": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"MessageInbox": {
|
"MessageInbox": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
},
|
},
|
||||||
"Route": {
|
"Route": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var loopback = require('loopback');
|
var vnLoopback = require('../../loopback/server/server.js');
|
||||||
var boot = require('loopback-boot');
|
|
||||||
|
|
||||||
var app = module.exports = loopback();
|
module.exports = vnLoopback(__dirname);
|
||||||
|
|
||||||
app.start = function() {
|
|
||||||
// start the web server
|
|
||||||
return app.listen(function() {
|
|
||||||
app.emit('started');
|
|
||||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
|
||||||
console.log('Web server listening at: %s', baseUrl);
|
|
||||||
if (app.get('loopback-component-explorer')) {
|
|
||||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
|
||||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bootstrap the application, configure models, datasources and middleware.
|
|
||||||
// Sub-apps like REST API are mounted via boot scripts.
|
|
||||||
boot(app, __dirname, function(err) {
|
|
||||||
if (err) throw err;
|
|
||||||
|
|
||||||
// start the server if `$ node server.js`
|
|
||||||
if (require.main === module)
|
|
||||||
app.start();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
*.csv
|
|
||||||
*.dat
|
|
||||||
*.iml
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.sublime-*
|
|
||||||
*.swo
|
|
||||||
*.swp
|
|
||||||
*.tgz
|
|
||||||
*.xml
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.strong-pm
|
|
||||||
coverage
|
|
||||||
node_modules
|
|
||||||
npm-debug.log
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"generator-loopback": {}
|
|
||||||
}
|
|
|
@ -7,27 +7,10 @@
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"posttest": "npm run lint && nsp check"
|
"posttest": "npm run lint && nsp check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"compression": "^1.0.3",
|
|
||||||
"cors": "^2.5.2",
|
|
||||||
"helmet": "^1.3.0",
|
|
||||||
"i18n": "^0.8.3",
|
|
||||||
"loopback": "^3.8.0",
|
|
||||||
"loopback-boot": "^2.24.0",
|
|
||||||
"loopback-component-explorer": "^4.2.0",
|
|
||||||
"loopback-connector-mysql": "^3.0.0",
|
|
||||||
"loopback-connector-remote": "^3.1.1",
|
|
||||||
"loopback-context": "^3.1.0",
|
|
||||||
"serve-favicon": "^2.0.1",
|
|
||||||
"strong-error-handler": "^2.1.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nsp": "^2.1.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.verdnatura.es/salix"
|
"url": "https://git.verdnatura.es/salix"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"description": "vn-route"
|
"description": "Routes administration"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(server) {
|
|
||||||
require('../../../service/boot/root.js')(server);
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"loopback-component-explorer": {
|
|
||||||
"mountPath": "/explorer"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +1,3 @@
|
||||||
{
|
{
|
||||||
"restApiRoot": "/api",
|
"port": 3005
|
||||||
"host": "0.0.0.0",
|
|
||||||
"port": 3005,
|
|
||||||
"remoting": {
|
|
||||||
"context": false,
|
|
||||||
"rest": {
|
|
||||||
"normalizeHttpPath": false,
|
|
||||||
"xml": false
|
|
||||||
},
|
|
||||||
"json": {
|
|
||||||
"strict": false,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"urlencoded": {
|
|
||||||
"extended": true,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"cors": false,
|
|
||||||
"handleErrors": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"db": {
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"db":
|
|
||||||
{
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth":
|
|
||||||
{
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": ""
|
|
||||||
},
|
|
||||||
"vn": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {
|
|
||||||
"params": {
|
|
||||||
"debug": true,
|
|
||||||
"log": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
{
|
|
||||||
"initial:before": {
|
|
||||||
"loopback#favicon": {}
|
|
||||||
},
|
|
||||||
"initial": {
|
|
||||||
"compression": {},
|
|
||||||
"cors": {
|
|
||||||
"params": {
|
|
||||||
"origin": true,
|
|
||||||
"credentials": true,
|
|
||||||
"maxAge": 86400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#xssFilter": {},
|
|
||||||
"helmet#frameguard": {
|
|
||||||
"params": [
|
|
||||||
"deny"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"helmet#hsts": {
|
|
||||||
"params": {
|
|
||||||
"maxAge": 0,
|
|
||||||
"includeSubdomains": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#hidePoweredBy": {},
|
|
||||||
"helmet#ieNoOpen": {},
|
|
||||||
"helmet#noSniff": {},
|
|
||||||
"helmet#noCache": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"loopback-context#per-request": {
|
|
||||||
"params": {
|
|
||||||
"enableHttpContext": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"session": {},
|
|
||||||
"auth": {
|
|
||||||
"loopback#token": {}
|
|
||||||
},
|
|
||||||
"auth:after": {
|
|
||||||
"./middleware/currentUser": {}
|
|
||||||
},
|
|
||||||
"parse": {},
|
|
||||||
"routes": {
|
|
||||||
"loopback#rest": {
|
|
||||||
"paths": [
|
|
||||||
"${restApiRoot}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {},
|
|
||||||
"final": {
|
|
||||||
"loopback#urlNotFound": {}
|
|
||||||
},
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
module.exports = function(options) {
|
|
||||||
return function storeCurrentUser(req, res, next) {
|
|
||||||
if (!req.accessToken) {
|
|
||||||
return next();
|
|
||||||
}
|
|
||||||
let LoopBackContext = require('loopback-context');
|
|
||||||
let loopbackContext = LoopBackContext.getCurrentContext();
|
|
||||||
if (loopbackContext) {
|
|
||||||
loopbackContext.set('currentUser', req.accessToken.userId);
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,19 +1,4 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
|
||||||
"sources": [
|
|
||||||
"loopback/common/models",
|
|
||||||
"loopback/server/models",
|
|
||||||
"../../service/models",
|
|
||||||
"../common/models",
|
|
||||||
"./models"
|
|
||||||
],
|
|
||||||
"mixins": [
|
|
||||||
"loopback/common/mixins",
|
|
||||||
"loopback/server/mixins",
|
|
||||||
"../common/mixins",
|
|
||||||
"./mixins"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"user": {
|
"user": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
|
@ -28,16 +13,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACL": {
|
"ACL": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"RoleMapping": {
|
"RoleMapping": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Role": {
|
"Role": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Account": {
|
"Account": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
|
@ -49,7 +31,6 @@
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Agency": {
|
"Agency": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn"
|
||||||
"public": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,4 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var loopback = require('loopback');
|
var vnLoopback = require('../../loopback/server/server.js');
|
||||||
var boot = require('loopback-boot');
|
|
||||||
|
|
||||||
var app = module.exports = loopback();
|
module.exports = vnLoopback(__dirname);
|
||||||
|
|
||||||
app.start = function() {
|
|
||||||
// start the web server
|
|
||||||
return app.listen(function() {
|
|
||||||
app.emit('started');
|
|
||||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
|
||||||
console.log('Web server listening at: %s', baseUrl);
|
|
||||||
if (app.get('loopback-component-explorer')) {
|
|
||||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
|
||||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bootstrap the application, configure models, datasources and middleware.
|
|
||||||
// Sub-apps like REST API are mounted via boot scripts.
|
|
||||||
boot(app, __dirname, function(err) {
|
|
||||||
if (err) throw err;
|
|
||||||
|
|
||||||
// start the server if `$ node server.js`
|
|
||||||
if (require.main === module)
|
|
||||||
app.start();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
*.csv
|
|
||||||
*.dat
|
|
||||||
*.iml
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.sublime-*
|
|
||||||
*.swo
|
|
||||||
*.swp
|
|
||||||
*.tgz
|
|
||||||
*.xml
|
|
||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
.project
|
|
||||||
.strong-pm
|
|
||||||
coverage
|
|
||||||
node_modules
|
|
||||||
npm-debug.log
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"generator-loopback": {}
|
|
||||||
}
|
|
|
@ -8,20 +8,7 @@
|
||||||
"posttest": "npm run lint && nsp check"
|
"posttest": "npm run lint && nsp check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compression": "^1.0.3",
|
"cookie-parser": "^1.4.3"
|
||||||
"cookie-parser": "^1.4.3",
|
|
||||||
"cors": "^2.5.2",
|
|
||||||
"helmet": "^1.3.0",
|
|
||||||
"loopback": "^3.8.0",
|
|
||||||
"loopback-boot": "^2.24.0",
|
|
||||||
"loopback-component-explorer": "^4.2.0",
|
|
||||||
"loopback-connector-mysql": "^3.0.0",
|
|
||||||
"loopback-context": "^3.1.0",
|
|
||||||
"serve-favicon": "^2.0.1",
|
|
||||||
"strong-error-handler": "^2.1.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nsp": "^2.1.0"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -29,4 +16,4 @@
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"description": "Salix application service"
|
"description": "Salix application service"
|
||||||
}
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(server) {
|
|
||||||
require ('../../../service/boot/root.js')(server);
|
|
||||||
};
|
|
|
@ -1,7 +1,7 @@
|
||||||
module.exports = function (app) {
|
module.exports = function(app) {
|
||||||
let models = app.models;
|
let models = app.models;
|
||||||
|
|
||||||
app.get('/', function (req, res) {
|
app.get('/', function(req, res) {
|
||||||
let token = req.cookies.vnToken;
|
let token = req.cookies.vnToken;
|
||||||
validateToken(token, function(isValid) {
|
validateToken(token, function(isValid) {
|
||||||
if (isValid)
|
if (isValid)
|
||||||
|
@ -11,7 +11,7 @@ module.exports = function (app) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/acl', function(req, res){
|
app.get('/acl', function(req, res) {
|
||||||
let token = req.cookies.vnToken;
|
let token = req.cookies.vnToken;
|
||||||
validateToken(token, function(isValid, token) {
|
validateToken(token, function(isValid, token) {
|
||||||
if (isValid)
|
if (isValid)
|
||||||
|
@ -19,95 +19,90 @@ module.exports = function (app) {
|
||||||
else
|
else
|
||||||
sendACL(res, {});
|
sendACL(res, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/login', function (req, res) {
|
app.get('/login', function(req, res) {
|
||||||
let token = req.query.token;
|
let token = req.query.token;
|
||||||
let continueUrl = req.query.continue;
|
let continueUrl = req.query.continue;
|
||||||
|
|
||||||
validateToken(token, function(isValid) {
|
validateToken(token, function(isValid) {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
res.cookie('vnToken', token/*, {httpOnly: true}*/);
|
res.cookie('vnToken', token /* , {httpOnly: true} */);
|
||||||
res.redirect(continueUrl ? continueUrl : '/');
|
res.redirect(continueUrl ? continueUrl : '/');
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
redirectToAuth(res);
|
redirectToAuth(res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/logout', function (req, res) {
|
app.get('/logout', function(req, res) {
|
||||||
let token = req.cookies.vnToken;
|
let token = req.cookies.vnToken;
|
||||||
models.User.logout(token, function() {
|
models.User.logout(token, function() {
|
||||||
redirectToAuth(res);
|
redirectToAuth(res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateToken(tokenId, cb) {
|
function validateToken(tokenId, cb) {
|
||||||
models.AccessToken.findById(tokenId, function(err, token) {
|
models.AccessToken.findById(tokenId, function(err, token) {
|
||||||
if (token) {
|
if (token) {
|
||||||
token.validate (function (err, isValid) {
|
token.validate(function (err, isValid) {
|
||||||
cb(isValid === true, token);
|
cb(isValid === true, token);
|
||||||
});
|
});
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
cb(false);
|
cb(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendUserRole(res, token){
|
function sendUserRole(res, token) {
|
||||||
if(token.userId){
|
if (token.userId) {
|
||||||
let query = {
|
let query = {
|
||||||
"where": {
|
where: {
|
||||||
"principalId": token.userId,
|
principalId: token.userId,
|
||||||
"principalType": "USER"
|
principalType: 'USER'
|
||||||
},
|
},
|
||||||
"include": [{
|
include: [{
|
||||||
"relation": "role",
|
relation: 'role',
|
||||||
"scope": {
|
scope: {
|
||||||
"fields": ["name"]
|
fields: ['name']
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
models.RoleMapping.find(query, function(_, roles){
|
models.RoleMapping.find(query, function(_, roles) {
|
||||||
if(roles){
|
if (roles) {
|
||||||
var acl = {
|
var acl = {
|
||||||
userProfile: {},
|
userProfile: {},
|
||||||
roles: {}
|
roles: {}
|
||||||
};
|
};
|
||||||
Object.keys(roles).forEach(function(_, i){
|
Object.keys(roles).forEach(function(_, i) {
|
||||||
if(roles[i].roleId){
|
if (roles[i].roleId) {
|
||||||
let rol = roles[i].role();
|
let rol = roles[i].role();
|
||||||
acl.roles[rol.name] = true;
|
acl.roles[rol.name] = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
models.User.findById(token.userId, function(_, userProfile){
|
models.User.findById(token.userId, function(_, userProfile) {
|
||||||
//acl.userProfile = userProfile;
|
// acl.userProfile = userProfile;
|
||||||
acl.userProfile.id = userProfile.id;
|
acl.userProfile.id = userProfile.id;
|
||||||
acl.userProfile.username = userProfile.username;
|
acl.userProfile.username = userProfile.username;
|
||||||
acl.userProfile.warehouseId = 1;
|
acl.userProfile.warehouseId = 1;
|
||||||
sendACL(res, acl);
|
sendACL(res, acl);
|
||||||
});
|
});
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
sendACL(res, {});
|
sendACL(res, {});
|
||||||
});
|
});
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
sendACL(res, {});
|
sendACL(res, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectToAuth (res, continueUrl) {
|
function redirectToAuth(res, continueUrl) {
|
||||||
let authUrl = app.get('url auth');
|
let authUrl = app.get('url auth');
|
||||||
let params = {
|
let params = {
|
||||||
apiKey: app.get('api key'),
|
apiKey: app.get('api key'),
|
||||||
continue: continueUrl
|
continue: continueUrl
|
||||||
};
|
};
|
||||||
res.clearCookie ('vnToken');
|
res.clearCookie('vnToken');
|
||||||
res.redirect(`${authUrl}/?${encodeUri(params)}`);
|
res.redirect(`${authUrl}/?${encodeUri(params)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendACL(res, acl){
|
function sendACL(res, acl) {
|
||||||
let aclStr = JSON.stringify(acl);
|
let aclStr = JSON.stringify(acl);
|
||||||
res.header('Content-Type', 'application/javascript; charset=UTF-8');
|
res.header('Content-Type', 'application/javascript; charset=UTF-8');
|
||||||
res.send(`(function(window){window.salix = window.salix || {}; window.salix.acl = window.salix.acl || {}; window.salix.acl = ${aclStr}; })(window)`);
|
res.send(`(function(window){window.salix = window.salix || {}; window.salix.acl = window.salix.acl || {}; window.salix.acl = ${aclStr}; })(window)`);
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"loopback-component-explorer": {
|
|
||||||
"mountPath": "/explorer"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +1,3 @@
|
||||||
{
|
{
|
||||||
"restApiRoot": "/api",
|
"port": 3001
|
||||||
"host": "0.0.0.0",
|
|
||||||
"port": 3001,
|
|
||||||
"aclErrorStatus": 403,
|
|
||||||
"logoutSessionsOnSensitiveChanges": true,
|
|
||||||
"remoting": {
|
|
||||||
"context": false,
|
|
||||||
"rest": {
|
|
||||||
"normalizeHttpPath": false,
|
|
||||||
"xml": false
|
|
||||||
},
|
|
||||||
"json": {
|
|
||||||
"strict": false,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"urlencoded": {
|
|
||||||
"extended": true,
|
|
||||||
"limit": "100kb"
|
|
||||||
},
|
|
||||||
"cors": false,
|
|
||||||
"handleErrors": false
|
|
||||||
},
|
|
||||||
"legacyExplorer": false
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"db": {
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"connectTimeout": 20000,
|
|
||||||
"acquireTimeout": 20000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"db":
|
|
||||||
{
|
|
||||||
"name": "db",
|
|
||||||
"connector": "memory",
|
|
||||||
"file": "db.json"
|
|
||||||
},
|
|
||||||
"auth":
|
|
||||||
{
|
|
||||||
"name": "mysql",
|
|
||||||
"connector": "mysql",
|
|
||||||
"database": "salix",
|
|
||||||
"debug": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": ""
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {
|
|
||||||
"params": {
|
|
||||||
"debug": true,
|
|
||||||
"log": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
{
|
|
||||||
"initial:before": {
|
|
||||||
"loopback#favicon": {}
|
|
||||||
},
|
|
||||||
"initial": {
|
|
||||||
"compression": {},
|
|
||||||
"cors": {
|
|
||||||
"params": {
|
|
||||||
"origin": true,
|
|
||||||
"credentials": true,
|
|
||||||
"maxAge": 86400
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#xssFilter": {},
|
|
||||||
"helmet#frameguard": {
|
|
||||||
"params": [
|
|
||||||
"deny"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"helmet#hsts": {
|
|
||||||
"params": {
|
|
||||||
"maxAge": 0,
|
|
||||||
"includeSubdomains": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"helmet#hidePoweredBy": {},
|
|
||||||
"helmet#ieNoOpen": {},
|
|
||||||
"helmet#noSniff": {},
|
|
||||||
"helmet#noCache": {
|
|
||||||
"enabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"session": {},
|
|
||||||
"auth": {},
|
|
||||||
"parse": {},
|
|
||||||
"routes": {
|
|
||||||
"loopback#rest": {
|
|
||||||
"paths": [
|
|
||||||
"${restApiRoot}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {},
|
|
||||||
"final": {
|
|
||||||
"loopback#urlNotFound": {}
|
|
||||||
},
|
|
||||||
"final:after": {
|
|
||||||
"strong-error-handler": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +1,4 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
|
||||||
"sources": [
|
|
||||||
"loopback/common/models",
|
|
||||||
"loopback/server/models",
|
|
||||||
"../../service/models",
|
|
||||||
"../common/models",
|
|
||||||
"./models"
|
|
||||||
],
|
|
||||||
"mixins": [
|
|
||||||
"loopback/common/mixins",
|
|
||||||
"loopback/server/mixins",
|
|
||||||
"../common/mixins",
|
|
||||||
"./mixins"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"user": {
|
"user": {
|
||||||
"dataSource": "auth"
|
"dataSource": "auth"
|
||||||
},
|
},
|
||||||
|
@ -28,15 +13,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACL": {
|
"ACL": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"RoleMapping": {
|
"RoleMapping": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
|
||||||
},
|
},
|
||||||
"Role": {
|
"Role": {
|
||||||
"dataSource": "auth",
|
"dataSource": "auth"
|
||||||
"public": false
|
},
|
||||||
|
"Account": {
|
||||||
|
"dataSource": "auth"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,11 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var loopback = require('loopback');
|
|
||||||
var boot = require('loopback-boot');
|
|
||||||
var path = require('path');
|
|
||||||
var cookieParser = require('cookie-parser');
|
var cookieParser = require('cookie-parser');
|
||||||
|
var vnLoopback = require('../../loopback/server/server.js');
|
||||||
|
|
||||||
var app = module.exports = loopback();
|
var app = module.exports = vnLoopback(__dirname, true);
|
||||||
|
|
||||||
// TODO: ver donde se almacena
|
// TODO: ver donde se almacena
|
||||||
app.set('api key','salix')
|
app.set('api key', 'salix');
|
||||||
app.set('url auth', '/auth');
|
app.set('url auth', '/auth');
|
||||||
|
|
||||||
app.set('view engine', 'ejs');
|
|
||||||
app.set('views',path.join(__dirname,'../client'));
|
|
||||||
app.use(loopback.static(path.resolve(__dirname, '../client')));
|
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
|
|
||||||
app.start = function() {
|
|
||||||
// start the web server
|
|
||||||
return app.listen(function() {
|
|
||||||
app.emit('started');
|
|
||||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
|
||||||
console.log('Web server listening at: %s', baseUrl);
|
|
||||||
if (app.get('loopback-component-explorer')) {
|
|
||||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
|
||||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bootstrap the application, configure models, datasources and middleware.
|
|
||||||
// Sub-apps like REST API are mounted via boot scripts.
|
|
||||||
boot(app, __dirname, function(err) {
|
|
||||||
if (err) throw err;
|
|
||||||
|
|
||||||
// start the server if `$ node server.js`
|
|
||||||
if (require.main === module)
|
|
||||||
app.start();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(app) {
|
|
||||||
let models = app.models();
|
|
||||||
models.forEach(function(model) {
|
|
||||||
let settings = model.settings;
|
|
||||||
let acls = settings.acls;
|
|
||||||
|
|
||||||
if (!acls)
|
|
||||||
model.settings.acls = acls = [];
|
|
||||||
|
|
||||||
acls.push({
|
|
||||||
accessType: '*',
|
|
||||||
principalType: 'ROLE',
|
|
||||||
principalId: '$everyone',
|
|
||||||
permission: 'DENY'
|
|
||||||
});
|
|
||||||
acls.push({
|
|
||||||
accessType: '*',
|
|
||||||
principalType: 'ROLE',
|
|
||||||
principalId: 'root',
|
|
||||||
permission: 'ALLOW'
|
|
||||||
});
|
|
||||||
|
|
||||||
if (settings.validateUpsert === undefined)
|
|
||||||
settings.validateUpsert = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
app.enableAuth();
|
|
||||||
|
|
||||||
var router = app.loopback.Router();
|
|
||||||
router.get('/status', app.loopback.status());
|
|
||||||
app.use(router);
|
|
||||||
|
|
||||||
require('./validations')(app);
|
|
||||||
/*
|
|
||||||
let ds = app.dataSources.auth;
|
|
||||||
//ds.automigrate(function() {
|
|
||||||
ds.autoupdate(function() {
|
|
||||||
console.log('Tables migrated!');
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
};
|
|
|
@ -1,58 +0,0 @@
|
||||||
module.exports = function(server) {
|
|
||||||
function toJson(object) {
|
|
||||||
let json = {};
|
|
||||||
|
|
||||||
for (let prop in object) {
|
|
||||||
let value = object[prop];
|
|
||||||
|
|
||||||
switch (typeof value) {
|
|
||||||
case 'object':
|
|
||||||
if (value instanceof RegExp)
|
|
||||||
json[prop] = value.source;
|
|
||||||
break;
|
|
||||||
case 'function':
|
|
||||||
json[prop] = value.toString();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
json[prop] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
server.get('/validations', function(req, res) {
|
|
||||||
let json = {};
|
|
||||||
let models = server.models;
|
|
||||||
|
|
||||||
for (let modelName in models) {
|
|
||||||
let model = models[modelName];
|
|
||||||
let validations = model.validations;
|
|
||||||
let jsonValidations = {};
|
|
||||||
|
|
||||||
for (let fieldName in validations) {
|
|
||||||
let jsonField = [];
|
|
||||||
|
|
||||||
for (let validation of validations[fieldName]) {
|
|
||||||
let options = validation.options;
|
|
||||||
|
|
||||||
if ((options && options.async) ||
|
|
||||||
(validation.validation == 'custom' && !validation.isExportable))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
jsonField.push(toJson(validation));
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonValidations[fieldName] = jsonField;
|
|
||||||
}
|
|
||||||
|
|
||||||
json[modelName] = {
|
|
||||||
properties: model.definition.rawProperties,
|
|
||||||
validations: jsonValidations
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
res.set('Content-Type', 'application/json');
|
|
||||||
res.send(JSON.stringify(json));
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = Agency => {
|
|
||||||
let serverFilter = {where: {isManaged: {neq: 0}}};
|
|
||||||
Agency.defineScope(serverFilter);
|
|
||||||
};
|
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = function(Self) {
|
|
||||||
Self.defineScope({where: {isManaged: {neq: 0}}});
|
|
||||||
};
|
|
|
@ -1,7 +0,0 @@
|
||||||
module.exports = function(Account) {
|
|
||||||
// Validations
|
|
||||||
|
|
||||||
Account.validatesUniquenessOf('name', {
|
|
||||||
message: 'Ya existe un usuario con ese nombre'
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Account",
|
|
||||||
"base": "PersistedModel",
|
|
||||||
"validateUpsert": true,
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"active": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"type": "date"
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = function(Self) {
|
|
||||||
require('../methods/agency/list.js')(Self);
|
|
||||||
};
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Agency",
|
|
||||||
"base": "VnModel",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"id": true,
|
|
||||||
"type": "Number",
|
|
||||||
"forceId": false
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "String",
|
|
||||||
"required": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Country",
|
|
||||||
"base": "VnModel",
|
|
||||||
"validateUpsert": true,
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "Number",
|
|
||||||
"id": true,
|
|
||||||
"description": "Identifier"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"inCee": {
|
|
||||||
"type": "Number"
|
|
||||||
},
|
|
||||||
"code": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"currency": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Currency",
|
|
||||||
"foreignKey": "currencyFk"
|
|
||||||
},
|
|
||||||
"realCountry": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Country",
|
|
||||||
"foreignKey": "realCountryFk"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$everyone",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Employee",
|
|
||||||
"base": "VnModel",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "Number",
|
|
||||||
"id": true,
|
|
||||||
"description": "Identifier"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"surname": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"user": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Account",
|
|
||||||
"foreignKey": "userFk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Province",
|
|
||||||
"base": "VnModel",
|
|
||||||
"validateUpsert": true,
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "Number",
|
|
||||||
"id": true,
|
|
||||||
"description": "Identifier"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"country": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Country",
|
|
||||||
"foreignKey": "countryFk"
|
|
||||||
},
|
|
||||||
"warehouse": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Warehouse",
|
|
||||||
"foreignKey": "warehouseFk"
|
|
||||||
},
|
|
||||||
"zone": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Zone",
|
|
||||||
"foreignKey": "zoneFk"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$everyone",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "user",
|
|
||||||
"base": "User",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"id": true,
|
|
||||||
"type": "Number",
|
|
||||||
"forceId": false
|
|
||||||
},
|
|
||||||
"username":{
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,220 +0,0 @@
|
||||||
module.exports = function(Self) {
|
|
||||||
Self.setup = function() {
|
|
||||||
Self.super_.setup.call(this);
|
|
||||||
|
|
||||||
let disableMethods = {
|
|
||||||
create: true,
|
|
||||||
replaceOrCreate: true,
|
|
||||||
patchOrCreate: true,
|
|
||||||
upsert: true,
|
|
||||||
updateOrCreate: true,
|
|
||||||
exists: true,
|
|
||||||
find: true,
|
|
||||||
findOne: true,
|
|
||||||
findById: true,
|
|
||||||
deleteById: true,
|
|
||||||
replaceById: true,
|
|
||||||
updateAttributes: false,
|
|
||||||
createChangeStream: true,
|
|
||||||
updateAll: true,
|
|
||||||
upsertWithWhere: true,
|
|
||||||
count: true
|
|
||||||
};
|
|
||||||
for (let method in disableMethods) {
|
|
||||||
// this.disableRemoteMethod(method, disableMethods[method]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.defineScope = function(serverFilter) {
|
|
||||||
this.remoteMethodCtx('list', {
|
|
||||||
accepts: [
|
|
||||||
{
|
|
||||||
arg: 'filter',
|
|
||||||
type: 'object',
|
|
||||||
description: 'Filter defining where'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
returns: {
|
|
||||||
type: [this.modelName],
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
verb: 'get',
|
|
||||||
path: '/list'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.list = function(ctx, clientFilter, cb) {
|
|
||||||
var clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : [];
|
|
||||||
var serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : [];
|
|
||||||
var fields = clientFields.filter(itemC => {
|
|
||||||
return serverFields.some(itemS => itemS === itemC);
|
|
||||||
});
|
|
||||||
|
|
||||||
var and = [];
|
|
||||||
(clientFilter && clientFilter.where) && and.push(clientFilter.where);
|
|
||||||
(serverFilter && serverFilter.where) && and.push(serverFilter.where);
|
|
||||||
|
|
||||||
var order;
|
|
||||||
var limit;
|
|
||||||
|
|
||||||
if (clientFilter && clientFilter.order)
|
|
||||||
order = clientFilter.order;
|
|
||||||
else if (serverFilter && serverFilter.order)
|
|
||||||
order = serverFilter.order;
|
|
||||||
|
|
||||||
if (serverFilter && serverFilter.limit)
|
|
||||||
limit = serverFilter.limit;
|
|
||||||
else if (clientFilter && clientFilter.limit)
|
|
||||||
limit = clientFilter.limit;
|
|
||||||
|
|
||||||
var filter = {order: order, limit: limit};
|
|
||||||
filter.where = (and.length > 0) && {and: and};
|
|
||||||
filter.fields = fields;
|
|
||||||
|
|
||||||
this.find(filter, function(err, states) {
|
|
||||||
(err) ? cb(err, null) : cb(null, states);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.rawSql = function(query, params, cb) {
|
|
||||||
var connector = this.dataSource.connector;
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
connector.execute(query, params, function(error, response) {
|
|
||||||
if (error && !reject)
|
|
||||||
cb(error, null);
|
|
||||||
else if (error && reject)
|
|
||||||
reject(error);
|
|
||||||
else
|
|
||||||
resolve(response);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.remoteMethodCtx = function(methodName, args) {
|
|
||||||
var ctx = {
|
|
||||||
arg: 'context',
|
|
||||||
type: 'object',
|
|
||||||
http: function(ctx) {
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (args.accepts === undefined)
|
|
||||||
args.accepts = [];
|
|
||||||
else if (!Array.isArray(args.accepts))
|
|
||||||
args.accepts = [args.accepts];
|
|
||||||
args.accepts.unshift(ctx);
|
|
||||||
this.remoteMethod(methodName, args);
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.connectToService = function(ctx, dataSource) {
|
|
||||||
this.app.dataSources[dataSource].connector.remotes.auth = {
|
|
||||||
bearer: new Buffer(ctx.req.accessToken.id).toString('base64'),
|
|
||||||
sendImmediately: true
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.disconnectFromService = function(dataSource) {
|
|
||||||
this.app.dataSources[dataSource].connector.remotes.auth = {
|
|
||||||
bearer: new Buffer("").toString('base64'),
|
|
||||||
sendImmediately: true
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.installMethod = function(methodName, filterCb) {
|
|
||||||
this.remoteMethod(methodName, {
|
|
||||||
description: 'List items using a filter',
|
|
||||||
accessType: 'READ',
|
|
||||||
accepts: [
|
|
||||||
{
|
|
||||||
arg: 'filter',
|
|
||||||
type: 'object',
|
|
||||||
required: true,
|
|
||||||
description: 'Filter defining where',
|
|
||||||
http: function(ctx) {
|
|
||||||
return ctx.req.query;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
returns: {
|
|
||||||
arg: 'data',
|
|
||||||
type: [this.modelName],
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
verb: 'get',
|
|
||||||
path: `/${methodName}`
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this[methodName] = (params, cb) => {
|
|
||||||
let filter = removeEmpty(filterCb(params));
|
|
||||||
var response = {};
|
|
||||||
|
|
||||||
function returnValues() {
|
|
||||||
if (response.instances !== undefined && response.count !== undefined)
|
|
||||||
cb(null, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
function error() {
|
|
||||||
cb(null, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.find(filter, function(err, instances) {
|
|
||||||
if (err) {
|
|
||||||
error();
|
|
||||||
} else {
|
|
||||||
response.instances = instances;
|
|
||||||
returnValues();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.count(filter.where, function(err, totalCount) {
|
|
||||||
if (err) {
|
|
||||||
error();
|
|
||||||
} else {
|
|
||||||
response.count = totalCount;
|
|
||||||
returnValues();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.validateBinded = function(propertyName, validatorFn, options) {
|
|
||||||
var customValidator = function(err) {
|
|
||||||
if (!validatorFn(this[propertyName])) err();
|
|
||||||
};
|
|
||||||
options.isExportable = true;
|
|
||||||
options.bindedFunction = validatorFn;
|
|
||||||
this.validate(propertyName, customValidator, options);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
function removeEmpty(o) {
|
|
||||||
if (Array.isArray(o)) {
|
|
||||||
let array = [];
|
|
||||||
for (let item of o) {
|
|
||||||
let i = removeEmpty(item);
|
|
||||||
if (!isEmpty(item))
|
|
||||||
array.push(item);
|
|
||||||
}
|
|
||||||
if (array.length > 0)
|
|
||||||
return array;
|
|
||||||
} else if (typeof o === 'object') {
|
|
||||||
let object = {};
|
|
||||||
for (let key in o) {
|
|
||||||
let i = removeEmpty(o[key]);
|
|
||||||
if (!isEmpty(i))
|
|
||||||
object[key] = i;
|
|
||||||
}
|
|
||||||
if (Object.keys(object).length > 0)
|
|
||||||
return object;
|
|
||||||
} else if (!isEmpty(o))
|
|
||||||
return o;
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isEmpty(value) {
|
|
||||||
return value === undefined || value === "";
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"name": "VnModel",
|
|
||||||
"base": "PersistedModel"
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
module.exports = function(Self) {
|
|
||||||
require('../methods/warehouse/list.js')(Self);
|
|
||||||
};
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Warehouse",
|
|
||||||
"base": "VnModel",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"id": true,
|
|
||||||
"type": "Number",
|
|
||||||
"forceId": false
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "String"
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"type": "Number"
|
|
||||||
},
|
|
||||||
"isManaged":{
|
|
||||||
"type":"boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$everyone",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"scopes" : {
|
|
||||||
"production" : {"where": {"isManaged": {"neq": 0}}}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue