diff --git a/services/production/common/methods/fake-production/route.js b/services/production/common/methods/fake-production/route.js new file mode 100644 index 000000000..313c1e0d4 --- /dev/null +++ b/services/production/common/methods/fake-production/route.js @@ -0,0 +1,25 @@ +module.exports = function(FakeProduction) { + FakeProduction.remoteMethodCtx('routeList', { + description: 'Route list', + returns: { + arg: 'response', + type: 'message' + }, + http: { + path: '/routeList', + verb: 'get' + } + }); + + FakeProduction.routeList = function(ctx, cb) { + var query = `select routeFk from FakeProduction where routeFk is not null group by RouteFk order by routeFk`; + var params = []; + FakeProduction.rawSql(query, params, cb) + .then(function(response){ + cb(null, response); + }) + .catch(function(response){ + cb(response, null); + }); + } +} \ No newline at end of file diff --git a/services/production/common/models/fake-production.js b/services/production/common/models/fake-production.js index 383862ef7..2649ce8df 100644 --- a/services/production/common/models/fake-production.js +++ b/services/production/common/models/fake-production.js @@ -3,4 +3,5 @@ var app = require('../../server/server'); module.exports = function(FakeProduction) { require('../methods/fake-production/list.js')(FakeProduction); require('../methods/fake-production/message-send.js')(FakeProduction); + require('../methods/fake-production/route.js')(FakeProduction); }; \ No newline at end of file diff --git a/services/production/common/models/fake-production.json b/services/production/common/models/fake-production.json index 8adbecca9..cc24898b0 100644 --- a/services/production/common/models/fake-production.json +++ b/services/production/common/models/fake-production.json @@ -67,8 +67,10 @@ }, "boxes":{ "type": "Number" + }, + "routeFk":{ + "type": "Number" } - }, "acls": [ { diff --git a/services/production/common/sql/FakeProduction.sql b/services/production/common/sql/FakeProduction.sql index d43507d21..4eb25d65e 100644 --- a/services/production/common/sql/FakeProduction.sql +++ b/services/production/common/sql/FakeProduction.sql @@ -17,7 +17,8 @@ concat(t.Nombre, ' ', t.Apellidos) as worker, tt.Id_Trabajador as salesPersonFk, concat(tt.Nombre, ' ', tt.Apellidos) as salesPerson, s.name as state, -tmp.Cajas as boxes +tmp.Cajas as boxes, +tmp.Id_Ruta as routeFk from tmp.production_buffer tmp inner join state s on tmp.state = s.id