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

67 lines
1.6 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-04-29 13:21:23 -04:00
id Int @id @default(autoincrement())
username String @unique
password String
Submission Session[]
2023-04-28 13:42:16 -04:00
}
model Session {
token String @id
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 {
InReview
Correct
Incorrect
}
model Submission {
2023-04-29 15:27:51 -04:00
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
gradedAt DateTime?
state SubmissionState
actualOutput String
message String?
team Team @relation(fields: [teamId], references: [id])
teamId Int
problem Problem @relation(fields: [problemId], references: [id])
problemId Int
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-04-28 20:06:28 -04:00
sampleInput String
sampleOutput String
realInput String
realOutput String
2023-04-29 13:21:23 -04:00
Submission 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-04-29 13:21:23 -04:00
id Int @id @default(autoincrement())
name String @unique
Submission Submission[]
2023-04-29 21:09:39 -04:00
contests Contest[] @relation("TeamContestRelation")
}
model Contest {
id Int @id @default(autoincrement())
name String
teams Team[] @relation("TeamContestRelation")
problems Problem[] @relation("ProblemContestRelation")
2023-04-29 11:42:35 -04:00
}