feat: user blocking and content reporting/flagging

- user_blocks table (composite PK), Block/Unblock button on profiles.
  Blocking severs any existing follow relationship both ways and
  prevents the blocked party from following, commenting on the
  blocker's recipes, or the blocker from seeing their comments.
- reports table (recipe/comment/user targets, pending/reviewed/
  dismissed status). ReportButton on comments, admin review queue at
  /admin/reports with dismiss/mark-reviewed actions, audit-logged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-03 22:09:14 +02:00
parent a3f387fa2a
commit 57c29f62b4
19 changed files with 4441 additions and 14 deletions
+12
View File
@@ -0,0 +1,12 @@
import { db, userBlocks, eq, and, or } from "@epicure/db";
/** True if either user has blocked the other. */
export async function isBlockedEitherWay(userIdA: string, userIdB: string): Promise<boolean> {
const row = await db.query.userBlocks.findFirst({
where: or(
and(eq(userBlocks.blockerId, userIdA), eq(userBlocks.blockedId, userIdB)),
and(eq(userBlocks.blockerId, userIdB), eq(userBlocks.blockedId, userIdA))
),
});
return !!row;
}