mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat: change prototype seed.ts and run-code.tsx
This commit is contained in:
parent
16ec2d3730
commit
614552bfc6
@ -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[] = [
|
const userData: Prisma.UserCreateInput[] = [
|
||||||
{
|
{
|
||||||
name: "cfngc4594",
|
name: "cfngc4594",
|
||||||
@ -1100,6 +1122,25 @@ export async function main() {
|
|||||||
for (const u of userData) {
|
for (const u of userData) {
|
||||||
await prisma.user.create({ data: u });
|
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();
|
@ -9,7 +9,7 @@ import {
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Session } from "next-auth";
|
import { Session } from "next-auth";
|
||||||
import { judge } from "@/actions/judge";
|
import { judge } from "@/actions/randomjudge";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useProblem } from "@/hooks/use-problem";
|
import { useProblem } from "@/hooks/use-problem";
|
||||||
|
Loading…
Reference in New Issue
Block a user