-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
255 lines (230 loc) · 7.8 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
// previewFeatures = []
}
generator dbml {
provider = "prisma-dbml-generator"
}
model announcement {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId Int?
updatedId Int?
title String @db.VarChar(500)
description String @db.VarChar(1000)
isActive Boolean @default(true)
}
model Currency {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
sign String? @db.VarChar(255)
name String? @db.VarChar(255)
code String? @db.VarChar(255)
isActive Boolean @default(true)
transactions Transaction[]
userCurrencies UserCurrency[]
}
model List {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
title String @db.VarChar(200)
description String? @db.VarChar(500)
color String? @db.VarChar(200)
emoji String? @db.VarChar(200)
isShared Boolean? @default(true)
isActive Boolean? @default(true)
userId String?
teamId String?
transactions Transaction[]
user User? @relation(fields: [userId], references: [id])
team Team? @relation(fields: [teamId], references: [id])
}
model Log {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
type String @db.VarChar(200)
request_type String @db.VarChar(200)
operation String @db.VarChar(500)
ip String? @db.VarChar(500)
parameterNum1 Decimal? @default(0) @db.Decimal
parameterNum2 Decimal? @default(0) @db.Decimal
parameterNum3 Decimal? @default(0) @db.Decimal
parameterStr1 String? @db.VarChar(1000)
parameterStr2 String? @db.VarChar(1000)
parameterStr3 String? @db.VarChar(1000)
response String? @db.VarChar(1000)
isSuccess Boolean @default(true)
teamId Int?
teamName String? @db.VarChar(200)
}
model Menu {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
name String? @unique @db.VarChar(500)
path String? @db.VarChar(500)
isParamId Boolean @default(true)
isParamUsername Boolean @default(true)
isParamTeamName Boolean @default(true)
isQueryEmail Boolean @default(true)
isQueryMemberId Boolean @default(true)
isQueryListId Boolean @default(true)
isActive Boolean @default(true)
menuType Boolean @default(true)
nameEn String? @db.VarChar(500)
}
model Plan {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
name String? @unique @db.VarChar(500)
monthlyPrice Decimal? @default(0)
yearlyPrice Decimal? @default(0)
description String? @db.VarChar
proUser ProUser[]
}
model ProUser {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
billingCycle String @db.VarChar(200)
expireDate DateTime? @db.Timestamp(6)
userId String?
planId String?
plan Plan? @relation(fields: [planId], references: [id])
user User? @relation(fields: [userId], references: [id])
@@unique([userId, planId])
}
model Role {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
name String? @unique @db.VarChar(500)
description String? @db.VarChar(500)
teamRole TeamRole[]
User User? @relation(fields: [userId], references: [id])
userId String?
}
model Team {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
name String @unique @db.VarChar(20)
lists List[]
teamMembers TeamMember[]
}
model TeamMember {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
email String? @db.VarChar(500)
mailSecretCode String? @db.VarChar(500)
mailSecretCodeTime DateTime? @db.Timestamp(6)
isAccepted Boolean @default(true)
teamId String?
userId String?
teamRoles TeamRole[]
user User? @relation(fields: [userId], references: [id])
team Team? @relation(fields: [teamId], references: [id])
@@unique([teamId, userId])
}
model TeamRole {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
roleId String?
teamMemberId String?
teamMember TeamMember? @relation(fields: [teamMemberId], references: [id])
role Role? @relation(fields: [roleId], references: [id])
@@unique([roleId, teamMemberId], name: "UQ_b362c4b0b98e02282e55b1f4696")
}
model Transaction {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
title String @db.VarChar(255)
note String? @db.VarChar(255)
type Int @default(0)
amount Decimal @default(0) @db.Decimal
tax Decimal @default(0) @db.Decimal
total Decimal @default(0) @db.Decimal
isLocked Boolean @default(true)
currencyId String?
listId String?
list List? @relation(fields: [listId], references: [id])
currency Currency? @relation(fields: [currencyId], references: [id])
transactionLogs TransactionLog[]
}
model TransactionLog {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
amount Decimal @default(0) @db.Decimal
transactionId String?
transaction Transaction? @relation(fields: [transactionId], references: [id])
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
uuid String? @default(uuid())
username String @unique @db.VarChar(20)
email String @unique @db.VarChar(64)
password String @db.VarChar(500)
salt String @db.VarChar(500)
firstname String @db.VarChar(200)
lastname String @db.VarChar(200)
isApproved Boolean @default(false)
lists List[]
role Role[]
proUsers ProUser[]
teamMembers TeamMember[]
userCurrencies UserCurrency[]
@@unique([username, email, uuid])
}
model UserCurrency {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdId String?
updatedId String?
currencyId String?
userId String?
user User? @relation(fields: [userId], references: [id])
currency Currency? @relation(fields: [currencyId], references: [id])
@@unique([currencyId, userId])
}