2024-11-25 12:17:49 +00:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2024-11-28 23:26:37 +00:00
|
|
|
provider = "mysql"
|
2024-11-25 12:17:49 +00:00
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2024-12-06 00:00:32 +00:00
|
|
|
id String @id @default(cuid())
|
|
|
|
username String? @unique
|
|
|
|
role Role @default(STUDENT)
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
providerId String @unique
|
2024-11-28 23:26:37 +00:00
|
|
|
|
2024-12-02 13:38:01 +00:00
|
|
|
Class Class[]
|
|
|
|
SentMessages UserMessage[] @relation("SentMessages")
|
|
|
|
ReceivedMessages UserMessage[] @relation("ReceivedMessages")
|
|
|
|
RoomSurveyAnswerUser RoomSurveyAnswerUser[]
|
2024-11-28 23:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model UserMessage {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
|
|
|
|
sender User @relation(fields: [sender_user_Id], references: [id], name: "SentMessages")
|
|
|
|
sender_user_Id String
|
|
|
|
|
|
|
|
receiver User @relation(fields: [receiver_user_Id], references: [id], name: "ReceivedMessages")
|
|
|
|
receiver_user_Id String
|
2024-12-02 13:38:01 +00:00
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-11-28 23:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Class {
|
2024-12-02 13:38:01 +00:00
|
|
|
id String @id @default(cuid())
|
|
|
|
name String
|
|
|
|
createdAt DateTime @default(now())
|
2024-11-28 23:26:37 +00:00
|
|
|
|
|
|
|
ClassRoom Room[]
|
2024-12-02 13:38:01 +00:00
|
|
|
Students User[]
|
2024-11-28 23:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Room {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String
|
2024-12-02 13:38:01 +00:00
|
|
|
Class Class[]
|
2024-11-28 23:26:37 +00:00
|
|
|
Messages RoomMessage[]
|
|
|
|
Documents RoomDocument[]
|
2024-12-02 13:38:01 +00:00
|
|
|
Surveys RoomSurvey[]
|
2024-11-28 23:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model RoomMessage {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
Room Room @relation(fields: [roomId], references: [id])
|
|
|
|
roomId String
|
|
|
|
}
|
|
|
|
|
|
|
|
model RoomDocument {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
Room Room @relation(fields: [roomId], references: [id])
|
|
|
|
roomId String
|
|
|
|
}
|
|
|
|
|
2024-12-02 13:38:01 +00:00
|
|
|
model RoomSurvey {
|
2024-12-03 16:35:11 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2024-12-02 13:38:01 +00:00
|
|
|
content String
|
2024-12-03 16:35:11 +00:00
|
|
|
Room Room @relation(fields: [roomId], references: [id])
|
2024-12-02 13:38:01 +00:00
|
|
|
roomId String
|
2024-12-03 16:35:11 +00:00
|
|
|
createdAt DateTime @default(now())
|
2024-12-02 13:38:01 +00:00
|
|
|
endAt DateTime?
|
|
|
|
|
|
|
|
Answers RoomSurveyAnswer[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model RoomSurveyAnswer {
|
2024-12-03 16:35:11 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
Survey RoomSurvey @relation(fields: [surveyId], references: [id])
|
|
|
|
surveyId Int
|
|
|
|
isRight Boolean
|
|
|
|
Users RoomSurveyAnswerUser[]
|
2024-12-02 13:38:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model RoomSurveyAnswerUser {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
User User @relation(fields: [userId], references: [id])
|
|
|
|
userId String
|
|
|
|
Answer RoomSurveyAnswer @relation(fields: [answerId], references: [id])
|
|
|
|
answerId Int
|
|
|
|
}
|
|
|
|
|
2024-11-28 23:26:37 +00:00
|
|
|
enum Role {
|
|
|
|
STUDENT
|
2024-12-02 12:57:47 +00:00
|
|
|
ADMIN
|
2024-12-06 00:00:32 +00:00
|
|
|
}
|