get warehouses

This commit is contained in:
nelo 2017-06-14 12:55:10 +02:00
parent 16302e1f9a
commit 6996352029
4 changed files with 72 additions and 0 deletions

View File

@ -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}}}
}
}

View File

@ -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);
};

View File

@ -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"
}
]
}

View File

@ -52,5 +52,9 @@
"TicketState":{
"dataSource": "vn",
"public": true
},
"Warehouse":{
"dataSource": "vn",
"public": true
}
}