Files
server/prisma/schema.prisma

62 lines
1.9 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")
}
enum RoomMembershipType {
IDENTITY_LIST
RLN_CONTRACT
BANDADA
}
model Rooms {
id String @id @default(auto()) @map("_id") @db.ObjectId
roomId String @unique
name String
rateLimit Int @default(1000) // epoch length in ms
userMessageLimit Int @default(1) // per epoch
membershipType RoomMembershipType @default(IDENTITY_LIST)
identities String[] @default([])
contractAddress String? // RLN_CONTRACT as "chainID:0xADDRESS"
bandadaAddress String? // BANDADA as "url:groupID"
epochs Epoch[]
messages Messages[]
claimCodes ClaimCodes[] @relation(fields: [claimCodeIds], references: [id])
claimCodeIds String[] @default([]) @db.ObjectId
}
model ClaimCodes {
id String @id @default(auto()) @map("_id") @db.ObjectId
claimcode String @unique
claimed Boolean @default(false)
roomIds String[] @default([]) @db.ObjectId
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 Int
messages Messages[]
rooms Rooms? @relation(fields: [roomsId], references: [id])
roomsId String? @db.ObjectId
}