TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Renzo717/Aula-Virtual-Universidad-Radiolocucion/llms.txt
Use this file to discover all available pages before exploring further.
/api/carreras router models the two-level academic hierarchy of NuestraVoz — Campus Virtual: carreras (degree programmes) and their nested materias (subjects). All routes require authentication; admin-only routes additionally enforce the admin role. Deleting either resource is a soft-delete that sets activa: false on the relevant row. Schedule data (horarios) is stored as a structured JSON array and also denormalised into a human-readable horario string via the shared formatHorarios helper. The /api/inscripciones router handles enrollment records for both career and stand-alone subject enrolments.
GET /api/carreras
Returns all active careers, each including their active subjects. Subjects are returned with a nesteddocente object containing the instructor’s id, nombre, and apellido.
Auth: requireAuth — any authenticated role.
Response — 200 OK
Array of active
Carrera objects, ordered alphabetically by nombre.Example
GET /api/carreras/:id
Returns a single career record identified by UUID, including all of its active subjects with nested instructor data. Auth:requireAuth — any authenticated role.
Path parameters
UUID of the career to retrieve.
Response — 200 OK
Full
Carrera object. See GET /api/carreras for field descriptions.Error responses
| Status | Meaning |
|---|---|
401 | No valid session cookie. |
404 | Career not found or Supabase query error. |
Example
POST /api/carreras
Creates a new career. Thecodigo and nombre fields are free-form strings; uniqueness is not enforced at the API layer but may be constrained at the database level.
Auth: requireAuth + requireRole('admin').
Request body
Full career name. Minimum 2 characters.
Short code or abbreviation for the career (e.g.,
LOC-G2). Minimum 2 characters.Degree level. Must be
grado or posgrado.Academic year of this curriculum block. Integer between
1 and 3 inclusive.Optional free-text description of the career.
Response — 201 Created
The newly created
Carrera record.Error responses
| Status | Meaning |
|---|---|
400 | Validation error — see details for Zod field errors. |
403 | Caller is not an admin. |
Example
PATCH /api/carreras/:id
Partially updates an existing career. Send only the fields you wish to change; allcreateCarreraSchema fields are valid, and the activa flag may also be toggled directly.
Auth: requireAuth + requireRole('admin').
Path parameters
UUID of the career to update.
Request body
Any subset of the fields accepted by POST /api/carreras, plus:Set to
false to deactivate the career (without cascade). Use DELETE /api/carreras/:id to also deactivate all subjects.Response — 200 OK
The updated
Carrera record.Example
DELETE /api/carreras/:id
Deactivates a career and all of its subjects in a single operation by settingactiva: false on every related materias row before deactivating the career itself.
Auth: requireAuth + requireRole('admin').
Path parameters
UUID of the career to deactivate.
Response — 200 OK
Example
POST /api/carreras/materias
Creates a new subject (materia) inside an existing career. Schedule data can be supplied as either a structuredhorarios array or a legacy horario string; if both are present, the structured array takes precedence and horario is regenerated via formatHorarios.
Auth: requireAuth + requireRole('admin').
Request body
UUID of the parent career. Must be a valid UUID.
Subject name. Minimum 2 characters.
Whether the subject allows direct promotion (no final exam). Defaults to
false.UUID of the instructor to assign. Must be a valid UUID.
Array of structured schedule blocks. Each entry must be an object with:
dia— one oflunes,martes,miercoles,jueves,viernes,sabado,domingoinicio— start time string inHH:mmformatfin— end time string inHH:mmformat, must be afterinicio
Legacy schedule display string in
HH:mm - HH:mm format (e.g., "14:00 - 16:00"). Used only when horarios is not provided.Zoom meeting URL for the subject’s virtual classroom. Must be a valid URL or an empty string to clear.
URL linking to the subject’s programme document (syllabus).
Response — 201 Created
The newly created
Materia record, including the generated horario string.Error responses
| Status | Meaning |
|---|---|
400 | Validation error (invalid UUID, bad time range, etc.). |
403 | Caller is not an admin. |
Example
PATCH /api/carreras/materias/:id
Partially updates an existing subject. All fields are optional. Updatinghorarios automatically recalculates the horario display string. Passing null for docente_id unassigns the instructor.
Auth: requireAuth + requireRole('admin', 'preceptor').
Path parameters
UUID of the subject to update.
Request body
Updated subject name. Minimum 2 characters.
Updated promotion flag.
Updated instructor UUID. Pass
null to unassign.Updated schedule array. Same structure as in POST. Replaces the existing schedule entirely.
Legacy display string in
HH:mm - HH:mm format. Accepted only when horarios is not provided.Response — 200 OK
The updated
Materia record.Example
DELETE /api/carreras/materias/:id
Soft-deletes a single subject by settingactiva: false. The parent career is unaffected.
Auth: requireAuth + requireRole('admin').
Path parameters
UUID of the subject to deactivate.
Response — 200 OK
Example
GET /api/carreras/docentes/:docenteId/materias
Returns all active subjects assigned to a specific instructor, with the parent career name and year included in each record. Auth:requireAuth + requireRole('admin', 'preceptor').
Path parameters
UUID of the instructor whose subjects are being queried.
Response — 200 OK
Array of active
Materia objects for the given instructor.Example
GET /api/inscripciones/usuario/:userId
Returns all enrollment records for a given user, with expanded career and subject information. Auth:requireAuth + requireRole('admin', 'preceptor').
Path parameters
UUID of the user whose enrollments are being retrieved.
Response — 200 OK
Array of
Inscripcion records, ordered by created_at descending.Example
POST /api/inscripciones
Enrolls a user in a career or a stand-alone subject. Eithercarrera_id or materia_id must be provided, but not necessarily both. The endpoint prevents duplicate active enrolments and validates that the target career or subject exists and is active.
Auth: requireAuth + requireRole('admin', 'preceptor').
Request body
UUID of the user to enroll.
UUID of the career to enroll the user in. Required when enrolling in a career. Must be a valid UUID.
UUID of the stand-alone subject (a
materia with carrera_id = null) to enroll the user in. Required when enrolling in a free-standing course. Must be a valid UUID.Response — 201 Created
The newly created
Inscripcion record, with expanded carrera or materia data depending on which type of enrolment was created.Error responses
| Status | Meaning |
|---|---|
400 | Validation error, both carrera_id and materia_id absent, career/subject inactive, or duplicate active enrolment. |
403 | Caller is not an admin or preceptor. |