mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(prisma): add user and problem relations to Submission model
This commit is contained in:
parent
895c3f779d
commit
7dbf06b99f
@ -30,8 +30,9 @@ model User {
|
|||||||
// Optional for WebAuthn support
|
// Optional for WebAuthn support
|
||||||
Authenticator Authenticator[]
|
Authenticator Authenticator[]
|
||||||
|
|
||||||
role Role @default(GUEST)
|
role Role @default(GUEST)
|
||||||
problems Problem[]
|
problems Problem[]
|
||||||
|
Submission Submission[]
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@ -44,20 +45,20 @@ enum Difficulty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Problem {
|
model Problem {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
displayId Int @unique
|
displayId Int @unique
|
||||||
title String
|
title String
|
||||||
description String
|
description String
|
||||||
solution String
|
solution String
|
||||||
difficulty Difficulty @default(EASY)
|
difficulty Difficulty @default(EASY)
|
||||||
published Boolean @default(false)
|
published Boolean @default(false)
|
||||||
userId String
|
userId String
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
timeLimit Int @default(1000)
|
||||||
|
memoryLimit Int @default(128)
|
||||||
templates Template[]
|
templates Template[]
|
||||||
testcases Testcase[]
|
testcases Testcase[]
|
||||||
|
Submission Submission[]
|
||||||
timeLimit Int @default(1000)
|
|
||||||
memoryLimit Int @default(128)
|
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([difficulty])
|
@@index([difficulty])
|
||||||
@ -110,23 +111,38 @@ model Template {
|
|||||||
@@id([problemId, language])
|
@@id([problemId, language])
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ExitCode {
|
enum Status {
|
||||||
SE // System Error
|
PD // PENDING
|
||||||
CS // Compilation Success
|
QD // QUEUED
|
||||||
|
CP // COMPILING
|
||||||
CE // Compilation Error
|
CE // Compilation Error
|
||||||
|
CS // Compilation Success
|
||||||
|
RU // RUNNING
|
||||||
TLE // Time Limit Exceeded
|
TLE // Time Limit Exceeded
|
||||||
MLE // Memory Limit Exceeded
|
MLE // Memory Limit Exceeded
|
||||||
RE // Runtime Error
|
RE // Runtime Error
|
||||||
AC // Accepted
|
AC // Accepted
|
||||||
WA // Wrong Answer
|
WA // Wrong Answer
|
||||||
|
SE // System Error
|
||||||
}
|
}
|
||||||
|
|
||||||
model JudgeResult {
|
model Submission {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
output String
|
language EditorLanguage
|
||||||
exitCode ExitCode
|
code String
|
||||||
|
status Status
|
||||||
|
message String?
|
||||||
executionTime Int?
|
executionTime Int?
|
||||||
memoryUsage Int?
|
memoryUsage Int?
|
||||||
|
|
||||||
|
userId String
|
||||||
|
problemId String
|
||||||
|
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
problem Problem @relation(fields: [problemId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
model Testcase {
|
model Testcase {
|
||||||
|
Loading…
Reference in New Issue
Block a user