mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 17:24:30 +00:00
fix: Correct business hours showing only 22:00-23:00 slots
- Created migration to fix ALL locations with incorrect business hours - Added debug endpoint to check business hours - Migration updates locations with 22:00/23:00 times to correct 10:00-19:00 This resolves the booking availability showing wrong time slots.
This commit is contained in:
32
app/api/debug/business-hours/route.ts
Normal file
32
app/api/debug/business-hours/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { supabaseAdmin } from '@/lib/supabase/admin'
|
||||
|
||||
/**
|
||||
* @description Get business hours for all locations (debug endpoint)
|
||||
*/
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const { data: locations, error } = await supabaseAdmin
|
||||
.from('locations')
|
||||
.select('id, name, timezone, business_hours')
|
||||
|
||||
if (error) {
|
||||
console.error('Error fetching locations:', error)
|
||||
return NextResponse.json(
|
||||
{ error: error.message },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
locations
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Business hours GET error:', error)
|
||||
return NextResponse.json(
|
||||
{ error: 'Internal server error' },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user