31 lines
677 B
JavaScript
31 lines
677 B
JavaScript
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"
|
|
}
|
|
}
|
|
|
|
} |