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,37 @@
import { NextRequest, NextResponse } from 'next/server';
import { createClient } from '@/lib/supabase/server';
export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
try {
const { id } = await params;
const supabase = await createClient();
// Fetch thread
const { data: thread, error: threadError } = await supabase
.from('forum_threads')
.select('*, forum_categories(id, name, slug)')
.eq('id', id)
.single();
if (threadError) throw threadError;
// Increment view count
await supabase
.from('forum_threads')
.update({ view_count: (thread.view_count || 0) + 1 })
.eq('id', id);
// Fetch replies
const { data: replies, error: repliesError } = await supabase
.from('forum_replies')
.select('*')
.eq('thread_id', id)
.order('created_at', { ascending: true });
if (repliesError) throw repliesError;
return NextResponse.json({ thread, replies: replies || [] });
} catch (err: any) {
return NextResponse.json({ error: err.message }, { status: 500 });
}
}