Initial commit: Edu Helper (Docker, React, Express, Prisma)
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
TUTOR
|
||||
STUDENT
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
passwordHash String
|
||||
role Role
|
||||
displayName String?
|
||||
|
||||
tutoringAssignments TutorAssignment[] @relation("TutorInAssignment")
|
||||
studentAssignment TutorAssignment? @relation("StudentInAssignment")
|
||||
|
||||
questions Question[]
|
||||
chatMessages ChatMessage[]
|
||||
textbooks Textbook[]
|
||||
tests Test[]
|
||||
reports Report[]
|
||||
hallPhotos HallPhoto[]
|
||||
}
|
||||
|
||||
model TutorAssignment {
|
||||
tutorId Int
|
||||
studentId Int @unique
|
||||
tutor User @relation("TutorInAssignment", fields: [tutorId], references: [id], onDelete: Cascade)
|
||||
student User @relation("StudentInAssignment", fields: [studentId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([tutorId, studentId])
|
||||
}
|
||||
|
||||
model Setting {
|
||||
key String @id
|
||||
value String
|
||||
}
|
||||
|
||||
model ChatMessage {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
role String
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Question {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
text String
|
||||
answer String?
|
||||
date String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Textbook {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
topic String
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Test {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
topic String
|
||||
questions String
|
||||
createdAt DateTime @default(now())
|
||||
results TestResult[]
|
||||
}
|
||||
|
||||
model TestResult {
|
||||
id Int @id @default(autoincrement())
|
||||
testId Int
|
||||
answers String
|
||||
score Int
|
||||
total Int
|
||||
createdAt DateTime @default(now())
|
||||
test Test @relation(fields: [testId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Report {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
date String
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model HallPhoto {
|
||||
id Int @id @default(autoincrement())
|
||||
studentId Int
|
||||
student User @relation(fields: [studentId], references: [id], onDelete: Cascade)
|
||||
date String
|
||||
fileName String
|
||||
originalName String @default("")
|
||||
mimeType String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user