57c29f62b4
- 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>
29 lines
822 B
TypeScript
29 lines
822 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { requireAdmin } from "@/lib/api-auth";
|
|
import { db, reports, users, eq, desc } from "@epicure/db";
|
|
|
|
export async function GET() {
|
|
const { response } = await requireAdmin();
|
|
if (response) return response;
|
|
|
|
const rows = await db
|
|
.select({
|
|
id: reports.id,
|
|
targetType: reports.targetType,
|
|
targetId: reports.targetId,
|
|
reason: reports.reason,
|
|
status: reports.status,
|
|
createdAt: reports.createdAt,
|
|
reporterId: reports.reporterId,
|
|
reporterName: users.name,
|
|
reporterEmail: users.email,
|
|
})
|
|
.from(reports)
|
|
.innerJoin(users, eq(reports.reporterId, users.id))
|
|
.where(eq(reports.status, "pending"))
|
|
.orderBy(desc(reports.createdAt))
|
|
.limit(100);
|
|
|
|
return NextResponse.json({ reports: rows });
|
|
}
|