Files
server/prisma/schema.prisma

63 lines
2.2 KiB
Plaintext

// 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")
}
model Rooms {
id String @id @default(auto()) @map("_id") @db.ObjectId
roomId String @unique
name String
rateLimit Int @default(1000) // epoch length in ms
banRateLimit Int @default(1000000) // starting number of epochs banned for
userMessageLimit Int @default(1) // per epoch
membershipType String @default("IDENTITY_LIST")
adminIdentities String[] @default([])
identities String[] @default([])
semaphoreIdentities 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")
}
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])
}
model Messages {
id String @id @default(auto()) @map("_id") @db.ObjectId
messageId String // Internal Nullifier
message String
timeStamp DateTime @default(now())
roomId String
room Rooms @relation(fields: [roomId], references: [roomId])
proof String
epoch Epoch? @relation(fields: [epochId], references: [id])
epochId 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
}