-
Notifications
You must be signed in to change notification settings - Fork 9
/
schema.prisma
260 lines (233 loc) · 8.33 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
256
257
258
259
260
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
// prod: 10 connections, 30s timeout
url = env("DATABASE_URL")
}
model Order {
id String @id @default(cuid())
fid String @unique
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
deletedAt DateTime? @db.Timestamptz(6)
}
model InviteCode {
id String @id @default(cuid())
active Boolean @default(true)
limit Int @default(1)
note String?
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
deletedAt DateTime? @db.Timestamptz(6)
claims User[]
}
model Otp {
id String @id @default(cuid())
code String @unique @default(cuid())
active Boolean @default(false)
userId String
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model User {
id String @id
name String
avatarUrl String?
email String? @unique
plan String @default("basic")
role String @default("user")
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
inviteCodeId String?
planExpiry DateTime? @db.Timestamptz(6)
planTokenId String?
planWalletAddress String?
moderatedChannels ModeratedChannel[]
notifications Notification[]
otps Otp[]
usage Usage[]
invite InviteCode? @relation(fields: [inviteCodeId], references: [id])
}
model ModeratedChannel {
id String @id
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
active Boolean @default(true)
imageUrl String?
url String?
feedType String @default("custom")
userId String
banThreshold Int?
slowModeHours Int @default(0)
excludeCohosts Boolean @default(true)
excludeUsernames String @default("[]")
inclusionRuleSet String?
exclusionRuleSet String?
comods Comods[]
cooldowns Cooldown[]
delegates Delegate[]
downvotes Downvote[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
moderationLogs ModerationLog[]
roles Role[]
signerAllocations SignerAllocation[]
usage Usage[]
}
model Delegate {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
fid String
username String
avatarUrl String?
channelId String
roleId String
channel ModeratedChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
@@unique([fid, roleId, channelId])
}
model Role {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
name String
description String?
channelId String
isEveryoneRole Boolean @default(false)
isCohostRole Boolean @default(false)
permissions String
delegates Delegate[]
channel ModeratedChannel @relation(fields: [channelId], references: [id])
}
model Downvote {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
fid String
castHash String
username String
avatarUrl String?
channelId String
channel ModeratedChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
@@unique([fid, castHash])
}
model Comods {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
fid String
username String
avatarUrl String?
channelId String
channel ModeratedChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
@@unique([fid, channelId])
}
model ModerationLog {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
action String
reason String
castHash String?
actor String @default("system")
affectedUserFid String
affectedUsername String
affectedUserAvatarUrl String?
channelId String
castText String?
channel ModeratedChannel @relation(fields: [channelId], references: [id])
@@index([channelId, createdAt])
@@index([action])
}
model Status {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
active Boolean @default(true)
message String
expiresAt DateTime? @db.Timestamptz(6)
type String
link String?
}
model Cooldown {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
active Boolean @default(true)
affectedUserId String
channelId String
expiresAt DateTime? @db.Timestamptz(6)
channel ModeratedChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
@@unique([affectedUserId, channelId])
}
model Usage {
id String @id @default(uuid())
userId String
channelId String
castsProcessed Int @default(0)
monthYear String
channel ModeratedChannel @relation(fields: [channelId], references: [id])
user User @relation(fields: [userId], references: [id])
@@unique([channelId, monthYear])
@@index([channelId, monthYear])
}
model CastLog {
hash String @id
replyCount Int @default(0)
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
status String
channelId String
}
model Signer {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
active Boolean @default(true)
fid String
username String
avatarUrl String
signerUuid String
allocations SignerAllocation[]
}
model SignerAllocation {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
active Boolean @default(true)
signerId String
channelId String
channel ModeratedChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
signer Signer @relation(fields: [signerId], references: [id], onDelete: Cascade)
}
model Notification {
id String @id @default(cuid())
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6)
type String
nonce String
message String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([nonce, userId])
}
model PartnerApiKey {
id String @id @default(cuid())
key String @unique
name String
expiresAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model PropagationDelayCheck {
id String @id @default(cuid())
createdAt DateTime @default(now())
arrivedAt DateTime? @db.Timestamptz(6)
updatedAt DateTime @updatedAt
hash String
src String
dst String
}