23 lines
743 B
TypeScript
23 lines
743 B
TypeScript
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import { db } from "@/lib/db";
|
|
import { StoryboardGenerator } from "@/components/storyboard/StoryboardGenerator";
|
|
|
|
export const metadata = { title: "Storyboard Generator" };
|
|
|
|
export default async function StoryboardPage() {
|
|
const session = await auth();
|
|
if (!session?.user) redirect("/login");
|
|
if (!["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role)) {
|
|
redirect("/dashboard");
|
|
}
|
|
|
|
const projects = await db.project.findMany({
|
|
where: { status: { in: ["ACTIVE", "ON_HOLD"] } },
|
|
select: { id: true, name: true, code: true, projectType: true },
|
|
orderBy: { name: "asc" },
|
|
});
|
|
|
|
return <StoryboardGenerator projects={projects} />;
|
|
}
|