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 ("docker")
{ {
stage ("install modules loopback service")
{
sh "cd ./services/loopback && npm install"
}
stage ("Stopping/Removing Docker") stage ("Stopping/Removing Docker")
{ {
sh "docker-compose down --rmi all" sh "docker-compose down --rmi all"

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@
"url": "https://git.verdnatura.es/salix" "url": "https://git.verdnatura.es/salix"
}, },
"dependencies": { "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(); var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname); 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) { this.list = function(ctx, clientFilter, cb) {
var clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : []; let clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : [];
var serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : []; let serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : [];
var fields = clientFields.filter(itemC => { let fields = clientFields.filter(itemC => {
return serverFields.some(itemS => itemS === itemC); return serverFields.some(itemS => itemS === itemC);
}); });
let and = [];
let order;
let limit;
let filter = {order: order, limit: limit};
var and = []; if (clientFilter && clientFilter.where)
(clientFilter && clientFilter.where) && and.push(clientFilter.where); and.push(clientFilter.where);
(serverFilter && serverFilter.where) && and.push(serverFilter.where); if (serverFilter && serverFilter.where)
and.push(serverFilter.where);
var order;
var limit;
if (clientFilter && clientFilter.order) if (clientFilter && clientFilter.order)
order = clientFilter.order; order = clientFilter.order;
@ -68,12 +70,14 @@ module.exports = function(Self) {
else if (clientFilter && clientFilter.limit) else if (clientFilter && clientFilter.limit)
limit = clientFilter.limit; limit = clientFilter.limit;
var filter = {order: order, limit: limit};
filter.where = (and.length > 0) && {and: and}; filter.where = (and.length > 0) && {and: and};
filter.fields = fields; filter.fields = fields;
this.find(filter, function(err, states) { 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 = []; let array = [];
for (let item of o) { for (let item of o) {
let i = removeEmpty(item); let i = removeEmpty(item);
if (!isEmpty(item)) if (!isEmpty(i))
array.push(item); array.push(i);
} }
if (array.length > 0) if (array.length > 0)
return array; return array;

View File

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

View File

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

View File

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

View File

@ -12,5 +12,8 @@
"url": "https://git.verdnatura.es/salix" "url": "https://git.verdnatura.es/salix"
}, },
"license": "GPL-3.0", "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(); var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname); vnLoopback.boot(app, __dirname);
if (require.main === module) {
app.start();
}

View File

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

View File

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

View File

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

View File

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