-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
164 lines (143 loc) · 6.47 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.
datasource postgresql {
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
}
model User {
id String @id @default(cuid())
name String @default("")
email String @unique @default("")
password String?
isAdmin Boolean @default(false)
createdAt DateTime? @default(now())
from_PushSubscription_user PushSubscription[] @relation("PushSubscription_user")
from_Dict_createdBy Dict[] @relation("Dict_createdBy")
from_DictItem_createdBy DictItem[] @relation("DictItem_createdBy")
from_Article_createdBy Article[] @relation("Article_createdBy")
from_Annotation_createdBy Annotation[] @relation("Annotation_createdBy")
}
model PushSubscription {
id String @id @default(cuid())
endpoint String @unique @default("")
expirationTime DateTime?
keys Json? @default("{\"p256dh\":\"\",\"auth\":\"\"}")
user User? @relation("PushSubscription_user", fields: [userId], references: [id])
userId String? @map("user")
createdAt DateTime? @default(now())
lastUsed DateTime? @default(now())
userAgent String @default("")
deviceType String @default("")
os String @default("")
browser String @default("")
@@index([userId])
}
model Topik {
id String @id @default(cuid())
no Int
year Int
level TopikLevelType
parentId Topik? @relation("Topik_parentId", fields: [parentIdId], references: [id])
parentIdId String? @map("parentId")
childrenId Topik[] @relation("Topik_parentId")
questionNumber Int
questionType TopikQuestionTypeType
score Int @default(0)
audioURL String @default("")
questionStem String @default("")
questionContent String @default("")
options Json? @default("[{\"content\":\"\",\"isCorrect\":true},{\"content\":\"\"},{\"content\":\"\"},{\"content\":\"\"}]")
explanation String @default("")
createdAt DateTime? @default(now())
@@index([parentIdId])
}
model Dict {
id String @id @default(cuid())
name String @default("")
public Boolean @default(false)
intlKey String @default("")
createdAt DateTime? @default(now())
createdBy User? @relation("Dict_createdBy", fields: [createdById], references: [id])
createdById String? @map("createdBy")
list DictItem[] @relation("Dict_list")
poster String @default("")
favorites DictItemFavorite[] @relation("DictItemFavorite_dict")
@@index([createdById])
}
model DictItem {
id String @id @default(cuid())
name String @default("")
trans Json? @default("{\"en\":[\"\"],\"zh-CN\":[\"\"],\"zh-TW\":[\"\"],\"ja\":[\"\"]}")
example String @default("")
exTrans Json? @default("{\"en\":[\"\"],\"zh-CN\":[\"\"],\"zh-TW\":[\"\"],\"ja\":[\"\"]}")
createdAt DateTime? @default(now())
createdBy User? @relation("DictItem_createdBy", fields: [createdById], references: [id])
createdById String? @map("createdBy")
dict Dict[] @relation("Dict_list")
favoriteIn DictItemFavorite[] @relation("DictItemFavorite_item")
@@index([createdById])
}
model DictItemFavorite {
id String @id @default(cuid())
dict Dict? @relation("DictItemFavorite_dict", fields: [dictId], references: [id])
dictId String? @map("dict")
item DictItem? @relation("DictItemFavorite_item", fields: [itemId], references: [id])
itemId String? @map("item")
favoritedAt DateTime? @default(now())
@@index([dictId])
@@index([itemId])
}
model Article {
id String @id @default(cuid())
title String @default("")
type ArticleTypeType
poster String @default("")
description String @default("")
subtitles Json? @default("[{\"title\":\"MOVIE S01E01\",\"subtitles\":{\"ko\":{\"label\":\"Korean\",\"filename\":\"\"},\"zh-Hans\":{\"label\":\"Chinese\",\"filename\":\"\"},\"en\":{\"label\":\"English\",\"filename\":\"\"},\"ja\":{\"label\":\"Japanese\",\"filename\":\"\"}}}]")
content String @default("")
createdAt DateTime? @default(now())
createdBy User? @relation("Article_createdBy", fields: [createdById], references: [id])
createdById String? @map("createdBy")
from_Annotation_articleId Annotation[] @relation("Annotation_articleId")
@@index([createdById])
}
model Annotation {
id String @id @default(cuid())
type AnnotationTypeType
articleId Article? @relation("Annotation_articleId", fields: [articleIdId], references: [id])
articleIdId String? @map("articleId")
chapterId String @default("")
text String @default("")
content String @default("")
color String @default("")
createdAt DateTime? @default(now())
createdBy User? @relation("Annotation_createdBy", fields: [createdById], references: [id])
createdById String? @map("createdBy")
updatedAt DateTime? @default(now()) @updatedAt
range Json? @default("{\"start\":{\"paragraphIndex\":0,\"offset\":0},\"end\":{\"paragraphIndex\":0,\"offset\":0}}")
@@index([articleIdId])
@@index([createdById])
}
enum TopikLevelType {
TOPIK_I
TOPIK_II
}
enum TopikQuestionTypeType {
LISTENING
READING
WRITING
}
enum ArticleTypeType {
MOVIE
TEXT
EPUB
}
enum AnnotationTypeType {
NOTE
HIGHLIGHT
}