import { auth } from "@/auth"; import { redirect } from "next/navigation"; import { ExportStatus } from "@prisma/client"; import { db } from "@/lib/db"; import { PipelineQueueClient } from "./PipelineQueueClient"; export const dynamic = "force-dynamic"; export default async function PipelinePage({ searchParams, }: { searchParams: Promise<{ status?: string }>; }) { const session = await auth(); if (!session?.user) redirect("/login"); if (session.user.role === "CLIENT") redirect("/dashboard"); // Lets other pages link straight to a filtered queue — the dashboard's "In // QC" figure is only useful if it leads to the rows it counted. Anything // that is not a real status falls back to the unfiltered queue. const requested = (await searchParams).status; const initialStatus = requested && (Object.values(ExportStatus) as string[]).includes(requested) ? requested : "all"; const projects = await db.project.findMany({ where: { status: { in: ["ACTIVE", "ON_HOLD"] } }, select: { id: true, name: true, code: true }, orderBy: { name: "asc" }, }); return ; }