feat: núcleo de tickets com Convex (CRUD, play, comentários com anexos) + auth placeholder; docs em AGENTS.md; toasts e updates otimistas; mapeadores Zod; refinos PT-BR e layout do painel de detalhes

This commit is contained in:
esdrasrenan 2025-10-04 00:31:44 -03:00
parent 2230590e57
commit 27b103cb46
97 changed files with 15117 additions and 15715 deletions

24
web/convex/queues.ts Normal file
View file

@ -0,0 +1,24 @@
import { query } from "./_generated/server";
import { v } from "convex/values";
export const summary = query({
args: { tenantId: v.string() },
handler: async (ctx, { tenantId }) => {
const queues = await ctx.db.query("queues").withIndex("by_tenant", (q) => q.eq("tenantId", tenantId)).collect();
// Compute counts per queue
const result = await Promise.all(
queues.map(async (qItem) => {
const pending = await ctx.db
.query("tickets")
.withIndex("by_tenant_queue", (q) => q.eq("tenantId", tenantId).eq("queueId", qItem._id))
.collect();
const waiting = pending.filter((t) => t.status === "PENDING" || t.status === "ON_HOLD").length;
const open = pending.filter((t) => t.status !== "RESOLVED" && t.status !== "CLOSED").length;
const breached = 0; // Placeholder, SLAs later
return { id: qItem._id, name: qItem.name, pending: open, waiting, breached };
})
);
return result;
},
});