fake production in table
This commit is contained in:
parent
8046c434fe
commit
a7a4a211e2
|
@ -28,7 +28,7 @@ module.exports = function(self) {
|
|||
};
|
||||
|
||||
self.defineScope = function(serverFilter) {
|
||||
this.remoteMethod('list', {
|
||||
this.remoteMethodCtx('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
|
@ -46,7 +46,7 @@ module.exports = function(self) {
|
|||
}
|
||||
});
|
||||
|
||||
this.list = function(clientFilter, cb) {
|
||||
this.list = function(ctx, clientFilter, cb) {
|
||||
var where = {"and": []};
|
||||
(clientFilter) ? where.and.push(clientFilter.where) : undefined;
|
||||
(serverFilter) ? where.and.push(serverFilter.where) : undefined;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = function(FakeProduction) {
|
||||
|
||||
FakeProduction.defineScope();
|
||||
|
||||
FakeProduction.list = function(ctx, filter, cb){
|
||||
FakeProduction.connectToService(ctx, "client");
|
||||
|
||||
this.find(filter, function(err, tickets) {
|
||||
(!err) ? cb(null, tickets) : cb(err, null);
|
||||
});
|
||||
|
||||
FakeProduction.disconnectFromService("client");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "Client",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
},
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "root",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
],
|
||||
"validations": [],
|
||||
"methods": {}
|
||||
}
|
|
@ -7,6 +7,9 @@
|
|||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name":{
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"acls": []
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
var app = require('../../server/server');
|
||||
|
||||
module.exports = function(FakeProduction) {
|
||||
var models = app.models;
|
||||
|
||||
// Methods
|
||||
require('../methods/fake-production/list.js')(FakeProduction);
|
||||
};
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"name": "FakeProduction",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"forceId": false
|
||||
},
|
||||
"hour":{
|
||||
"type": "String"
|
||||
},
|
||||
"lines":{
|
||||
"type": "Number"
|
||||
},
|
||||
"m3":{
|
||||
"type": "Number"
|
||||
},
|
||||
"boxes":{
|
||||
"type": "Number"
|
||||
},
|
||||
"city":{
|
||||
"type": "String"
|
||||
},
|
||||
"problem":{
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"ticket": {
|
||||
"type": "belongsTo",
|
||||
"model": "Ticket",
|
||||
"foreignKey": "ticketFk"
|
||||
},
|
||||
"state": {
|
||||
"type": "belongsTo",
|
||||
"model": "State",
|
||||
"foreignKey": "stateFk"
|
||||
},
|
||||
"agency": {
|
||||
"type": "belongsTo",
|
||||
"model": "Agency",
|
||||
"foreignKey": "agencyFk"
|
||||
},
|
||||
"province": {
|
||||
"type": "belongsTo",
|
||||
"model": "Province",
|
||||
"foreignKey": "provinceFk"
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientFk"
|
||||
},
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Employee",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"salePerson": {
|
||||
"type": "belongsTo",
|
||||
"model": "Employee",
|
||||
"foreignKey": "salePersonFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
},
|
||||
{
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "root",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -28,7 +28,7 @@ module.exports = function(self) {
|
|||
};
|
||||
|
||||
self.defineScope = function(serverFilter) {
|
||||
this.remoteMethod('list', {
|
||||
this.remoteMethodCtx('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
|
@ -46,7 +46,7 @@ module.exports = function(self) {
|
|||
}
|
||||
});
|
||||
|
||||
this.list = function(clientFilter, cb) {
|
||||
this.list = function(ctx, clientFilter, cb) {
|
||||
var where = {"and": []};
|
||||
(clientFilter) ? where.and.push(clientFilter.where) : undefined;
|
||||
(serverFilter) ? where.and.push(serverFilter.where) : undefined;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "Province",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"accessType": "WRITE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -61,8 +61,20 @@
|
|||
"dataSource": "client",
|
||||
"public": true
|
||||
},
|
||||
"Client":{
|
||||
"dataSource": "client",
|
||||
"public": true
|
||||
},
|
||||
"Province":{
|
||||
"dataSource": "client",
|
||||
"public": true
|
||||
},
|
||||
"Agency": {
|
||||
"dataSource": "vn",
|
||||
"public": true
|
||||
},
|
||||
"FakeProduction": {
|
||||
"dataSource": "vn",
|
||||
"public": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = function(self) {
|
|||
};
|
||||
|
||||
self.defineScope = function(serverFilter) {
|
||||
this.remoteMethod('list', {
|
||||
this.remoteMethodCtx('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
|
@ -46,7 +46,7 @@ module.exports = function(self) {
|
|||
}
|
||||
});
|
||||
|
||||
this.list = function(clientFilter, cb) {
|
||||
this.list = function(ctx, clientFilter, cb) {
|
||||
var where = {"and": []};
|
||||
(clientFilter) ? where.and.push(clientFilter.where) : undefined;
|
||||
(serverFilter) ? where.and.push(serverFilter.where) : undefined;
|
||||
|
|
Loading…
Reference in New Issue