Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphify-out/GRAPH_REPORT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Graph Report - C:\Users\samet\projects\arel_social (2026-05-03)

## Corpus Check
- 91 files · ~271,050 words
- 91 files · ~271,595 words
- Verdict: corpus is large enough that graph structure adds value.

## Summary
Expand Down
4 changes: 2 additions & 2 deletions graphify-out/graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -3272,8 +3272,8 @@
"source_file": "C:\\Users\\samet\\projects\\arel_social\\src\\components\\communities\\community-page-client.tsx",
"source_location": "L378",
"weight": 1.0,
"_src": "community_page_client_handlersvp",
"_tgt": "post_page_client_onguestaction",
"_src": "post_page_client_onguestaction",
"_tgt": "community_page_client_handlersvp",
"source": "post_page_client_onguestaction",
"target": "community_page_client_handlersvp"
},
Expand Down
38 changes: 38 additions & 0 deletions prisma/migrations/20260503210444_moderation_panel/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-- AlterEnum: extend ModActionType with governance and audit action types
ALTER TYPE "ModActionType" ADD VALUE 'UNBAN_USER';
ALTER TYPE "ModActionType" ADD VALUE 'UNMUTE_USER';
ALTER TYPE "ModActionType" ADD VALUE 'PIN_POST';
ALTER TYPE "ModActionType" ADD VALUE 'UNPIN_POST';
ALTER TYPE "ModActionType" ADD VALUE 'ASSIGN_MODERATOR';
ALTER TYPE "ModActionType" ADD VALUE 'REMOVE_MODERATOR';
ALTER TYPE "ModActionType" ADD VALUE 'UPDATE_MODERATOR_PERMISSIONS';
ALTER TYPE "ModActionType" ADD VALUE 'CLOSE_COMMUNITY';
ALTER TYPE "ModActionType" ADD VALUE 'REOPEN_COMMUNITY';
ALTER TYPE "ModActionType" ADD VALUE 'DELETE_COMMUNITY';
ALTER TYPE "ModActionType" ADD VALUE 'TRANSFER_COMMUNITY_OWNERSHIP';
ALTER TYPE "ModActionType" ADD VALUE 'RESOLVE_REPORT';
ALTER TYPE "ModActionType" ADD VALUE 'DISMISS_REPORT';

-- CreateEnum: community lifecycle status
CREATE TYPE "CommunityStatus" AS ENUM ('ACTIVE', 'CLOSED');

-- AlterTable: add status column to Community
ALTER TABLE "Community" ADD COLUMN "status" "CommunityStatus" NOT NULL DEFAULT 'ACTIVE';

-- CreateIndex: Report indexes for efficient queue queries
CREATE INDEX "Report_status_idx" ON "Report"("status");
CREATE INDEX "Report_communityId_idx" ON "Report"("communityId");

-- CreateIndex: CommunityRestriction indexes for restriction lookups
CREATE INDEX "CommunityRestriction_communityId_idx" ON "CommunityRestriction"("communityId");
CREATE INDEX "CommunityRestriction_userId_idx" ON "CommunityRestriction"("userId");

-- CreateIndex: ModLog indexes for audit trail queries
CREATE INDEX "ModLog_communityId_idx" ON "ModLog"("communityId");
CREATE INDEX "ModLog_moderatorId_idx" ON "ModLog"("moderatorId");

-- CreateIndex: Post composite index for moderation panel queries
CREATE INDEX "Post_communityId_status_isDeleted_idx" ON "Post"("communityId", "status", "isDeleted");

-- CreateIndex: Comment index for parent post queries
CREATE INDEX "Comment_postId_isDeleted_idx" ON "Comment"("postId", "isDeleted");
45 changes: 38 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ enum ModActionType {
BAN_USER
MUTE_USER
UPDATE_SETTINGS
UNBAN_USER
UNMUTE_USER
PIN_POST
UNPIN_POST
ASSIGN_MODERATOR
REMOVE_MODERATOR
UPDATE_MODERATOR_PERMISSIONS
CLOSE_COMMUNITY
REOPEN_COMMUNITY
DELETE_COMMUNITY
TRANSFER_COMMUNITY_OWNERSHIP
RESOLVE_REPORT
DISMISS_REPORT
}

enum CommunityStatus {
ACTIVE
CLOSED
}

enum InviteStatus {
Expand Down Expand Up @@ -186,14 +204,15 @@ model GlobalModerator {


model Community {
id String @id @default(uuid()) @db.Uuid
name String @unique
id String @id @default(uuid()) @db.Uuid
name String @unique
description String?
ownerId String @db.Uuid
isUserProfile Boolean @default(false)
linkedUserId String? @unique @db.Uuid
isNsfw Boolean @default(false)
createdAt DateTime @default(now())
ownerId String @db.Uuid
isUserProfile Boolean @default(false)
linkedUserId String? @unique @db.Uuid
isNsfw Boolean @default(false)
status CommunityStatus @default(ACTIVE)
createdAt DateTime @default(now())

owner User @relation("CommunityOwner", fields: [ownerId], references: [id])
linkedUser User? @relation("UserLinkedCommunity", fields: [linkedUserId], references: [id], onDelete: Cascade)
Expand Down Expand Up @@ -280,6 +299,9 @@ model CommunityRestriction {
community Community @relation(fields: [communityId], references: [id], onDelete: Cascade)
user User @relation("RestrictedUser", fields: [userId], references: [id], onDelete: Cascade)
moderator User @relation("ModWhoRestricted", fields: [moderatorId], references: [id])

@@index([communityId])
@@index([userId])
}

model ModLog {
Expand All @@ -298,6 +320,9 @@ model ModLog {
targetUser User? @relation("TargetedUser", fields: [targetUserId], references: [id])
targetPost Post? @relation(fields: [targetPostId], references: [id])
targetComment Comment? @relation(fields: [targetCommentId], references: [id])

@@index([communityId])
@@index([moderatorId])
}

model UserBlock {
Expand Down Expand Up @@ -360,6 +385,8 @@ model Post {
media Media[]
modLogs ModLog[]
event Event?

@@index([communityId, status, isDeleted])
}

model Comment {
Expand Down Expand Up @@ -392,6 +419,8 @@ model Comment {
notifications Notification[]
media Media[]
modLogs ModLog[]

@@index([postId, isDeleted])
}

model PostEditHistory {
Expand Down Expand Up @@ -481,6 +510,8 @@ model Report {
rule CommunityRule? @relation(fields: [ruleId], references: [id])

// Note: Enforce CHECK (num_nonnulls(reportedUserId, postId, commentId) = 1) via raw SQL migration
@@index([status])
@@index([communityId])
}

// -----------------------------------------------------------------------------
Expand Down
Loading