8179-testToMaster #3176

Merged
alexm merged 407 commits from 8179-testToMaster into master 2024-11-12 06:41:52 +00:00
1 changed files with 13 additions and 6 deletions
Showing only changes of commit 40512ca67e - Show all commits

View File

@ -142,12 +142,19 @@ module.exports = Self => {
ctx.args.addressId = ticket.addressFk;
const newTicket = await models.Ticket.new(ctx, myOptions);
await models.TicketRefund.create({
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
}, myOptions);
const existingRefund = await models.TicketRefund.findOne({
where: {
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
},
myOptions
});
if (!existingRefund) {
await models.TicketRefund.create({
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
}, myOptions);
}
return newTicket;
}
};