Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Luisanchez0/modulo_Horario/llms.txt

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

The generation endpoint builds a complete schedule for an academic period in a single request. It fetches teacher, subject, and classroom catalogs from the upstream services (or uses the IDs you provide), then slots each subject into a compatible day/time block while respecting each teacher’s turno (shift) and any registered disponibilidad (availability) records. Subjects that cannot be placed are reported in materias_sin_asignar. Base URL: http://localhost:8004
Requires: Authorization: Bearer <token> with rol: ADMIN

Request body

periodo_id
integer
required
ID of the academic period to generate schedules for. Must exist before calling this endpoint.
duracion_minutos
integer
default:"120"
Duration of each time slot in minutes. Must be greater than 0. Slots are tiled from hora_inicio_jornada to hora_fin_jornada.
hora_inicio_jornada
string
default:"\"08:00\""
Start of the school day in HH:MM format. Must be earlier than hora_fin_jornada.
hora_fin_jornada
string
default:"\"18:00\""
End of the school day in HH:MM format.
dias
array of strings
Days of the week to include. At least one day is required. Accepted values (case-insensitive): LUNES, MARTES, MIERCOLES, JUEVES, VIERNES, SABADO.
docente_ids
array of integers
Restrict generation to these teacher IDs. If omitted or empty, all teachers from the usuarios service are used.
materia_ids
array of integers
Restrict generation to these subject IDs. If omitted or empty, all subjects from the materias service are used.
aula_ids
array of integers
Restrict generation to these classroom IDs. If omitted or empty, all classrooms from the aulas service are used.

Response

periodo_id
integer
The period ID that was passed in the request.
creados
array of HorarioRead
Schedule entries that were successfully created. Each item has the same shape as a HorarioRead from the CRUD endpoints, including resolved catalog names.
materias_sin_asignar
array of integers
IDs of subjects that could not be placed — for example because no compatible teacher/classroom/slot combination was available.
mensajes
array of strings
Informational messages from the generation engine (e.g., reasons a subject was skipped).

Example

curl -s -X POST http://localhost:8004/horarios/generar \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJ..." \
  -d '{
    "periodo_id": 1,
    "duracion_minutos": 120,
    "hora_inicio_jornada": "08:00",
    "hora_fin_jornada": "18:00",
    "dias": ["LUNES", "MIERCOLES", "VIERNES"],
    "docente_ids": [3, 4],
    "materia_ids": [5, 6, 7],
    "aula_ids": [2]
  }'

Constraint rules

The generator respects two types of constraints:
  • Turno (shift): A teacher with turno: MATUTINO can only be assigned to slots within 07:00–14:00. A teacher with turno: VESPERTINO is restricted to 15:00–22:00. Teachers with turno: AMBOS may be placed in either range.
  • Disponibilidad: If a teacher has explicit availability records, the generator checks those records and avoids placing them outside their available windows.
Subjects that cannot be placed due to these constraints are returned in materias_sin_asignar with an explanation in mensajes.
The generation endpoint does not delete previously created horarios for the period before running. Call DELETE /horarios/{id} for each existing entry first if you want a clean slate, or ensure the new run does not produce duplicate slot conflicts.

Build docs developers (and LLMs) love