mirror of
https://forgejo.ultimateplayer.xyz/ultimateplayer1999/dcordabuse.git
synced 2026-09-15 20:55:49 -04:00
103 lines
2.5 KiB
Plaintext
103 lines
2.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum ReportStatus {
|
|
PENDING
|
|
APPROVED
|
|
REJECTED
|
|
}
|
|
|
|
enum ReportCategory {
|
|
COMPROMISED_ACCOUNT
|
|
SPAM
|
|
SCAM
|
|
MALWARE
|
|
ABUSE_HOSTING
|
|
SCRAPING
|
|
IMPERSONATION
|
|
OTHER
|
|
}
|
|
|
|
enum ApiKeyRole {
|
|
SUBMITTER // mag reports indienen, alleen approved reports lezen
|
|
ADMIN // mag reports modereren (approve/reject) + alles lezen
|
|
}
|
|
|
|
model ApiKey {
|
|
id String @id @default(cuid())
|
|
// Alleen de hash wordt opgeslagen, de plaintext key wordt eenmalig getoond bij aanmaak.
|
|
hashedKey String @unique
|
|
label String
|
|
role ApiKeyRole @default(SUBMITTER)
|
|
revoked Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
lastUsedAt DateTime?
|
|
|
|
// Simple sliding-window rate limit state, per key.
|
|
rateWindowStart DateTime @default(now())
|
|
rateCount Int @default(0)
|
|
|
|
reportsSubmitted Report[] @relation("submittedBy")
|
|
reportsReviewed Report[] @relation("reviewedBy")
|
|
auditLogs AuditLogs[]
|
|
|
|
@@index([revoked])
|
|
}
|
|
|
|
model ReportedUser {
|
|
id String @id @default(cuid())
|
|
discordId String @unique
|
|
username String?
|
|
firstSeen DateTime @default(now())
|
|
lastSeen DateTime @updatedAt
|
|
reports Report[]
|
|
|
|
@@index([discordId])
|
|
}
|
|
|
|
model Report {
|
|
id String @id @default(cuid())
|
|
discordId String
|
|
reportedUser ReportedUser @relation(fields: [discordId], references: [discordId])
|
|
|
|
category ReportCategory
|
|
description String @db.Text
|
|
// Vrij evidence-veld: URL naar screenshot/log, NOOIT ruwe persoonsgegevens van derden hier zonder noodzaak.
|
|
evidenceUrl String?
|
|
|
|
status ReportStatus @default(PENDING)
|
|
rejectionReason String?
|
|
|
|
submittedById String
|
|
submittedBy ApiKey @relation("submittedBy", fields: [submittedById], references: [id])
|
|
|
|
reviewedById String?
|
|
reviewedBy ApiKey? @relation("reviewedBy", fields: [reviewedById], references: [id])
|
|
reviewedAt DateTime?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([discordId, status])
|
|
@@index([status, createdAt])
|
|
}
|
|
|
|
model AuditLogs {
|
|
id String @id @default(cuid())
|
|
actorId String
|
|
actor ApiKey @relation(fields: [actorId], references: [id])
|
|
action String // bv. "report.submit", "report.approve", "report.reject"
|
|
targetType String // bv. "Report"
|
|
targetId String
|
|
metadata Json?
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([actorId])
|
|
@@index([targetType, targetId])
|
|
}
|