diff --git a/prisma/seed.ts b/prisma/seed.ts index 87a72d8..89f4d51 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -51,6 +51,28 @@ const editorLanguageConfigData: Prisma.EditorLanguageConfigCreateInput[] = [ }, ]; +const testcaseDataConfigData = [ + { + label: "l1", + value: "[2,4,3]", + index: 0, + config: { + type: "STRING", + pattern: "^\\[(\\d+,)*\\d+\\]$", + }, + }, + { + label: "l2", + value: "[5,6,4]", + index: 1, + config: { + type: "STRING", + pattern: "^\\[(\\d+,)*\\d+\\]$", + }, + }, +]; + + const userData: Prisma.UserCreateInput[] = [ { name: "cfngc4594", @@ -1100,6 +1122,25 @@ export async function main() { for (const u of userData) { await prisma.user.create({ data: u }); } + + // 插入 TestcaseData 和其配置 + for (const item of testcaseDataConfigData) { + const testcaseData = await prisma.testcaseData.create({ + data: { + label: item.label, + value: item.value, + index: item.index, + }, + }); + + await prisma.testcaseDataConfig.create({ + data: { + testcaseDataId: testcaseData.id, + type: item.config.type, + pattern: item.config.pattern, + }, + }); + } } -main(); +main(); \ No newline at end of file diff --git a/src/components/run-code.tsx b/src/components/run-code.tsx index b8da82a..bddf9f1 100644 --- a/src/components/run-code.tsx +++ b/src/components/run-code.tsx @@ -9,7 +9,7 @@ import { import { cn } from "@/lib/utils"; import { useState } from "react"; import { Session } from "next-auth"; -import { judge } from "@/actions/judge"; +import { judge } from "@/actions/randomjudge"; import { useTranslations } from "next-intl"; import { Button } from "@/components/ui/button"; import { useProblem } from "@/hooks/use-problem";