Bug #651 Al borrar un ticket no se cambia su estado a eliminado
This commit is contained in:
parent
4cd629b645
commit
fe80a6b8c8
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('deleted', {
|
||||
Self.remoteMethodCtx('deleted', {
|
||||
description: 'Sets the isDeleted value of a ticket to 1',
|
||||
accessType: '',
|
||||
accepts: [{
|
||||
|
@ -19,7 +19,15 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.deleted = async params => {
|
||||
return await Self.app.models.Ticket.update({id: params.id}, {isDeleted: '1'});
|
||||
Self.deleted = async(ctx, params) => {
|
||||
await Self.app.models.Ticket.update({id: params.id}, {isDeleted: '1'});
|
||||
|
||||
if (ctx.req.accessToken) {
|
||||
let token = ctx.req.accessToken;
|
||||
let currentUserId = token && token.userId;
|
||||
let worker = await Self.app.models.Worker.findOne({where: {userFk: currentUserId}});
|
||||
params.workerFk = worker.id;
|
||||
}
|
||||
return await Self.app.models.TicketTracking.create({ticketFk: params.id, stateFk: 17, workerFk: params.workerFk});
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue