mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-07-04 01:10:53 +00:00
25 lines
762 B
TypeScript
25 lines
762 B
TypeScript
import prisma from "@/lib/prisma";
|
|
import { UserTable } from "./user-table";
|
|
import { Role } from "@/generated/client";
|
|
import { UserConfig } from "./user-table";
|
|
import type { User, Problem } from "@/generated/client";
|
|
|
|
interface GenericPageProps {
|
|
userType: "admin" | "teacher" | "guest" | "problem";
|
|
config: UserConfig;
|
|
}
|
|
|
|
export default async function GenericPage({
|
|
userType,
|
|
config,
|
|
}: GenericPageProps) {
|
|
if (userType === "problem") {
|
|
const data: Problem[] = await prisma.problem.findMany({});
|
|
return <UserTable config={config} data={data} />;
|
|
} else {
|
|
const role = userType.toUpperCase() as Role;
|
|
const data: User[] = await prisma.user.findMany({ where: { role } });
|
|
return <UserTable config={config} data={data} />;
|
|
}
|
|
}
|