feat: automações de tickets e testes de regressão
This commit is contained in:
parent
9f1a6a7401
commit
8ab510bfe9
18 changed files with 2221 additions and 20 deletions
|
|
@ -7,6 +7,7 @@ import { ConvexError, v } from "convex/values";
|
|||
import { Id, type Doc, type TableNames } from "./_generated/dataModel";
|
||||
|
||||
import { requireAdmin, requireStaff, requireUser } from "./rbac";
|
||||
import { runTicketAutomationsForEvent } from "./automations";
|
||||
import {
|
||||
OPTIONAL_ADMISSION_FIELD_KEYS,
|
||||
TICKET_FORM_CONFIG,
|
||||
|
|
@ -2412,6 +2413,12 @@ export const create = mutation({
|
|||
})
|
||||
}
|
||||
|
||||
await runTicketAutomationsForEvent(ctx, {
|
||||
tenantId: args.tenantId,
|
||||
ticketId: id,
|
||||
eventType: "TICKET_CREATED",
|
||||
})
|
||||
|
||||
return id;
|
||||
},
|
||||
});
|
||||
|
|
@ -2546,6 +2553,13 @@ export const addComment = mutation({
|
|||
} catch (e) {
|
||||
console.warn("[tickets] Falha ao agendar e-mail de comentário", e)
|
||||
}
|
||||
|
||||
await runTicketAutomationsForEvent(ctx, {
|
||||
tenantId: ticketDoc.tenantId,
|
||||
ticketId: args.ticketId,
|
||||
eventType: "COMMENT_ADDED",
|
||||
})
|
||||
|
||||
return id;
|
||||
},
|
||||
});
|
||||
|
|
@ -2702,6 +2716,12 @@ export const updateStatus = mutation({
|
|||
payload: { to: normalizedStatus, toLabel: STATUS_LABELS[normalizedStatus], actorId },
|
||||
createdAt: now,
|
||||
});
|
||||
|
||||
await runTicketAutomationsForEvent(ctx, {
|
||||
tenantId: ticketDoc.tenantId,
|
||||
ticketId,
|
||||
eventType: "STATUS_CHANGED",
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -2843,6 +2863,12 @@ export async function resolveTicketHandler(
|
|||
})
|
||||
}
|
||||
|
||||
await runTicketAutomationsForEvent(ctx, {
|
||||
tenantId: ticketDoc.tenantId,
|
||||
ticketId,
|
||||
eventType: "TICKET_RESOLVED",
|
||||
})
|
||||
|
||||
return { ok: true, reopenDeadline, reopenWindowDays: reopenDays }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue