Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/shadownrx/apisquare/llms.txt

Use this file to discover all available pages before exploring further.

The Reservas tab is the primary operational view in the ApiSquare admin dashboard. When the tab is active, the dashboard fetches all reservations from Vercel KV via GET /api/admin/reservations, sorts them chronologically by date and then by time, and renders each appointment as a card on a responsive grid. Today’s appointments surface at a glance thanks to a distinct badge, and the three summary stats at the top of the page provide a quick overview without requiring any manual counting.

Stats cards

Three metric cards appear above the reservation grid and update every time the list is refreshed:
CardLabelDescription
📋TotalTotal count of all reservations currently stored in KV
📅HoyNumber of reservations whose date matches today
PróximasNumber of reservations on today or any future date

Reservation cards

Each appointment is displayed as a card with the following fields:
FieldDescription
Service iconEmoji icon mapped to the service name (e.g. 🦴 for Sesión de Quiropráctica, 💆 for Masaje Relajante, 🩺 for Traumatología). Any service name not in the icon map falls back to 🩺.
Service nameThe booked service, displayed as the card’s primary heading
ProfesionalName of the assigned professional
ClienteFull name provided by the Telegram user at booking time
FechaAppointment date formatted as full weekday, day, month, and year (e.g. lunes, 14 de julio de 2025)
HoraAppointment time in HH:MM 24-hour format
HOY badgeA green “HOY” badge appears in the top-right corner of the card when the appointment is scheduled for today

Deleting a reservation

1

Click "Eliminar cita"

Each reservation card contains an “🗑️ Eliminar cita” button in its footer. Click it to open the confirmation modal for that appointment.
2

Review the confirmation modal

The modal displays the full appointment details — professional, service, client name, date, and time — so you can verify you are deleting the correct record before proceeding.
3

Confirm deletion

Click Eliminar in the modal. The dashboard sends DELETE /api/admin/reservations with the reservation’s id in the request body.
4

KV keys are removed

The API deletes two keys from Vercel KV:
  • reserva:{profesional}:{fecha}:{hora} — the time-slot lock key
  • reserva:id:{id} — the full reservation record
It then reads user:{chatId}:reservas, filters out the deleted reservation, and writes the updated array back. This keeps the user’s Telegram reservation history in sync.
5

Toast confirmation

A green “Cita eliminada correctamente ✓” toast notification appears at the bottom-right of the screen and auto-dismisses after 3.5 seconds. If the request fails, a red error toast is shown instead.

Self-healing logic

The GET /api/admin/reservations endpoint scans Vercel KV using the reserva:id:* key pattern to build the reservation list. Because reservations are stored with a 30-day TTL, orphaned entries in a user’s user:{chatId}:reservas array (references to records whose KV keys have already expired) are automatically excluded — the response only contains records whose reserva:id:* key still exists in KV. This means the admin list is always consistent with actual stored data without requiring any manual cleanup.

Refreshing the list

The Refrescar button in the dashboard header (↻) reloads the reservation list from the API without triggering a full page reload. While the refresh is in progress, the button label changes to “Actualizando…” and the icon spins. The button is disabled during an ongoing load to prevent duplicate requests.
Reservations are stored with a 30-day TTL in Vercel KV. Once a reservation’s TTL expires, it is automatically purged by KV and will no longer appear in the admin dashboard.

Build docs developers (and LLMs) love