fix(convex): use ctx.runMutation(api.tickets.create) instead of importing handler to satisfy types and build
This commit is contained in:
parent
335accb596
commit
e682c6773a
1 changed files with 15 additions and 16 deletions
|
|
@ -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,22 +147,20 @@ 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
|
actorId: actor._id,
|
||||||
.handler(ctx as any, {
|
tenantId,
|
||||||
actorId: actor._id,
|
subject,
|
||||||
tenantId,
|
summary,
|
||||||
subject,
|
priority: "Alta",
|
||||||
summary,
|
channel: "Automação",
|
||||||
priority: "Alta",
|
queueId: undefined,
|
||||||
channel: "Automação",
|
requesterId: actor._id,
|
||||||
queueId: undefined,
|
assigneeId: undefined,
|
||||||
requesterId: actor._id,
|
categoryId: category._id,
|
||||||
assigneeId: undefined,
|
subcategoryId: subcategory._id,
|
||||||
categoryId: category._id,
|
customFields: undefined,
|
||||||
subcategoryId: subcategory._id,
|
})
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue