feat(filters): ticket company filter + column; reports: company filter in CSVs; dashboard: queue summary; docs: agents.md and roadmap updates
This commit is contained in:
parent
70f91f5bbd
commit
2cf399dcb1
9 changed files with 100 additions and 31 deletions
|
|
@ -57,15 +57,18 @@ export async function GET(request: Request) {
|
|||
try {
|
||||
const { searchParams } = new URL(request.url)
|
||||
const range = searchParams.get("range") ?? undefined
|
||||
const companyId = searchParams.get("companyId") ?? undefined
|
||||
const report = await client.query(api.reports.backlogOverview, {
|
||||
tenantId,
|
||||
viewerId: viewerId as unknown as Id<"users">,
|
||||
range,
|
||||
companyId: companyId as any,
|
||||
})
|
||||
|
||||
const rows: Array<Array<unknown>> = []
|
||||
rows.push(["Relatório", "Backlog"])
|
||||
rows.push(["Período", report.rangeDays ? `Últimos ${report.rangeDays} dias` : "—"])
|
||||
if (companyId) rows.push(["EmpresaId", companyId])
|
||||
rows.push([])
|
||||
rows.push(["Seção", "Chave", "Valor"]) // header
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ export async function GET(request: Request) {
|
|||
|
||||
const { searchParams } = new URL(request.url)
|
||||
const range = searchParams.get("range") ?? undefined // "7d" | "30d" | undefined(=90d)
|
||||
const companyId = searchParams.get("companyId") ?? undefined
|
||||
|
||||
const client = new ConvexHttpClient(convexUrl)
|
||||
const tenantId = session.user.tenantId ?? DEFAULT_TENANT_ID
|
||||
|
|
@ -62,6 +63,7 @@ export async function GET(request: Request) {
|
|||
tenantId,
|
||||
viewerId: viewerId as unknown as Id<"users">,
|
||||
range,
|
||||
companyId: companyId as any,
|
||||
})
|
||||
|
||||
const channels = report.channels
|
||||
|
|
@ -91,7 +93,7 @@ export async function GET(request: Request) {
|
|||
return new NextResponse(csv, {
|
||||
headers: {
|
||||
"Content-Type": "text/csv; charset=UTF-8",
|
||||
"Content-Disposition": `attachment; filename="tickets-by-channel-${tenantId}-${range ?? '90d'}.csv"`,
|
||||
"Content-Disposition": `attachment; filename="tickets-by-channel-${tenantId}-${range ?? '90d'}${companyId ? `-${companyId}` : ''}.csv"`,
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue