-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
138 lines (125 loc) · 5.56 KB
/
schema.prisma
File metadata and controls
138 lines (125 loc) · 5.56 KB
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
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
// Room Models
//-----------------------------------------------------------------------------------------
model Rooms {
id String @id @default(auto()) @map("_id") @db.ObjectId
roomId String @unique
name String
rateLimit Int @default(10000) // epoch length in ms
banRateLimit Int @default(1000000) // starting number of epochs banned for
userMessageLimit Int @default(12) // per epoch
membershipType String @default("IDENTITY_LIST")
adminIdentities String[] @default([])
identities String[] @default([])
contractAddress String? // RLN_CONTRACT as "chainID:0xADDRESS"
bandadaAddress String? // BANDADA as "url:groupID"
bandadaGroupId String? // Bandada Group ID
bandadaAPIKey String? // Bandada API Key
epochs Epoch[]
messages Messages[]
claimCodes ClaimCodes[] @relation(fields: [claimCodeIds], references: [id])
claimCodeIds String[] @default([]) @db.ObjectId
type String @default("PUBLIC")
ephemeral String @default("PERSISTENT")
encrypted String @default("PLAINTEXT")
sessionIds Boolean @default(true)
gatewayIds String[] @default([]) @db.ObjectId
gateways GateWayIdentity[] @relation(fields: [gatewayIds], references: [id])
ethereumGroups EthereumGroup[] @relation(fields: [ethereumGroupIds], references: [id])
ethereumGroupIds String[] @db.ObjectId
jubmojiGroups JubmojiGroup[] @relation(fields: [jubmojiGroupIds], references: [id])
jubmojiGroupIds String[] @db.ObjectId
}
model Epoch {
id String @id @default(auto()) @map("_id") @db.ObjectId
epoch String
messages Messages[]
rooms Rooms? @relation(fields: [roomsId], references: [id])
roomsId String? @db.ObjectId
}
model Messages {
id String @id @default(auto()) @map("_id") @db.ObjectId
messageId String // Internal Nullifier
message String
timeStamp DateTime @default(now())
roomId String
messageType String? @default("TEXT")
room Rooms @relation(fields: [roomId], references: [roomId])
proof String
epoch Epoch? @relation(fields: [epochId], references: [id])
epochId String? @db.ObjectId
}
// Gateway Models
//-----------------------------------------------------------------------------------------
model GateWayIdentity {
id String @id @default(auto()) @map("_id") @db.ObjectId
semaphoreIdentity String @unique
discordId String?
jubmojii String[]
steamId64 String?
roomIds String[] @default([]) @db.ObjectId
rooms Rooms[] @relation(fields: [roomIds], references: [id])
usedClaimCodes String[] @default([]) @db.ObjectId
claimCodes ClaimCodes[] @relation(fields: [usedClaimCodes], references: [id])
ethereumAddress EthereumAddress[]
jubmojiAddress JubmojiAddress[]
}
model EthereumGroup {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String @unique
roomIds String[] @default([]) @db.ObjectId
rooms Rooms[] @relation(fields: [roomIds], references: [id])
ethereumAddresses String[] @default([])
}
model EthereumAddress {
id String @id @default(auto()) @map("_id") @db.ObjectId
ethereumAddress String @unique
gateways GateWayIdentity @relation(fields: [gatewayId], references: [id])
gatewayId String @db.ObjectId
}
model JubmojiGroup {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String @unique
jubmojiAddresses String[] @default([])
rooms Rooms[] @relation(fields: [roomIds], references: [id])
roomIds String[] @default([]) @db.ObjectId
}
model JubmojiAddress {
id String @id @default(auto()) @map("_id") @db.ObjectId
jubmojiAddress String @unique
gateways GateWayIdentity @relation(fields: [gatewayId], references: [id])
gatewayId String @db.ObjectId
}
model ClaimCodes {
id String @id @default(auto()) @map("_id") @db.ObjectId
claimcode String @unique
roomIds String[] @default([]) @db.ObjectId
expiresAt Int @default(0)
usesLeft Int @default(-1)
rooms Rooms[] @relation(fields: [roomIds], references: [id])
discordId String?
gatewayIds String[] @default([]) @db.ObjectId
gateways GateWayIdentity[] @relation(fields: [gatewayIds], references: [id])
}
// Discord Bot Models
//-----------------------------------------------------------------------------------------
model Discord {
id String @id @default(auto()) @map("_id") @db.ObjectId
discordServerId String @unique
roomsMapping DiscordRoleRoomMapping[]
}
model DiscordRoleRoomMapping {
id String @id @default(auto()) @map("_id") @db.ObjectId
discordServerId String
roomId String @unique
roles String[]
discord Discord @relation(fields: [discordServerId], references: [discordServerId])
}