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 materias service maintains the catalog of academic subjects that can be assigned to schedule entries. It validates admin credentials by forwarding the Authorization header to the usuarios service (GET /auth/me) before allowing any write operation. Base URL: http://localhost:8002

GET /materias/

Returns all subjects in the catalog. No authentication required.

Response

An array of subject objects.
id
integer
Auto-assigned primary key.
nombre
string
Subject name, e.g. "Cálculo I".
codigo
string
Unique subject code, e.g. "MAT101".
creditos
integer
Credit hours (must be greater than 0).
turno
string
Associated shift: MATUTINO, VESPERTINO, or AMBOS.
descripcion
string | null
Optional long-form description.
curl -s http://localhost:8002/materias/

GET /materias/

Returns a single subject by ID. No authentication required.

Path parameters

materia_id
integer
required
ID of the subject to retrieve.

Response

A single subject object.
curl -s http://localhost:8002/materias/1

POST /materias/

Creates a new subject. Requires ADMIN role.

Headers

Authorization
string
required
Bearer <token> — must decode to rol: ADMIN.

Request body

nombre
string
required
Subject name. Cannot be blank.
codigo
string
required
Unique subject code. Cannot be blank.
creditos
integer
required
Number of credit hours. Must be greater than 0.
turno
string
default:"AMBOS"
Shift: MATUTINO, VESPERTINO, or AMBOS.
descripcion
string
Optional description.

Response

Returns the created subject object.
curl -s -X POST http://localhost:8002/materias/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJ..." \
  -d '{
    "nombre": "Álgebra Lineal",
    "codigo": "MAT201",
    "creditos": 4,
    "turno": "AMBOS",
    "descripcion": "Vectores, matrices y transformaciones lineales"
  }'

PUT /materias/

Updates an existing subject. Only fields present in the request body are changed; omitted fields retain their current values. Requires ADMIN role.

Path parameters

materia_id
integer
required
ID of the subject to update.

Headers

Authorization
string
required
Bearer <token> — must decode to rol: ADMIN.

Request body (all fields optional)

nombre
string
New subject name.
codigo
string
New subject code.
creditos
integer
New credit count (must be > 0 if provided).
turno
string
New shift: MATUTINO, VESPERTINO, or AMBOS.
descripcion
string
New description. Pass null to clear it.

Response

Returns the updated subject object.
curl -s -X PUT http://localhost:8002/materias/5 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJ..." \
  -d '{
    "turno": "VESPERTINO"
  }'

DELETE /materias/

Deletes a subject from the catalog. Requires ADMIN role.

Path parameters

materia_id
integer
required
ID of the subject to delete.

Headers

Authorization
string
required
Bearer <token> — must decode to rol: ADMIN.

Response

Empty response body.
curl -s -X DELETE http://localhost:8002/materias/5 \
  -H "Authorization: Bearer eyJ..."
The turno field on a subject is used by the schedule generator when matching subjects to teachers. Setting it to MATUTINO ensures the subject is only scheduled in morning slots; AMBOS places no shift restriction.
Deleting a subject that is referenced by existing horario records may leave orphaned foreign keys in the horarios service database. Remove or reassign those schedule entries before deleting the subject.

Build docs developers (and LLMs) love