salix/services/production/common/methods/ticket/change-time.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-06-28 06:57:33 +00:00
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)
});
});
}
}