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
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,9 +147,7 @@ async function createTicketForAlert(
if (!subcategory) return null
try {
const id = await (await import("./tickets"))
.create
.handler(ctx as any, {
const id = await ctx.runMutation(api.tickets.create, {
actorId: actor._id,
tenantId,
subject,
@ -161,7 +160,7 @@ async function createTicketForAlert(
categoryId: category._id,
subcategoryId: subcategory._id,
customFields: undefined,
} as any)
})
return id
} catch (error) {
console.error("[machines.alerts] Falha ao criar ticket:", error)