get states production
This commit is contained in:
parent
ecf347e7e2
commit
cbc364db38
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
var app = require('../../server/server');
|
||||||
|
|
||||||
|
module.exports = function(State) {
|
||||||
|
var models = app.models;
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
|
||||||
|
require('../methods/state/find.js')(State);
|
||||||
|
};
|
|
@ -11,6 +11,18 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "String",
|
"type": "String",
|
||||||
"required": false
|
"required": false
|
||||||
|
},
|
||||||
|
"order":{
|
||||||
|
"type": "Number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"alertLevel":{
|
||||||
|
"type": "Number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"code":{
|
||||||
|
"type": "String",
|
||||||
|
"required": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
|
@ -1,6 +1,31 @@
|
||||||
{
|
{
|
||||||
"db": {
|
"db": {
|
||||||
"name": "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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue