mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: reporting
This commit is contained in:
parent
334b6ec9b6
commit
f633648fee
15 changed files with 494 additions and 11 deletions
25
prisma/migrations/20250502172234_reports/migration.sql
Normal file
25
prisma/migrations/20250502172234_reports/migration.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
-- CreateEnum
|
||||
CREATE TYPE "ReportType" AS ENUM ('MII', 'USER');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ReportReason" AS ENUM ('INAPPROPRIATE', 'SPAM', 'COPYRIGHT', 'OTHER');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ReportStatus" AS ENUM ('OPEN', 'RESOLVED', 'DISMISSED');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "reports" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"reportType" "ReportType" NOT NULL,
|
||||
"status" "ReportStatus" NOT NULL DEFAULT 'OPEN',
|
||||
"targetId" INTEGER NOT NULL,
|
||||
"reason" "ReportReason" NOT NULL,
|
||||
"reasonNotes" TEXT,
|
||||
"authorId" INTEGER,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "reports_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "reports" ADD CONSTRAINT "reports_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
|
@ -24,6 +24,7 @@ model User {
|
|||
sessions Session[]
|
||||
miis Mii[]
|
||||
likes Like[]
|
||||
Report Report[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
|
@ -92,3 +93,38 @@ model Like {
|
|||
@@id([userId, miiId])
|
||||
@@map("likes")
|
||||
}
|
||||
|
||||
model Report {
|
||||
id Int @id @default(autoincrement())
|
||||
reportType ReportType
|
||||
status ReportStatus @default(OPEN)
|
||||
targetId Int
|
||||
|
||||
reason ReportReason
|
||||
reasonNotes String?
|
||||
|
||||
authorId Int?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User? @relation(fields: [authorId], references: [id])
|
||||
|
||||
@@map("reports")
|
||||
}
|
||||
|
||||
enum ReportType {
|
||||
MII
|
||||
USER
|
||||
}
|
||||
|
||||
enum ReportReason {
|
||||
INAPPROPRIATE
|
||||
SPAM
|
||||
COPYRIGHT
|
||||
OTHER
|
||||
}
|
||||
|
||||
enum ReportStatus {
|
||||
OPEN
|
||||
RESOLVED
|
||||
DISMISSED
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue