- Updated .env.example to include backup configuration options. - Modified docker-compose.yml to mount backup volume. - Enhanced Dockerfile to install PostgreSQL client. - Added EscalationRule model to Prisma schema for managing warning escalation. - Updated environment validation in env.ts to include backup settings. - Refactored job handling in jobs.ts to implement backup jobs and cleanup. - Introduced escalation commands in moderation service for managing user warnings. - Updated moderation commands to apply escalation rules based on warning count.
99 lines
2.6 KiB
Plaintext
99 lines
2.6 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Guild {
|
|
id String @id
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
settings GuildSettings?
|
|
cases Case[]
|
|
escalationRules EscalationRule[]
|
|
}
|
|
|
|
model GuildSettings {
|
|
id String @id @default(cuid())
|
|
guildId String @unique
|
|
locale String @default("de")
|
|
moderationEnabled Boolean @default(true)
|
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
createdAt DateTime @default(now())
|
|
warnings Warning[]
|
|
notes ModNote[]
|
|
}
|
|
|
|
model Case {
|
|
id String @id @default(cuid())
|
|
caseNumber Int
|
|
guildId String
|
|
targetUserId String
|
|
moderatorId String
|
|
action String
|
|
reason String?
|
|
metadata Json?
|
|
deletedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
|
warnings Warning[]
|
|
moderationNote ModNote[]
|
|
|
|
@@unique([guildId, caseNumber])
|
|
@@index([guildId, targetUserId])
|
|
}
|
|
|
|
model Warning {
|
|
id String @id @default(cuid())
|
|
guildId String
|
|
userId String
|
|
moderatorId String
|
|
reason String?
|
|
caseId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
case Case? @relation(fields: [caseId], references: [id], onDelete: SetNull)
|
|
|
|
@@index([guildId, userId])
|
|
}
|
|
|
|
model ModNote {
|
|
id String @id @default(cuid())
|
|
guildId String
|
|
userId String
|
|
moderatorId String
|
|
note String
|
|
caseId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
case Case? @relation(fields: [caseId], references: [id], onDelete: SetNull)
|
|
|
|
@@index([guildId, userId])
|
|
}
|
|
|
|
model EscalationRule {
|
|
id String @id @default(cuid())
|
|
guildId String
|
|
warnCount Int
|
|
action String
|
|
durationMs Int?
|
|
reason String?
|
|
enabled Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([guildId, warnCount])
|
|
@@index([guildId, enabled])
|
|
}
|