From e682c6773aca8ed31778ccb6c7be5be005196c1c Mon Sep 17 00:00:00 2001 From: Esdras Renan Date: Thu, 9 Oct 2025 22:23:35 -0300 Subject: [PATCH] fix(convex): use ctx.runMutation(api.tickets.create) instead of importing handler to satisfy types and build --- convex/machines.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/convex/machines.ts b/convex/machines.ts index 037d810..f809c7f 100644 --- a/convex/machines.ts +++ b/convex/machines.ts @@ -1,5 +1,6 @@ // ci: trigger convex functions deploy import { mutation, query } from "./_generated/server" +import { api } from "./_generated/api" import { ConvexError, v } from "convex/values" import { sha256 } from "@noble/hashes/sha256" import { randomBytes } from "@noble/hashes/utils" @@ -146,22 +147,20 @@ async function createTicketForAlert( if (!subcategory) return null try { - const id = await (await import("./tickets")) - .create - .handler(ctx as any, { - actorId: actor._id, - tenantId, - subject, - summary, - priority: "Alta", - channel: "Automação", - queueId: undefined, - requesterId: actor._id, - assigneeId: undefined, - categoryId: category._id, - subcategoryId: subcategory._id, - customFields: undefined, - } as any) + const id = await ctx.runMutation(api.tickets.create, { + actorId: actor._id, + tenantId, + subject, + summary, + priority: "Alta", + channel: "Automação", + queueId: undefined, + requesterId: actor._id, + assigneeId: undefined, + categoryId: category._id, + subcategoryId: subcategory._id, + customFields: undefined, + }) return id } catch (error) { console.error("[machines.alerts] Falha ao criar ticket:", error)