Files
twotalesanimation 4da80d29a9
Deploy / deploy (push) Failing after 46s
CSV shot implementation
2026-06-12 15:06:50 +02:00

40 lines
1.2 KiB
TypeScript

import { notFound, redirect } from "next/navigation";
import { db } from "@/lib/db";
import { auth } from "@/auth";
import { EdlImportClient } from "./EdlImportClient";
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const project = await db.project.findUnique({ where: { id }, select: { name: true } });
return { title: `Import VFX Pull — ${project?.name ?? "Project"}` };
}
export default async function ImportEdlPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const session = await auth();
if (!session?.user) redirect("/login");
if (!["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role)) {
redirect(`/projects/${id}`);
}
const project = await db.project.findUnique({
where: { id },
select: {
id: true,
name: true,
shots: { select: { shotCode: true } },
},
});
if (!project) notFound();
const existingShotCodes = new Set(project.shots.map((s) => s.shotCode));
return (
<EdlImportClient
projectId={project.id}
projectName={project.name}
existingShotCodes={existingShotCodes}
/>
);
}