-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
550 lines (488 loc) · 19.9 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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
// previewFeatures = []
}
generator dbml {
provider = "prisma-dbml-generator"
}
enum Role {
FOUNDER
MANAGER
OPERATOR
ADVISOR
EMPLOYEE
INVESTOR
}
enum InstitutionalRole {
ADMIN
MEMBER
}
enum ReleaseFrequencyType {
continuous @map("CONTINUOUS")
daily @map("DAILY")
weekly @map("WEEKLY")
monthly @map("MONTHLY")
yearly @map("YEARLY")
custom @map("CUSTOM")
}
enum CliffDurationType {
no_cliff @map("NO_CLIFF")
weeks @map("WEEKS")
months @map("MONTHS")
years @map("YEARS")
}
enum RecipeStatus {
ACCEPTED
PENDING
REVOKED
}
enum TransactionStatus {
PENDING
SUCCESS
FAILED
}
enum TransactionType {
VESTING_DEPLOYMENT
FUNDING_CONTRACT
ADDING_CLAIMS
TOKEN_DEPLOYMENT
REVOKE_CLAIM
ADMIN_WITHDRAW
}
enum ConfirmationStatus {
APPROVED
REJECTED
}
enum Permission {
ADMIN
READ
}
enum InvitationStatus {
PENDING
ACCEPTED
}
enum VestingContractStatus {
PENDING
SUCCESS
FAILED
INITIALIZED
}
enum VestingStatus {
INITIALIZED
WAITING_APPROVAL
WAITING_FUNDS
LIVE
CREATING
CREATED
COMPLETED
REVOKED
APPROVED
SUCCESS
FAILED
}
enum MilestoneVestingType {
SIMPLE
VESTED
}
model User {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
email String @unique
name String?
isAdmin Boolean @default(false) @map("is_admin")
wallets Wallet[]
organizations Organization[]
roles UserRole[]
permissions UserPermission[]
recipes Recipe[]
@@map("user")
}
model EmailVerification {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
email String @unique
code String @unique
name String?
company String?
expiredAt BigInt @map("expired_at")
@@map("email_verification")
}
model Wallet {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
address String @unique
userId String @map("user_id")
user User @relation(fields: [userId], references: [id]) // This should be array in the future
recipes Recipe[]
@@map("wallet")
}
model Organization {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
userId String @map("user_id")
user User @relation(fields: [userId], references: [id])
name String
email String
roles UserRole[]
tokens OrganizationToken[]
vestingContracts VestingContract[]
vestings Vesting[]
recipes Recipe[]
vestingTemplates VestingTemplate[]
members UserPermission[]
websites Website[]
transactions Transaction[]
entities Entity[]
projects Project[]
revokings Revoking[]
memberships Membership[]
milestoneVestingTemplates MilestoneVestingTemplate[]
@@map("organization")
}
model UserRole {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
role Role @default(FOUNDER)
userId String @map("user_id")
user User @relation(fields: [userId], references: [id])
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
isAccepted Boolean @default(false)
@@map("user_role")
}
model UserPermission {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
permission Permission @default(READ)
permissions Json?
userId String @map("user_id")
user User @relation(fields: [userId], references: [id])
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
isAccepted Boolean @default(false)
@@map("user_permission")
}
model Transaction {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
chainId Int @map("chain_id")
hash String?
to String
safeHash String? @map("safe_hash")
status TransactionStatus @default(PENDING)
type TransactionType
tokens Token[]
vestingContracts VestingContract[]
vestings Vesting[]
safeWallets SafeWallet[]
safeConfirmations SafeConfirmation[]
revokings Revoking[]
fundingAmount String? @default("0") @map("funding_amount")
withdrawAmount String? @default("0") @map("withdraw_amount")
@@map("transaction")
}
model Token {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
name String
symbol String
decimal Int
imported Boolean
burnable Boolean @default(false)
description String?
maxSupply String? @map("max_supply")
supplyCap String? @map("supply_cap")
totalSupply String? @map("total_supply")
chainId Int? @map("chain_id")
address String?
logo String?
transactionId String? @map("transaction_id")
transaction Transaction? @relation(fields: [transactionId], references: [id])
isDeployed Boolean @default(false) @map("is_deployed")
organizations OrganizationToken[]
vestingContracts VestingContract[]
vestings Vesting[]
@@map("token")
}
model OrganizationToken {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
tokenId String @map("token_id")
token Token @relation(fields: [tokenId], references: [id])
@@map("organization_token")
}
model VestingContract {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
tokenId String @map("token_id")
token Token @relation(fields: [tokenId], references: [id])
name String
address String?
chainId Int? @map("chain_id")
transactionId String? @map("transaction_id")
transaction Transaction? @relation(fields: [transactionId], references: [id])
isDeployed Boolean @default(false) @map("is_deployed")
status VestingContractStatus @default(INITIALIZED)
vestings Vesting[]
balance String?
isTimeBased Boolean @default(true) @map("is_timebased")
milestoneVestings MilestoneVesting[]
@@map("vesting_contract")
}
model Vesting {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
tokenId String @map("token_id")
token Token @relation(fields: [tokenId], references: [id])
vestingContractId String @map("vesting_contract_id")
vestingContract VestingContract @relation(fields: [vestingContractId], references: [id])
name String
startedAt DateTime @map("started_at")
endedAt DateTime @map("ended_at")
originalEndedAt DateTime @map("original_ended_at")
releaseFrequencyType ReleaseFrequencyType @default(continuous) @map("release_frequency_type")
releaseFrequency Int @map("release_frequency")
cliffDurationType CliffDurationType @default(no_cliff) @map("cliff_duration_type")
cliffDuration Int @default(0) @map("cliff_duration")
cliffAmount String @default("0") @map("cliff_amount")
amount String
transactionId String? @map("transaction_id")
transaction Transaction? @relation(fields: [transactionId], references: [id])
recipies Recipe[]
status VestingStatus @default(INITIALIZED)
revokings Revoking[]
@@map("vesting")
}
model VestingTemplate {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
name String
releaseFrequencyType ReleaseFrequencyType @default(continuous) @map("release_frequency_type")
releaseFrequency Int @map("release_frequency")
cliffDurationType CliffDurationType @default(no_cliff) @map("cliff_duration_type")
cliffDuration Int @default(0) @map("cliff_duration")
cliffAmount String @default("0") @map("cliff_amount")
@@map("vesting_template")
}
model Recipe {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
vestingId String? @map("vesting_id")
vesting Vesting? @relation(fields: [vestingId], references: [id])
name String?
email String?
userId String? @map("user_id")
user User? @relation(fields: [email], references: [email])
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
address String?
wallet Wallet? @relation(fields: [address], references: [address])
allocations String
status RecipeStatus @default(PENDING)
code String @unique
role Role @default(EMPLOYEE)
revokings Revoking[]
milestoneVestingId String? @map("milestone_vesting_id")
milestoneVesting MilestoneVesting? @relation(fields: [milestoneVestingId], references: [id])
@@map("recipe")
}
model SafeWallet {
id String @id @default(uuid())
firebaseId String? @map("firebase_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
name String?
chainId Int @map("chain_id")
address String
organizationId String @map("organization_id")
requiredConfirmations Int @map("required_confirmations")
transactionId String? @map("transaction_id")
transaction Transaction? @relation(fields: [transactionId], references: [id])
safeOwners SafeOwner[]
safeConfirmations SafeConfirmation[]
@@map("safe_wallet")
}
model SafeOwner {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
safeWalletId String @map("safe_wallet_id")
safeWallet SafeWallet @relation(fields: [safeWalletId], references: [id])
name String?
address String
safeConfirmations SafeConfirmation[]
@@map("safe_owner")
}
model SafeConfirmation {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
safeWalletId String @map("safe_wallet_id")
safeWallet SafeWallet @relation(fields: [safeWalletId], references: [id])
safeOwnerId String @map("safe_owner_id")
safeOwner SafeOwner @relation(fields: [safeOwnerId], references: [id])
transactionId String @map("transaction_id")
transaction Transaction @relation(fields: [transactionId], references: [id])
status ConfirmationStatus
@@map("safe_confirmation")
}
model Website {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
email String?
domains Json[]
features Json?
assets Json?
links Json?
styles Json?
@@map("website")
}
model Entity {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
name String
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
projectEntities ProjectEntity[]
@@map("entity")
}
model Project {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
name String
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
chainId Int @map("chain_id")
isLive Boolean @map("is_live")
contract String
website String?
tgeDate DateTime? @map("tge_date")
wallet String
projectEntities ProjectEntity[]
@@map("project")
}
model ProjectEntity {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
projectId String @map("project_id")
project Project @relation(fields: [projectId], references: [id])
entityId String @map("entity_id")
entity Entity @relation(fields: [entityId], references: [id])
@@map("project_entity")
}
model Revoking {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
chainId Int @map("chain_id")
recipeId String @map("recipe_id")
recipe Recipe @relation(fields: [recipeId], references: [id])
vestingId String @map("vesting_id")
vesting Vesting @relation(fields: [vestingId], references: [id])
transactionId String? @map("transaction_id")
transaction Transaction? @relation(fields: [transactionId], references: [id])
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
status TransactionStatus @default(PENDING)
@@map("revoking")
}
model Membership {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
key String
@@map("membership")
}
model MilestoneVesting {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
vestingContractId String @map("vesting_contract_id")
vestingContract VestingContract @relation(fields: [vestingContractId], references: [id])
transactionId String? @map("transaction_id")
recipes Recipe[]
status VestingStatus @default(INITIALIZED)
type MilestoneVestingType
milestones Milestone[]
templateId String?
template MilestoneVestingTemplate? @relation(fields: [templateId], references: [id])
@@map("milestone_vesting")
}
model MilestoneVestingTemplate {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
name String
milestoneVestings MilestoneVesting[]
milestones Milestone[]
@@map("milestone_vesting_template")
}
model Milestone {
id String @id @default(uuid())
allocation String
description String?
releaseFreq ReleaseFrequencyType @default(monthly) @map("release_frequency_type")
title String
vestingId String? @map("vesting_id")
vesting MilestoneVesting? @relation(fields: [vestingId], references: [id])
templateId String? @map("template_id")
template MilestoneVestingTemplate? @relation(fields: [templateId], references: [id])
duration Json
@@map("milestone")
}