Add Social Events tab with reservations

This commit is contained in:
2026-06-27 19:40:22 -05:00
parent 71ae322b3f
commit 744830c3cd
10 changed files with 939 additions and 138 deletions
+18
View File
@@ -0,0 +1,18 @@
import { db } from '@/lib/db';
import { NextResponse } from 'next/server';
export async function GET() {
try {
const { rows } = await db.query(`
SELECT se.*,
(SELECT COUNT(*) FROM social_event_reservations ser WHERE ser.social_event_id = se.id) as reservation_count
FROM social_events se
WHERE se.active = true
ORDER BY se.sort_order, se.date, se.id
`);
return NextResponse.json({ data: rows });
} catch (error: any) {
console.error('GET /api/social_events/public error:', error);
return NextResponse.json({ error: error.message || 'Failed to load events' }, { status: 500 });
}
}