module.exports = function(Ticket) { Ticket.remoteMethodCtx('changeTime', { description: 'List tickets for production', accepts: { arg: 'time', type: 'string', required: true, description: 'New time of ticket', http: {source: 'path'} }, http: { verb: 'get', path: '/changeTime' } }); Ticket.changeTime = function(ctx, time, cb) { var tickets = ctx.req.body.tickets; }; var changeTime = function(tickets, time, cb){ var FakeProduction = Ticket.app.models.FakeProduction; time = `CONCAT(DATE(Fecha), ' ${time}')`; Ticket.updateAll({id: {inq: tickets}}, {date: time}, function(err, res){ if(err) cb(err, null) else FakeProduction.updateAll({id: {inq: tickets}}, {date: time}, function(err, res){ (err) ? cb(err, null) : cb(null, res) }); }); } }