// SPDX-License-Identifier: GPL-3.0-or-later // Animal Rights Advocates Discord Bot // Copyright (C) 2022 Anthony Berg // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id String @id @db.VarChar(255) vegan Boolean @default(false) trusted Boolean @default(false) activist Boolean @default(false) plus Boolean @default(false) notVegan Boolean @default(false) vegCurious Boolean @default(false) convinced Boolean @default(false) muted Boolean @default(false) VerifyUser Verify[] @relation("verUser") VerifyVerifier Verify[] @relation("verVerifier") Xp Xp? Balance Balance? Daily Daily[] SendPayment Payment[] @relation("sendPayment") RecievePayment Payment[] @relation("recievePayment") LeaveLog LeaveLog[] UserRoleLog RoleLog[] @relation("userRoleLog") ModRoleLog RoleLog[] @relation("modRoleLog") FunLogSender FunLog[] @relation("sendFunLog") FunLogReciever FunLog[] @relation("receiveFunLog") Counting Counting[] @relation("counting") EventLeader Event[] @relation("eventLeader") StatLeader Stat[] @relation("statLeader") OutreachParticipation ParticipantStat[] @relation("participantUser") SusUser Sus[] @relation("susUser") SusMod Sus[] @relation("susMod") WarnUser Warning[] @relation("warnUser") WarnMod Warning[] @relation("warnMod") RestrictUser Restrict[] @relation("restUser") RestrictMod Restrict[] @relation("restMod") RestrictEndMod Restrict[] @relation("endRestMod") BanUser Ban[] @relation("banUser") BanMod Ban[] @relation("banMod") BanEndMod Ban[] @relation("endBanMod") TempBanUser TempBan[] @relation("tbanUser") TempBanMod TempBan[] @relation("tbanMod") TempBanEndMod TempBan[] @relation("endTbanMod") VCMuteUser VCMute[] @relation("vcMuteUser") VCMuteMod VCMute[] @relation("vcMuteMod") } model Verify { id String @id user User @relation("verUser", fields: [userId], references: [id]) userId String verifier User? @relation("verVerifier", fields: [verifierId], references: [id]) verifierId String? joinTime DateTime @default(now()) startTime DateTime? finishTime DateTime? manual Boolean @default(false) // If they were verified with the verify command timedOut Boolean @default(false) // If they got kicked out of verification because they timed out // complete Boolean @default(false) // If the verification was incomplete // Roles they got from verification vegan Boolean @default(false) // If they got verified as a vegan activist Boolean @default(false) // If they got the activist role when they verified trusted Boolean @default(false) // If they got the trusted role when they verified vegCurious Boolean @default(false) // If they got the Veg Curious role convinced Boolean @default(false) text Boolean @default(false) // If they used text verification serverVegan Boolean @default(false) // People that went vegan on the server // Stats on verification reason Int? where Int? length Int? reasoning Int? life Int? food Int? notes String? } model Xp { user User @relation(fields: [userId], references: [id]) userId String @id level Int @default(0) xp Int @default(0) xpForNextLevel Int @default(0) messageCount Int @default(0) lastMessage DateTime @default(now()) } // Economy model Balance { user User @relation(fields: [userId], references: [id]) userId String @id balance Int } model Daily { id Int @id @default(autoincrement()) user User @relation(fields: [userId], references: [id]) userId String amount Int time DateTime @default(now()) } model Payment { id Int @id @default(autoincrement()) sender User @relation("sendPayment", fields: [senderId], references: [id]) senderId String recipient User @relation("recievePayment", fields: [recipientId], references: [id]) recipientId String amount Int reason String time DateTime @default(now()) } // Tracking roles for leaving the server model LeaveLog { id Int @id @default(autoincrement()) user User @relation(fields: [userId], references: [id]) userId String time DateTime @default(now()) roles String[] } model RoleLog { id Int @id @default(autoincrement()) user User @relation("userRoleLog", fields: [userId], references: [id]) userId String mod User @relation("modRoleLog", fields: [modId], references: [id]) modId String role Role @relation(fields: [roleId], references: [id]) roleId String add Boolean @default(false) time DateTime @default(now()) } model Role { id String @id name String staff Boolean RoleLog RoleLog[] } model FunLog { id Int @id @default(autoincrement()) sendUser User @relation("sendFunLog", fields: [sendUserId], references: [id]) sendUserId String receiveUser User? @relation("receiveFunLog", fields: [receiveUserId], references: [id]) receiveUserId String? type FunType @relation(fields: [typeId], references: [id]) typeId Int } model FunType { id Int @id @default(autoincrement()) name String @unique FunLog FunLog[] } model Counting { id Int @id @default(autoincrement()) user User @relation("counting", fields: [userId], references: [id]) userId String number Int // This is the number that the user has counted, if the count failed, the number should be 0 } // Outreach model Event { id Int @id @default(autoincrement()) type EventType @relation(fields: [eventType], references: [type]) eventType String leader User @relation("eventLeader", fields: [leaderId], references: [id]) // Not sure if this will stay leaderId String startTime DateTime @default(now()) endTime DateTime? stats Stat[] } model EventType { type String @id Event Event[] } model Stat { id Int @id @default(autoincrement()) event Event @relation(fields: [eventId], references: [id]) eventId Int leader User @relation("statLeader", fields: [leaderId], references: [id]) // Not sure if this will stay leaderId String vegan Int @default(0) considered Int @default(0) antivegan Int @default(0) thanked Int @default(0) documentary Int @default(0) educated Int @default(0) participants ParticipantStat[] role StatRole? } model StatRole { stat Stat @relation(fields: [statId], references: [id]) statId Int @id roleId String channelId String } model ParticipantStat { stat Stat @relation(fields: [statId], references: [id]) statId Int user User @relation("participantUser", fields: [userId], references: [id]) userId String @@id([statId, userId]) } // Moderation model Sus { id Int @id @default(autoincrement()) user User @relation("susUser", fields: [userId], references: [id]) userId String mod User @relation("susMod", fields: [modId], references: [id]) modId String time DateTime @default(now()) active Boolean @default(true) note String } model Warning { id Int @id @default(autoincrement()) user User @relation("warnUser", fields: [userId], references: [id]) userId String mod User @relation("warnMod", fields: [modId], references: [id]) modId String time DateTime @default(now()) note String } model Restrict { id Int @id @default(autoincrement()) user User @relation("restUser", fields: [userId], references: [id]) userId String mod User @relation("restMod", fields: [modId], references: [id]) modId String startTime DateTime @default(now()) endMod User? @relation("endRestMod", fields: [endModId], references: [id]) endModId String? endTime DateTime? reason String section Int } model Ban { id Int @id @default(autoincrement()) user User @relation("banUser", fields: [userId], references: [id]) userId String mod User @relation("banMod", fields: [modId], references: [id]) modId String time DateTime @default(now()) endMod User? @relation("endBanMod", fields: [endModId], references: [id]) endModId String? endTime DateTime? active Boolean @default(true) reason String } model TempBan { id Int @id @default(autoincrement()) user User @relation("tbanUser", fields: [userId], references: [id]) userId String mod User @relation("tbanMod", fields: [modId], references: [id]) modId String startTime DateTime @default(now()) endMod User? @relation("endTbanMod", fields: [endModId], references: [id]) endModId String? endTime DateTime active Boolean @default(true) reason String } model VCMute { id Int @id @default(autoincrement()) user User @relation("vcMuteUser", fields: [userId], references: [id]) userId String mod User @relation("vcMuteMod", fields: [modId], references: [id]) modId String time DateTime @default(now()) endTime DateTime? reason String? }