fix: refs #7906 remake method #3109
|
@ -53,23 +53,10 @@ module.exports = Self => {
|
|||
const promises = [];
|
||||
carlossa marked this conversation as resolved
|
||||
|
||||
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||
const fixingState = await models.State.findOne({where: {code: 'FIXING'}}, myOptions);
|
||||
const worker = await models.Worker.findOne({
|
||||
where: {id: userId}
|
||||
}, myOptions);
|
||||
|
||||
if (ticketList.length > 0)
|
||||
throw new UserError('There are tickets for this area, delete them first');
|
||||
|
||||
for (ticket of ticketList) {
|
||||
if (ticket.ticketState().alertLevel == 0) {
|
||||
promises.push(models.Ticket.state(ctx, {
|
||||
ticketFk: ticket.id,
|
||||
stateFk: fixingState.id,
|
||||
userFk: worker.id
|
||||
}, myOptions));
|
||||
}
|
||||
}
|
||||
await Promise.all(promises);
|
||||
carlossa marked this conversation as resolved
Outdated
alexm
commented
Quitar Quitar
|
||||
await models.Zone.destroyById(id, myOptions);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Quitar