get warehouses
This commit is contained in:
parent
16302e1f9a
commit
6996352029
|
@ -0,0 +1,24 @@
|
|||
module.exports = function(Warehouse) {
|
||||
Warehouse.remoteMethod('list', {
|
||||
description: 'List production warehouses',
|
||||
returns: {
|
||||
arg: 'warehouses',
|
||||
type: 'object'
|
||||
},
|
||||
http: {
|
||||
verb: 'get',
|
||||
path: '/list'
|
||||
}
|
||||
});
|
||||
|
||||
Warehouse.list = function(cb) {
|
||||
Warehouse.find(where(), function(err, warehouses){
|
||||
if(!err)
|
||||
cb(null, warehouses);
|
||||
});
|
||||
};
|
||||
|
||||
var where = function(){
|
||||
return {"where": {"tpv": {"neq": 0}}}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
var app = require('../../server/server');
|
||||
|
||||
module.exports = function(Warehouse) {
|
||||
var models = app.models;
|
||||
|
||||
// Methods
|
||||
|
||||
require('../methods/warehouse/list-warehouses.js')(Warehouse);
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "Warehouse",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"forceId": false
|
||||
},
|
||||
"name": {
|
||||
"type": "String"
|
||||
},
|
||||
"tpv": {
|
||||
"type": "Number"
|
||||
},
|
||||
"inventary": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
},
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "root",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -52,5 +52,9 @@
|
|||
"TicketState":{
|
||||
"dataSource": "vn",
|
||||
"public": true
|
||||
},
|
||||
"Warehouse":{
|
||||
"dataSource": "vn",
|
||||
"public": true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue