get states production

This commit is contained in:
nelo 2017-06-13 11:26:54 +02:00
parent ecf347e7e2
commit cbc364db38
5 changed files with 80 additions and 3 deletions

View File

@ -0,0 +1,31 @@
module.exports = function(State) {
State.remoteMethod('productionStates', {
description: 'Get production states',
returns: {
arg: 'states',
type: 'object'
},
http: {
verb: 'get',
path: '/productionStates'
}
});
State.productionStates = function(cb) {
State.find(where(), function(err, states) {
if(!err){
cb(null, states);
}
});
};
function where() {
return {
where: {
"order": {gt: 0}
},
order: "order, name"
}
}
}

View File

@ -0,0 +1,9 @@
var app = require('../../server/server');
module.exports = function(State) {
var models = app.models;
// Methods
require('../methods/state/find.js')(State);
};

View File

@ -11,6 +11,18 @@
"name": {
"type": "String",
"required": false
},
"order":{
"type": "Number",
"required": false
},
"alertLevel":{
"type": "Number",
"required": false
},
"code":{
"type": "String",
"required": false
}
},
"acls": [

View File

@ -1,6 +1,31 @@
{
"db": {
"name": "db",
"connector": "memory"
"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
}
}