merge conflicts
This commit is contained in:
commit
7c28d42be0
|
@ -25,7 +25,29 @@ module.exports = function(self) {
|
|||
for(let method in disableMethods) {
|
||||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
this.remoteMethod('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'object',
|
||||
description: 'Filter defining where'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: [this.modelName],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'get',
|
||||
path: '/list'
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.list = function(filter, cb) {};
|
||||
|
||||
self.rawSql = function(query, params, cb) {
|
||||
this.dataSource.connector.execute(query, params, function(error, response) {
|
||||
cb(error, response);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,6 @@ module.exports = function(TicketState) {
|
|||
TicketState.remoteMethodCtx('changeState', {
|
||||
description: 'Change state of tickets',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'tickets',
|
||||
type: 'array',
|
||||
required: true,
|
||||
description: 'Array of tickets',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
arg: 'state',
|
||||
type: 'number',
|
||||
|
@ -23,11 +16,13 @@ module.exports = function(TicketState) {
|
|||
},
|
||||
http: {
|
||||
verb: 'put',
|
||||
path: '/:tickets/:state/changeState'
|
||||
path: '/:state/changeState'
|
||||
}
|
||||
});
|
||||
|
||||
TicketState.changeState = function(ctx, tickets, state, cb) {
|
||||
TicketState.changeState = function(ctx, state, cb) {
|
||||
var tickets = ctx.req.body.tickets;
|
||||
|
||||
TicketState.connectToService(ctx, "client");
|
||||
|
||||
TicketState.app.models.Employee.findOne({where: {userFk: ctx.req.accessToken.userId}}, function(err, emp){
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
module.exports = function(Warehouse) {
|
||||
Warehouse.remoteMethod('list', {
|
||||
description: 'List production warehouses',
|
||||
returns: {
|
||||
type: [Warehouse],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'get',
|
||||
path: '/list'
|
||||
}
|
||||
});
|
||||
|
||||
Warehouse.list = function(cb) {
|
||||
Warehouse.find(where(), function(err, warehouses){
|
||||
Warehouse.list = function(filter, cb) {
|
||||
Warehouse.find(where(filter), function(err, warehouses){
|
||||
if(!err)
|
||||
cb(null, warehouses);
|
||||
else
|
||||
|
@ -20,7 +8,12 @@ module.exports = function(Warehouse) {
|
|||
});
|
||||
};
|
||||
|
||||
var where = function(){
|
||||
return {"where": {"tpv": {"neq": 0}}}
|
||||
var where = function(filter){
|
||||
if(!filter)
|
||||
return {"where": {"tpv": {"neq": 0}}}
|
||||
else {
|
||||
filter.where.tpv = {"neq": 0}
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,29 @@ module.exports = function(self) {
|
|||
for(let method in disableMethods) {
|
||||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
this.remoteMethod('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'object',
|
||||
description: 'Filter defining where'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: [this.modelName],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'get',
|
||||
path: '/list'
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.list = function(filter, cb) {};
|
||||
|
||||
self.rawSql = function(query, params, cb) {
|
||||
this.dataSource.connector.execute(query, params, function(error, response) {
|
||||
cb(error, response);
|
||||
|
|
|
@ -25,7 +25,29 @@ module.exports = function(self) {
|
|||
for(let method in disableMethods) {
|
||||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
this.remoteMethod('list', {
|
||||
accepts: [
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'object',
|
||||
description: 'Filter defining where'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: [this.modelName],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'get',
|
||||
path: '/list'
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.list = function(filter, cb) {};
|
||||
|
||||
self.rawSql = function(query, params, cb) {
|
||||
this.dataSource.connector.execute(query, params, function(error, response) {
|
||||
cb(error, response);
|
||||
|
|
Loading…
Reference in New Issue