refactors, specific day playtime controls

This commit is contained in:
mikicvi
2025-09-22 22:46:33 +01:00
parent c8062cf96b
commit 6d3202e385
27 changed files with 1710 additions and 1365 deletions
+28
View File
@@ -0,0 +1,28 @@
import { NextRequest, NextResponse } from 'next/server';
import { getSession } from '@/lib/session';
import { db } from '@/lib/db';
import { timeSlots } 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 time slots
const allTimeSlots = await db
.select()
.from(timeSlots)
.where(eq(timeSlots.isActive, true))
.orderBy(timeSlots.dayOfWeek, timeSlots.startTime);
return NextResponse.json({
timeSlots: allTimeSlots,
});
} catch (error) {
console.error('Error fetching time slots:', error);
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
}
}