initial version of the app

This commit is contained in:
mikicvi
2025-09-21 17:11:02 +01:00
commit c8062cf96b
101 changed files with 23061 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { NextRequest, NextResponse } from 'next/server';
import { getSession } from '@/lib/session';
import { db } from '@/lib/db';
import { courts } from '@/lib/db/schema';
import { eq } from 'drizzle-orm';
export async function GET(request: NextRequest) {
try {
const session = await getSession();
if (!session) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
// Get all active courts (users can read courts)
const activeCourts = await db.select().from(courts).where(eq(courts.isActive, true));
return NextResponse.json({
courts: activeCourts,
});
} catch (error) {
console.error('Error fetching courts:', error);
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
}
}