// import { setCurrentGameSystem } from "@/actions/GameSystems/client";
import { setCurrentGameSystem } from "@/actions/GameSystems/client";
import { auth } from "@/auth";
import { prisma } from "@/prisma/prismaClient";
import Link from "next/link";
export default async function GameSystem({
params: { id },
}: {
params: { id: string };
}) {
if (!id) throw "HOW DID YOU GET HERE?";
const gameSystem = await prisma.gameSystem.findFirst({
where: {
id,
},
include: {
schemas: {
select: {
name: true,
id: true,
publications: {
select: {
name: true,
id: true,
},
},
},
},
},
// select: {
// id: true,
// name: true,
// },
});
const session = await auth();
session?.user?.id && (await setCurrentGameSystem(session.user.id, id));
return (
<>
Game System
{gameSystem?.name}
<>
Create New Schema
{gameSystem?.schemas.map((schema) => (
- {schema.name}
))}
{!gameSystem?.schemas.length && (
- No schemas for {gameSystem?.name}
)}
>
>
);
}