curl --request GET \
--url https://api.example.com/api/admin/debug-reservations{
"count": 123,
"today": "<string>",
"reservations": [
{
"id": "<string>",
"reservation_date": "<string>",
"status": "<string>",
"locations": {
"name": "<string>"
},
"customers": {
"first_name": "<string>",
"last_name": "<string>"
}
}
]
}Retrieve today’s reservations for debugging and monitoring purposes
curl --request GET \
--url https://api.example.com/api/admin/debug-reservations{
"count": 123,
"today": "<string>",
"reservations": [
{
"id": "<string>",
"reservation_date": "<string>",
"status": "<string>",
"locations": {
"name": "<string>"
},
"customers": {
"first_name": "<string>",
"last_name": "<string>"
}
}
]
}GET /api/admin/debug-reservations
canAccessOperaciones permission.
await requirePermission("canAccessOperaciones");
Show Reservation Object
pending, confirmed, seated, completed, cancelledcurl -X GET https://your-domain.com/api/admin/debug-reservations \
-H "Cookie: your-session-cookie"
{
"count": 3,
"today": "2026-03-04",
"reservations": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"reservation_date": "2026-03-04T19:30:00Z",
"status": "confirmed",
"pax": 4,
"locations": {
"name": "La Tasca Madrid · Centro"
},
"customers": {
"first_name": "María",
"last_name": "García"
}
}
]
}
{
"error": "Database error message",
"status": 500
}
canAccessOperaciones permissionlocations and customers relationsimport { createClient } from '@supabase/supabase-js';
import { requirePermission } from "@/lib/authz";
export async function GET() {
await requirePermission("canAccessOperaciones");
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY!
);
const today = new Date().toISOString().split('T')[0];
const { data: reservations, error } = await supabase
.from('reservations')
.select('*, locations(name), customers(first_name, last_name)')
.gte('reservation_date', `${today}T00:00:00`)
.lte('reservation_date', `${today}T23:59:59`)
.limit(10);
if (error) {
return Response.json({ error: error.message }, { status: 500 });
}
return Response.json({
count: reservations?.length || 0,
today,
reservations
});
}