mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
fix(prisma): update enum values for EditorLanguage to lowercase ('c' and 'cpp')
This commit is contained in:
parent
7a97e213fe
commit
4f6a37df17
@ -40,8 +40,8 @@ model Problem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum EditorLanguage {
|
enum EditorLanguage {
|
||||||
C
|
c
|
||||||
CPP
|
cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
model Template {
|
model Template {
|
||||||
|
@ -8,8 +8,8 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { getPath } from "@/lib/utils";
|
import { getPath } from "@/lib/utils";
|
||||||
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { EditorLanguage } from "@/types/editor-language";
|
|
||||||
import LanguageServerConfig from "@/config/language-server";
|
import LanguageServerConfig from "@/config/language-server";
|
||||||
import { EditorLanguageConfig } from "@/config/editor-language";
|
import { EditorLanguageConfig } from "@/config/editor-language";
|
||||||
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
||||||
|
@ -4,7 +4,7 @@ import tar from "tar-stream";
|
|||||||
import Docker from "dockerode";
|
import Docker from "dockerode";
|
||||||
import { Readable, Writable } from "stream";
|
import { Readable, Writable } from "stream";
|
||||||
import { JudgeConfig } from "@/config/judge";
|
import { JudgeConfig } from "@/config/judge";
|
||||||
import { EditorLanguage } from "@/types/editor-language";
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { ExitCode, JudgeResultMetadata } from "@/types/judge";
|
import { ExitCode, JudgeResultMetadata } from "@/types/judge";
|
||||||
|
|
||||||
// Docker client initialization
|
// Docker client initialization
|
||||||
|
@ -4,15 +4,15 @@ import { EditorLanguageMetadata } from "@/types/editor-language";
|
|||||||
|
|
||||||
// Define language configurations
|
// Define language configurations
|
||||||
const EditorLanguageConfig: Record<EditorLanguage, EditorLanguageMetadata> = {
|
const EditorLanguageConfig: Record<EditorLanguage, EditorLanguageMetadata> = {
|
||||||
[EditorLanguage.C]: {
|
[EditorLanguage.c]: {
|
||||||
id: EditorLanguage.C,
|
id: EditorLanguage.c,
|
||||||
label: "C",
|
label: "C",
|
||||||
fileName: "main",
|
fileName: "main",
|
||||||
fileExtension: ".c",
|
fileExtension: ".c",
|
||||||
icon: COriginal,
|
icon: COriginal,
|
||||||
},
|
},
|
||||||
[EditorLanguage.CPP]: {
|
[EditorLanguage.cpp]: {
|
||||||
id: EditorLanguage.CPP,
|
id: EditorLanguage.cpp,
|
||||||
label: "C++",
|
label: "C++",
|
||||||
fileName: "main",
|
fileName: "main",
|
||||||
fileExtension: ".cpp",
|
fileExtension: ".cpp",
|
||||||
@ -21,6 +21,6 @@ const EditorLanguageConfig: Record<EditorLanguage, EditorLanguageMetadata> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Default language configuration
|
// Default language configuration
|
||||||
const DefaultEditorLanguageConfig = EditorLanguageConfig[EditorLanguage.C]; // Default to C language
|
const DefaultEditorLanguageConfig = EditorLanguageConfig[EditorLanguage.c]; // Default to C language
|
||||||
|
|
||||||
export { EditorLanguageConfig, DefaultEditorLanguageConfig };
|
export { EditorLanguageConfig, DefaultEditorLanguageConfig };
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { EditorLanguage } from "@/types/editor-language";
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { EditorLanguageConfig } from "./editor-language";
|
import { EditorLanguageConfig } from "./editor-language";
|
||||||
import { DockerMetadata, JudgeMetadata } from "@/types/judge";
|
import { DockerMetadata, JudgeMetadata } from "@/types/judge";
|
||||||
|
|
||||||
export const DockerConfig: Record<EditorLanguage, DockerMetadata> = {
|
export const DockerConfig: Record<EditorLanguage, DockerMetadata> = {
|
||||||
[EditorLanguage.C]: {
|
[EditorLanguage.c]: {
|
||||||
image: "gcc",
|
image: "gcc",
|
||||||
tag: "latest",
|
tag: "latest",
|
||||||
workingDir: "/src",
|
workingDir: "/src",
|
||||||
@ -12,7 +12,7 @@ export const DockerConfig: Record<EditorLanguage, DockerMetadata> = {
|
|||||||
compileOutputLimit: 1 * 1024 * 1024,
|
compileOutputLimit: 1 * 1024 * 1024,
|
||||||
runOutputLimit: 1 * 1024 * 1024,
|
runOutputLimit: 1 * 1024 * 1024,
|
||||||
},
|
},
|
||||||
[EditorLanguage.CPP]: {
|
[EditorLanguage.cpp]: {
|
||||||
image: "gcc",
|
image: "gcc",
|
||||||
tag: "latest",
|
tag: "latest",
|
||||||
workingDir: "/src",
|
workingDir: "/src",
|
||||||
@ -24,12 +24,12 @@ export const DockerConfig: Record<EditorLanguage, DockerMetadata> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const JudgeConfig: Record<EditorLanguage, JudgeMetadata> = {
|
export const JudgeConfig: Record<EditorLanguage, JudgeMetadata> = {
|
||||||
[EditorLanguage.C]: {
|
[EditorLanguage.c]: {
|
||||||
editorLanguageMetadata: EditorLanguageConfig[EditorLanguage.C],
|
editorLanguageMetadata: EditorLanguageConfig[EditorLanguage.c],
|
||||||
dockerMetadata: DockerConfig[EditorLanguage.C],
|
dockerMetadata: DockerConfig[EditorLanguage.c],
|
||||||
},
|
},
|
||||||
[EditorLanguage.CPP]: {
|
[EditorLanguage.cpp]: {
|
||||||
editorLanguageMetadata: EditorLanguageConfig[EditorLanguage.CPP],
|
editorLanguageMetadata: EditorLanguageConfig[EditorLanguage.cpp],
|
||||||
dockerMetadata: DockerConfig[EditorLanguage.CPP],
|
dockerMetadata: DockerConfig[EditorLanguage.cpp],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
import { EditorLanguage } from "@/types/editor-language";
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { EditorLanguageConfig } from "./editor-language";
|
import { EditorLanguageConfig } from "./editor-language";
|
||||||
import { LanguageServerMetadata } from "@/types/language-server";
|
import { LanguageServerMetadata } from "@/types/language-server";
|
||||||
|
|
||||||
const LanguageServerConfig: Record<EditorLanguage, LanguageServerMetadata> = {
|
const LanguageServerConfig: Record<EditorLanguage, LanguageServerMetadata> = {
|
||||||
[EditorLanguage.C]: {
|
[EditorLanguage.c]: {
|
||||||
protocol: process.env.NEXT_PUBLIC_LSP_C_PROTOCOL || "ws",
|
protocol: process.env.NEXT_PUBLIC_LSP_C_PROTOCOL || "ws",
|
||||||
hostname: process.env.NEXT_PUBLIC_LSP_C_HOSTNAME || "localhost",
|
hostname: process.env.NEXT_PUBLIC_LSP_C_HOSTNAME || "localhost",
|
||||||
port: process.env.NEXT_PUBLIC_LSP_C_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_C_PORT, 10) : 4594,
|
port: process.env.NEXT_PUBLIC_LSP_C_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_C_PORT, 10) : 4594,
|
||||||
path: process.env.NEXT_PUBLIC_LSP_C_PATH || "/clangd",
|
path: process.env.NEXT_PUBLIC_LSP_C_PATH || "/clangd",
|
||||||
lang: EditorLanguageConfig[EditorLanguage.C],
|
lang: EditorLanguageConfig[EditorLanguage.c],
|
||||||
},
|
},
|
||||||
[EditorLanguage.CPP]: {
|
[EditorLanguage.cpp]: {
|
||||||
protocol: process.env.NEXT_PUBLIC_LSP_CPP_PROTOCOL || "ws",
|
protocol: process.env.NEXT_PUBLIC_LSP_CPP_PROTOCOL || "ws",
|
||||||
hostname: process.env.NEXT_PUBLIC_LSP_CPP_HOSTNAME || "localhost",
|
hostname: process.env.NEXT_PUBLIC_LSP_CPP_HOSTNAME || "localhost",
|
||||||
port: process.env.NEXT_PUBLIC_LSP_CPP_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_CPP_PORT, 10) : 4595,
|
port: process.env.NEXT_PUBLIC_LSP_CPP_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_CPP_PORT, 10) : 4595,
|
||||||
path: process.env.NEXT_PUBLIC_LSP_CPP_PATH || "/clangd",
|
path: process.env.NEXT_PUBLIC_LSP_CPP_PATH || "/clangd",
|
||||||
lang: EditorLanguageConfig[EditorLanguage.CPP],
|
lang: EditorLanguageConfig[EditorLanguage.cpp],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { EditorLanguage } from "@/types/editor-language";
|
import { EditorLanguage } from "@prisma/client";
|
||||||
|
|
||||||
export const TEMP_DEFAULT_EDITOR_VALUE: Record<EditorLanguage, string> = {
|
export const TEMP_DEFAULT_EDITOR_VALUE: Record<EditorLanguage, string> = {
|
||||||
[EditorLanguage.C]: `/**
|
[EditorLanguage.c]: `/**
|
||||||
* Note: The returned array must be malloced, assume caller calls free().
|
* Note: The returned array must be malloced, assume caller calls free().
|
||||||
*/
|
*/
|
||||||
int* twoSum(int* nums, int numsSize, int target, int* returnSize) {
|
int* twoSum(int* nums, int numsSize, int target, int* returnSize) {
|
||||||
|
|
||||||
}`,
|
}`,
|
||||||
[EditorLanguage.CPP]: `class Solution {
|
[EditorLanguage.cpp]: `class Solution {
|
||||||
public:
|
public:
|
||||||
vector<int> twoSum(vector<int>& nums, int target) {
|
vector<int> twoSum(vector<int>& nums, int target) {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { MonacoTheme } from "@/types/monaco-theme";
|
import { MonacoTheme } from "@/types/monaco-theme";
|
||||||
import { createHighlighter, Highlighter } from "shiki";
|
import { createHighlighter, Highlighter } from "shiki";
|
||||||
import { EditorLanguage } from "@/types/editor-language";
|
|
||||||
|
|
||||||
// Get all values from the ProgrammingLanguage and Theme enums
|
// Get all values from the ProgrammingLanguage and Theme enums
|
||||||
const themes = Object.values(MonacoTheme);
|
const themes = Object.values(MonacoTheme);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
import { clsx, type ClassValue } from "clsx";
|
import { clsx, type ClassValue } from "clsx";
|
||||||
import { EditorLanguage } from "@/types/editor-language";
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import LanguageServerConfig from "@/config/language-server";
|
import LanguageServerConfig from "@/config/language-server";
|
||||||
|
|
||||||
export function cn(...inputs: ClassValue[]) {
|
export function cn(...inputs: ClassValue[]) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { getPath } from "@/lib/utils";
|
import { getPath } from "@/lib/utils";
|
||||||
import type { editor } from "monaco-editor";
|
import type { editor } from "monaco-editor";
|
||||||
|
import { EditorLanguage } from "@prisma/client";
|
||||||
import { JudgeResultMetadata } from "@/types/judge";
|
import { JudgeResultMetadata } from "@/types/judge";
|
||||||
import { EditorLanguage } from "@/types/editor-language";
|
|
||||||
import { createJSONStorage, persist } from "zustand/middleware";
|
import { createJSONStorage, persist } from "zustand/middleware";
|
||||||
import { LanguageServerMetadata } from "@/types/language-server";
|
import { LanguageServerMetadata } from "@/types/language-server";
|
||||||
import { DefaultEditorOptionConfig } from "@/config/editor-option";
|
import { DefaultEditorOptionConfig } from "@/config/editor-option";
|
||||||
|
Loading…
Reference in New Issue
Block a user