fix: refs #6184 saveSign

This commit is contained in:
Guillermo Bonet 2024-02-26 12:57:49 +01:00
parent 413f7eb8c8
commit a359ace1b8
1 changed files with 9 additions and 13 deletions

View File

@ -59,19 +59,15 @@ module.exports = Self => {
}
async function hasSignDms(ticketId) {
const ticketDms = await models.TicketDms.findOne({
where: {ticketFk: ticketId},
include: [
{
relation: 'dms',
fields: ['id'],
scope: {
where: {dmsTypeFk: dmsTypeTicket.id}
}
}
]
});
if (ticketDms?.dms()?.id) return true;
const hasTicketDms = await Self.rawSql(`
SELECT d.id
FROM ticketDms td
JOIN dms d ON d.id = td.dmsFk
WHERE td.ticketFk = ?
AND d.dmsTypeFk = ?
`, [ticketId, dmsTypeTicket.id]);
if (hasTicketDms.length) return true;
}
async function createGestDoc() {