fix(convex): use ctx.runMutation(api.tickets.create) instead of importing handler to satisfy types and build

This commit is contained in:
Esdras Renan 2025-10-09 22:23:35 -03:00
parent 335accb596
commit e682c6773a

View file

@ -1,5 +1,6 @@
// ci: trigger convex functions deploy // ci: trigger convex functions deploy
import { mutation, query } from "./_generated/server" import { mutation, query } from "./_generated/server"
import { api } from "./_generated/api"
import { ConvexError, v } from "convex/values" import { ConvexError, v } from "convex/values"
import { sha256 } from "@noble/hashes/sha256" import { sha256 } from "@noble/hashes/sha256"
import { randomBytes } from "@noble/hashes/utils" import { randomBytes } from "@noble/hashes/utils"
@ -146,9 +147,7 @@ async function createTicketForAlert(
if (!subcategory) return null if (!subcategory) return null
try { try {
const id = await (await import("./tickets")) const id = await ctx.runMutation(api.tickets.create, {
.create
.handler(ctx as any, {
actorId: actor._id, actorId: actor._id,
tenantId, tenantId,
subject, subject,
@ -161,7 +160,7 @@ async function createTicketForAlert(
categoryId: category._id, categoryId: category._id,
subcategoryId: subcategory._id, subcategoryId: subcategory._id,
customFields: undefined, customFields: undefined,
} as any) })
return id return id
} catch (error) { } catch (error) {
console.error("[machines.alerts] Falha ao criar ticket:", error) console.error("[machines.alerts] Falha ao criar ticket:", error)