20 lines
586 B
TypeScript
20 lines
586 B
TypeScript
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import { db } from "@/lib/db";
|
|
import { PlaylistClient } from "./PlaylistClient";
|
|
|
|
export const metadata = { title: "Playlist" };
|
|
|
|
export default async function PlaylistPage() {
|
|
const session = await auth();
|
|
if (!session?.user) redirect("/login");
|
|
|
|
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 <PlaylistClient projects={projects} />;
|
|
}
|