additional features, refinement and more control over the app from admin side, better bookings UX
This commit is contained in:
@@ -31,17 +31,11 @@ export async function PUT(request: NextRequest, { params }: { params: { id: stri
|
||||
|
||||
const timeRegex = /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/;
|
||||
if (startTime && !timeRegex.test(startTime)) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid startTime format. Use HH:MM format' },
|
||||
{ status: 400 }
|
||||
);
|
||||
return NextResponse.json({ error: 'Invalid startTime format. Use HH:MM format' }, { status: 400 });
|
||||
}
|
||||
|
||||
if (endTime && !timeRegex.test(endTime)) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid endTime format. Use HH:MM format' },
|
||||
{ status: 400 }
|
||||
);
|
||||
return NextResponse.json({ error: 'Invalid endTime format. Use HH:MM format' }, { status: 400 });
|
||||
}
|
||||
|
||||
const updatedTimeSlot = await db
|
||||
|
||||
@@ -12,10 +12,7 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||
}
|
||||
|
||||
const allTimeSlots = await db
|
||||
.select()
|
||||
.from(timeSlots)
|
||||
.orderBy(timeSlots.dayOfWeek, timeSlots.startTime);
|
||||
const allTimeSlots = await db.select().from(timeSlots).orderBy(timeSlots.dayOfWeek, timeSlots.startTime);
|
||||
|
||||
return NextResponse.json({
|
||||
timeSlots: allTimeSlots,
|
||||
@@ -53,10 +50,7 @@ export async function POST(request: NextRequest) {
|
||||
// Validate time format (HH:MM)
|
||||
const timeRegex = /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/;
|
||||
if (!timeRegex.test(startTime) || !timeRegex.test(endTime)) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid time format. Use HH:MM format' },
|
||||
{ status: 400 }
|
||||
);
|
||||
return NextResponse.json({ error: 'Invalid time format. Use HH:MM format' }, { status: 400 });
|
||||
}
|
||||
|
||||
const newTimeSlot = await db
|
||||
|
||||
Reference in New Issue
Block a user