Fix auth sync and set ticket channel chart default
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
parent
487edd222f
commit
12262e24c8
5 changed files with 62 additions and 8 deletions
46
web/scripts/debug-convex.mjs
Normal file
46
web/scripts/debug-convex.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { ConvexHttpClient } from "convex/browser";
|
||||
|
||||
const url = process.env.NEXT_PUBLIC_CONVEX_URL;
|
||||
|
||||
if (!url) {
|
||||
console.error("Missing NEXT_PUBLIC_CONVEX_URL");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const client = new ConvexHttpClient(url);
|
||||
|
||||
const tenantId = process.argv[2] ?? "tenant-atlas";
|
||||
|
||||
const ensureAdmin = await client.mutation("users:ensureUser", {
|
||||
tenantId,
|
||||
email: "admin@sistema.dev",
|
||||
name: "Administrador",
|
||||
role: "ADMIN",
|
||||
});
|
||||
|
||||
console.log("Ensured admin user:", ensureAdmin);
|
||||
|
||||
const agents = await client.query("users:listAgents", { tenantId });
|
||||
console.log("Agents:", agents);
|
||||
|
||||
const viewerId = ensureAdmin?._id ?? agents[0]?._id;
|
||||
|
||||
if (!viewerId) {
|
||||
console.error("Unable to determine viewer id");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const tickets = await client.query("tickets:list", {
|
||||
tenantId,
|
||||
viewerId,
|
||||
limit: 10,
|
||||
});
|
||||
|
||||
console.log("Tickets:", tickets);
|
||||
|
||||
const dashboard = await client.query("reports:dashboardOverview", {
|
||||
tenantId,
|
||||
viewerId,
|
||||
});
|
||||
|
||||
console.log("Dashboard:", dashboard);
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { PrismaClient } from "@prisma/client"
|
||||
import pkg from "@prisma/client"
|
||||
import { hashPassword } from "better-auth/crypto"
|
||||
|
||||
const { PrismaClient } = pkg
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
const email = process.env.SEED_USER_EMAIL ?? "admin@sistema.dev"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue