This commit is contained in:
nelo 2017-06-21 08:00:34 +02:00
parent df320908ae
commit a4d9c3008a
8 changed files with 63 additions and 24 deletions

View File

@ -0,0 +1,7 @@
module.exports = function(Agency) {
var serverFilter = {"where": {"tpv": {"neq": 0}}};
Agency.defineScope(serverFilter);
}

View File

@ -1,22 +0,0 @@
module.exports = function(State) {
State.list = function(filter, cb) {
};
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;
}
}
}

View File

@ -0,0 +1,7 @@
module.exports = function(State) {
var serverFilter = {where: { "order": {gt: 0 }}, order: "order, name"};
State.defineScope(serverFilter);
}

View File

@ -0,0 +1,9 @@
var app = require('../../server/server');
module.exports = function(Agency) {
var models = app.models;
// Methods
require('../methods/agency/list.js')(Agency);
};

View File

@ -0,0 +1,34 @@
{
"name": "Agency",
"base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
"id": true,
"type": "Number",
"forceId": false
},
"name": {
"type": "String",
"required": false
},
"tpv":{
"type": "Number",
"required": false
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "root",
"permission": "ALLOW"
}
]
}

View File

@ -5,5 +5,5 @@ module.exports = function(State) {
// Methods
require('../methods/state/find.js')(State);
require('../methods/state/list.js')(State);
};

View File

@ -5,5 +5,5 @@ module.exports = function(Warehouse) {
// Methods
require('../methods/warehouse/list-warehouses.js')(Warehouse);
require('../methods/warehouse/list.js')(Warehouse);
};

View File

@ -60,5 +60,9 @@
"Employee":{
"dataSource": "client",
"public": true
},
"Agency": {
"dataSource": "vn",
"public": true
}
}