MELIKA’s scheduling system is built around franjas horarias — fixed 40-minute availability blocks that doctors publish to open themselves up for patient bookings. Each franja represents one bookable slot on a specific date. Doctors manage their own franjas through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Imjuanisss/proyecto-melika/llms.txt
Use this file to discover all available pages before exploring further.
/medico/franjas routes and can inspect their booked schedule through two agenda views: a flat daily list and a FullCalendar-ready range response that encodes appointment state as colored events. All schedule endpoints require a valid doctor Bearer token.
Franja Horaria Data Model
Afranja_horaria record represents a single 40-minute time slot.
| Field | Type | Description |
|---|---|---|
id | integer | Unique identifier for the slot. |
id_medico | integer | Foreign key — the owning doctor’s ID. |
fecha | string | Date of the slot in YYYY-MM-DD format. |
hora_inicio | string | Slot start time in HH:MM format. |
hora_fin | string | Slot end time in HH:MM format (exactly 40 minutes after hora_inicio). |
disponible | boolean | true when no active appointment is attached; false once booked. |
created_at | string | ISO 8601 timestamp of when the slot was created. |
Agenda Views
Daily Agenda
hora_inicio. Ideal for displaying a single day’s schedule in a list or timeline view. If fecha is omitted it defaults to today’s date.
Auth: verifyToken + isMedico
Query Parameters
The date to query in
YYYY-MM-DD format (e.g. 2025-07-21). Defaults to today if omitted.Response
An object containing the queried date and an array of appointment objects for that day.The date that was queried (
YYYY-MM-DD).Array of appointment objects for the requested day, ordered by
hora_inicio.Errors
| Status | Description |
|---|---|
401 | Missing or invalid Bearer token. |
403 | Authenticated user is not a doctor. |
404 | Doctor profile not found for the authenticated user. |
500 | Internal server error. |
Example
Range Agenda (FullCalendar)
verifyToken + isMedico
Both
inicio and fin are required. Omitting either returns a 400 error. Available franjas appear first in the array, followed by booked appointment events.Color Reference
| State | Background | Border | Text | Meaning |
|---|---|---|---|---|
disponible | #D1FAE5 | #1A7A52 | #065F46 | Slot is open and bookable. |
pendiente | #B45309 | #92400E | #fff | Appointment booked, not yet attended. |
completada | #1A7A52 | #145C3E | #fff | Appointment successfully completed. |
no_asistio | #6B7280 | #4B5563 | #fff | Patient did not attend. |
Query Parameters
Start of the date range in
YYYY-MM-DD format (inclusive).End of the date range in
YYYY-MM-DD format (inclusive).Response
An array of FullCalendar-compatible event objects. Available franja events appear before appointment events.Errors
| Status | Description |
|---|---|
400 | inicio or fin parameter is missing. |
401 | Missing or invalid Bearer token. |
403 | Authenticated user is not a doctor. |
404 | Doctor profile not found for the authenticated user. |
500 | Internal server error. |
Example
Slot Management
List Slots by Date
franja_horaria records owned by the authenticated doctor. Optionally filtered to a specific date via the fecha query parameter. Each record includes a cita_id column — the ID of any non-cancelled appointment linked to that slot.
Auth: verifyToken + isMedico
Query Parameters
Optional date filter in
YYYY-MM-DD format. If omitted, all franjas for the doctor are returned.Response
Array offranja_horaria objects (see the data model above), each extended with:
ID of the active (non-cancelled) appointment linked to this slot.
null when the slot is still available.Errors
| Status | Description |
|---|---|
401 | Missing or invalid Bearer token. |
403 | Authenticated user is not a doctor. |
404 | Doctor profile not found for the authenticated user. |
500 | Internal server error. |
Example
Create Slots
generarFranjasConDescanso, splitting the hora_inicio→hora_fin range into 40-minute blocks and optionally skipping a break window. Slots that already exist for the same doctor, date, and start time are silently skipped (not duplicated).
Auth: verifyToken + isMedico
Request Body
Date for the slots in
YYYY-MM-DD format.Start of the working window in
HH:MM format (e.g. "08:00"). Must be earlier than hora_fin.End of the working window in
HH:MM format (e.g. "17:00").Start of an optional break period in
HH:MM format (e.g. "12:00"). Slots overlapping the break window are skipped.End of the break period in
HH:MM format (e.g. "13:00"). Required when inicio_descanso is provided.Response 201
Human-readable summary (e.g.
"Se crearon 10 franja(s) de 40 minutos exitosamente (2 ya existían).").Number of new slots actually inserted into the database.
Number of slots skipped because they already existed for this doctor/date/hora_inicio combination.
Total number of 40-minute blocks the generator attempted to create from the supplied window.
Errors
| Status | Description |
|---|---|
400 | Missing required fields, hora_inicio ≥ hora_fin, or the time range produces no complete 40-minute blocks. |
401 | Missing or invalid Bearer token. |
403 | Authenticated user has no doctor profile. |
500 | Internal server error. |
Example
Update a Slot
- The slot’s
disponiblemust betrue(no active appointment attached). - The new
hora_finmust be exactly 40 minutes after the newhora_inicio. - The new time range must not overlap with any other slot belonging to the same doctor on the same date.
verifyToken + isMedico
Path Parameters
The numeric ID of the
franja_horaria to update.Request Body
New date in
YYYY-MM-DD format.New start time in
HH:MM format.New end time in
HH:MM format. Must be exactly 40 minutes after hora_inicio.Response
Confirmation:
"Franja actualizada correctamente."The updated
franja_horaria record (same shape as the list response).Errors
| Status | Description |
|---|---|
400 | Missing required fields, hora_inicio ≥ hora_fin, duration is not exactly 40 minutes, or disponible = false (slot has an active appointment). |
401 | Missing or invalid Bearer token. |
403 | Authenticated user is not a doctor. |
404 | No slot found with the given ID, or it belongs to another doctor. |
409 | The new time range overlaps with another existing slot for this doctor and date. |
500 | Internal server error. |
Example
Delete a Slot
disponible = true; slots with an active (non-cancelled) appointment attached cannot be deleted.
Auth: verifyToken + isMedico
Path Parameters
The numeric ID of the
franja_horaria to delete.Response
"Franja horaria eliminada correctamente." on success.Errors
| Status | Description |
|---|---|
400 | The slot has an active appointment (disponible = false): "No puedes eliminar una franja con cita reservada." |
401 | Missing or invalid Bearer token. |
403 | Authenticated user is not a doctor. |
404 | No slot found with the given ID, or it belongs to another doctor. |
500 | Internal server error. |