bw-hspc-contest-env/web/prisma/schema.prisma
David Poeschl 17515af25c
Include detailed run result info in DB & show in admin site (#10)
* Send detailed submission run result info to site/database

* Show SubmissionStateReason on site

* Mark Build/TLE errors as graded immediately

* Remove superfluous log
2023-12-19 16:40:31 -05:00

104 lines
2.5 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique
passwordHash String
passwordSalt String
sessions Session[]
}
model Session {
token String @id @default(uuid())
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
userId Int
}
enum SubmissionState {
Queued
InReview
Correct
Incorrect
}
enum SubmissionStateReason {
BuildError
TimeLimitExceeded
IncorrectOverriddenAsCorrect
SandboxError
}
model Submission {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
gradedAt DateTime?
state SubmissionState
stateReason SubmissionStateReason?
stateReasonDetails String?
actualOutput String?
commitHash String
diff String?
message String?
team Team @relation(fields: [teamId], references: [id])
teamId Int
problem Problem @relation(fields: [problemId], references: [id])
problemId Int
contestId Int
contest Contest @relation(fields: [contestId], references: [id])
}
model Problem {
id Int @id @default(autoincrement())
friendlyName String @unique
pascalName String @unique
sampleInput String
sampleOutput String
realInput String
realOutput String
submissions Submission[]
contests Contest[] @relation("ProblemContestRelation")
}
model Team {
id Int @id @default(autoincrement())
name String @unique
submissions Submission[]
contests Contest[] @relation("TeamContestRelation")
password String
activeTeam ActiveTeam?
language Language
}
enum Language {
Java
CSharp
}
model ActiveTeam {
id Int @id @default(autoincrement())
teamId Int @unique
team Team @relation(fields: [teamId], references: [id])
sessionToken String? @unique
sessionCreatedAt DateTime?
contestId Int
contest Contest @relation(fields: [contestId], references: [id])
}
model Contest {
id Int @id @default(autoincrement())
name String
teams Team[] @relation("TeamContestRelation")
problems Problem[] @relation("ProblemContestRelation")
activeTeams ActiveTeam[]
submissions Submission[]
startTime DateTime?
}