Endpoint RouteFk

This commit is contained in:
Vicente Falco 2017-07-06 08:45:33 +02:00
parent 51ac5f5262
commit d2e0051b38
4 changed files with 31 additions and 2 deletions

View File

@ -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);
});
}
}

View File

@ -3,4 +3,5 @@ var app = require('../../server/server');
module.exports = function(FakeProduction) { module.exports = function(FakeProduction) {
require('../methods/fake-production/list.js')(FakeProduction); require('../methods/fake-production/list.js')(FakeProduction);
require('../methods/fake-production/message-send.js')(FakeProduction); require('../methods/fake-production/message-send.js')(FakeProduction);
require('../methods/fake-production/route.js')(FakeProduction);
}; };

View File

@ -67,8 +67,10 @@
}, },
"boxes":{ "boxes":{
"type": "Number" "type": "Number"
},
"routeFk":{
"type": "Number"
} }
}, },
"acls": [ "acls": [
{ {

View File

@ -17,7 +17,8 @@ concat(t.Nombre, ' ', t.Apellidos) as worker,
tt.Id_Trabajador as salesPersonFk, tt.Id_Trabajador as salesPersonFk,
concat(tt.Nombre, ' ', tt.Apellidos) as salesPerson, concat(tt.Nombre, ' ', tt.Apellidos) as salesPerson,
s.name as state, s.name as state,
tmp.Cajas as boxes tmp.Cajas as boxes,
tmp.Id_Ruta as routeFk
from tmp.production_buffer tmp from tmp.production_buffer tmp
inner join state s inner join state s
on tmp.state = s.id on tmp.state = s.id