bw-hspc-contest-env/web/prisma/schema.prisma

105 lines
2.7 KiB
Plaintext
Raw Normal View History

2023-04-27 22:26:54 -04:00
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
2023-08-26 11:07:09 -04:00
id Int @id @default(autoincrement())
username String @unique
passwordHash String
passwordSalt String
sessions Session[]
2023-04-28 13:42:16 -04:00
}
model Session {
2023-08-26 11:07:09 -04:00
token String @id @default(uuid())
2023-04-28 13:42:16 -04:00
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
userId Int
2023-04-27 22:26:54 -04:00
}
2023-04-28 10:30:46 -04:00
enum SubmissionState {
2023-05-07 19:00:55 -04:00
Queued
2023-04-28 10:30:46 -04:00
InReview
Correct
Incorrect
}
enum SubmissionStateReason {
BuildError
TimeLimitExceeded
IncorrectOverriddenAsCorrect
SandboxError
}
2023-04-28 10:30:46 -04:00
model Submission {
2024-01-16 17:20:21 -05:00
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])
2023-04-28 10:30:46 -04:00
}
2023-04-28 20:06:28 -04:00
model Problem {
2023-04-29 13:21:23 -04:00
id Int @id @default(autoincrement())
friendlyName String @unique
2023-05-07 16:30:56 -04:00
pascalName String @unique
2023-04-28 20:06:28 -04:00
sampleInput String
sampleOutput String
realInput String
realOutput String
2023-05-06 12:36:52 -04:00
submissions Submission[]
2023-04-29 21:09:39 -04:00
contests Contest[] @relation("ProblemContestRelation")
2023-04-28 20:06:28 -04:00
}
2023-04-29 11:42:35 -04:00
model Team {
2023-05-08 21:21:53 -04:00
id Int @id @default(autoincrement())
name String @unique
submissions Submission[]
contests Contest[] @relation("TeamContestRelation")
password String
activeTeam ActiveTeam?
language Language
}
enum Language {
Java
CSharp
2024-01-16 17:20:21 -05:00
CPP
2023-05-06 00:01:27 -04:00
}
model ActiveTeam {
id Int @id @default(autoincrement())
teamId Int @unique
team Team @relation(fields: [teamId], references: [id])
sessionToken String? @unique
sessionCreatedAt DateTime?
2023-05-06 12:36:52 -04:00
contestId Int
contest Contest @relation(fields: [contestId], references: [id])
2023-04-29 21:09:39 -04:00
}
model Contest {
2023-05-06 12:36:52 -04:00
id Int @id @default(autoincrement())
name String @unique
2023-05-06 12:36:52 -04:00
teams Team[] @relation("TeamContestRelation")
problems Problem[] @relation("ProblemContestRelation")
activeTeams ActiveTeam[]
2023-05-08 13:58:47 -04:00
submissions Submission[]
2023-05-08 21:21:53 -04:00
startTime DateTime?
2023-04-29 11:42:35 -04:00
}