list states
This commit is contained in:
parent
50e086fbc0
commit
509dab5ce4
|
@ -1,30 +1,25 @@
|
|||
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) {
|
||||
State.list = function(filter, cb) {
|
||||
State.find(where(filter), function(err, states) {
|
||||
if(!err){
|
||||
cb(null, states);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function where() {
|
||||
return {
|
||||
where: {
|
||||
"order": {gt: 0}
|
||||
},
|
||||
order: "order, name"
|
||||
function where(filter) {
|
||||
|
||||
if(!filter)
|
||||
return {
|
||||
where: {
|
||||
"order": {gt: 0 }
|
||||
},
|
||||
order: "order, name"
|
||||
}
|
||||
else{
|
||||
filter.where.order = {gt: 0 };
|
||||
filter.order = "order, name";
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue