chore: refs #7919 refactor, drop relation on back
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
6f8a005726
commit
d57f4fc44a
|
@ -12,10 +12,5 @@ BEGIN
|
||||||
CALL ticket_doCmr(NEW.id);
|
CALL ticket_doCmr(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NEW.isDeleted THEN
|
|
||||||
DELETE FROM ticketRefund
|
|
||||||
WHERE refundTicketFk = NEW.id;
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -49,9 +49,12 @@ module.exports = Self => {
|
||||||
where: {originalTicketFk: id}
|
where: {originalTicketFk: id}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
const isRefund = !!ticketRefunds?.length;
|
||||||
|
|
||||||
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
|
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
|
||||||
|
|
||||||
if (ticketRefunds?.length && !allDeleted) {
|
if (!isRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
|
||||||
|
if (isRefund && !allDeleted) {
|
||||||
const notDeleted = [];
|
const notDeleted = [];
|
||||||
for (const refund of ticketRefunds)
|
for (const refund of ticketRefunds)
|
||||||
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);
|
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);
|
||||||
|
|
Loading…
Reference in New Issue