initial commit: rocket.new export of broadcastbeat

This commit is contained in:
Ryan Salazar
2026-05-07 16:39:17 +00:00
commit 70aa1ad46e
302 changed files with 60710 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { NextRequest, NextResponse } from 'next/server';
import { createClient } from '@/lib/supabase/server';
import { requireRmpAdmin } from '@/lib/accounting/rmpService';
export async function GET(request: NextRequest) {
const auth = await requireRmpAdmin();
if (!auth) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
const supabase = await createClient();
const { searchParams } = new URL(request.url);
const site = searchParams.get('site') ?? '';
const now = new Date();
const monthStart = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-01`;
let baseQuery = supabase.from('rmp_email_suppressions').select('id, suppression_type, suppressed_at');
if (site) baseQuery = baseQuery.eq('site', site);
const { data: all } = await baseQuery;
const total = (all ?? []).length;
const added_this_month = (all ?? []).filter((s: any) => s.suppressed_at >= monthStart).length;
const hostile_replies = (all ?? []).filter((s: any) => s.suppression_type === 'hostile_reply').length;
return NextResponse.json({ total, added_this_month, hostile_replies });
}