Merge branch 'dev' of https://git.verdnatura.es/salix into dev

* 'dev' of https://git.verdnatura.es/salix:
  removed eslint errors
  refact production list
  microservices: configuration
  microservices: boot
  Production Package
  Client: Request Package
  Jenkinsfile
  docker context
  Docker auth
  Docker loopback
  Error JenkinsFile
  Docker: Faster
  Docker
This commit is contained in:
Carlos 2017-11-09 09:04:28 +01:00
commit 481792f8bd
17 changed files with 55 additions and 37 deletions

5
Jenkinsfile vendored
View File

@ -34,6 +34,11 @@ node
stage ("docker")
{
stage ("install modules loopback service")
{
sh "cd ./services/loopback && npm install"
}
stage ("Stopping/Removing Docker")
{
sh "docker-compose down --rmi all"

View File

@ -87,10 +87,12 @@ services:
- "80"
ports:
- "80:80"
depends_on:
- route
links:
- "auth:${BRANCH_NAME}-auth"
- "salix:${BRANCH_NAME}-salix"
- "client:${BRANCH_NAME}-client"
- "mailer:${BRANCH_NAME}-mailer"
- "production:${BRANCH_NAME}-production"
- "route:${BRANCH_NAME}-route"
- "${BRANCH_NAME}-auth:auth"
- "${BRANCH_NAME}-salix:salix"
- "${BRANCH_NAME}-client:client"
- "${BRANCH_NAME}-mailer:mailer"
- "${BRANCH_NAME}-production:production"
- "${BRANCH_NAME}-route:route"

View File

@ -4,8 +4,6 @@ COPY auth /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -4,3 +4,6 @@ var vnLoopback = require('../../loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
app.set('applications', require('./application.json'));
vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}

View File

@ -4,8 +4,6 @@ COPY client /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -13,6 +13,7 @@
"url": "https://git.verdnatura.es/salix"
},
"dependencies": {
"loopback-context": "^3.3.0"
"loopback-context": "^3.3.0",
"request": "^2.83.0"
}
}

View File

@ -3,3 +3,6 @@ var vnLoopback = require('../../loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}

View File

@ -45,18 +45,20 @@ module.exports = function(Self) {
});
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 => {
let clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : [];
let serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : [];
let fields = clientFields.filter(itemC => {
return serverFields.some(itemS => itemS === itemC);
});
let and = [];
let order;
let limit;
let filter = {order: order, limit: limit};
var and = [];
(clientFilter && clientFilter.where) && and.push(clientFilter.where);
(serverFilter && serverFilter.where) && and.push(serverFilter.where);
var order;
var limit;
if (clientFilter && clientFilter.where)
and.push(clientFilter.where);
if (serverFilter && serverFilter.where)
and.push(serverFilter.where);
if (clientFilter && clientFilter.order)
order = clientFilter.order;
@ -68,12 +70,14 @@ module.exports = function(Self) {
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);
if (err)
cb(err, null);
else
cb(null, states);
});
};
};
@ -198,8 +202,8 @@ function removeEmpty(o) {
let array = [];
for (let item of o) {
let i = removeEmpty(item);
if (!isEmpty(item))
array.push(item);
if (!isEmpty(i))
array.push(i);
}
if (array.length > 0)
return array;

View File

@ -84,9 +84,9 @@ function vnBoot(app, rootDir, cb) {
boot(app, bootOptions, function(err) {
if (err) throw err;
if (require.main === module)
if (require.main === module) {
app.start();
}
if (cb)
cb(app);
});

View File

@ -4,8 +4,6 @@ COPY production /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -2,9 +2,6 @@ module.exports = function(Self) {
Self.defineScope();
Self.list = function(ctx, filter, callback) {
var page = filter.page - 1;
var limit = filter.limit * page;
var offset = (page + 1) * filter.limit;
let daysTickets = 0;
let warehouseFk = filter.where.warehouseFk;
delete filter.limit;
@ -80,7 +77,7 @@ module.exports = function(Self) {
}, this);
obj.m3 = obj.m3.toFixed(2);
obj.total = tickets.length;
obj.tickets = tickets.slice(limit, offset);
obj.tickets = tickets;
return obj;
}
};

View File

@ -12,5 +12,8 @@
"url": "https://git.verdnatura.es/salix"
},
"license": "GPL-3.0",
"description": "vn-production"
"description": "vn-production",
"dependencies": {
"uuid": "^3.1.0"
}
}

View File

@ -2,3 +2,6 @@ var vnLoopback = require('../../loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}

View File

@ -4,8 +4,6 @@ COPY route /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -3,3 +3,6 @@ var vnLoopback = require('../../loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}

View File

@ -4,8 +4,6 @@ COPY salix /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -11,3 +11,7 @@ app.set('url auth', '/auth');
app.use(cookieParser());
vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}