Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luiss811/Backend-Airguide/llms.txt

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

The professors resource (/api/profesores) exposes CRUD operations for professor profiles. A professor profile is always linked to an existing user account; when you create a professor record the referenced user’s role is automatically updated to profesor. Profiles include the professor’s department and their associated cubicle assignments. Read operations are public; write operations require admin authentication.
POST, PUT, and DELETE requests require a valid Bearer token from an account with the admin role.

List all professors


GET /api/profesores Returns all professor profiles with their linked user information and cubicle assignments.

Response

id_profesor
integer
Professor profile ID.
id_usuario
integer
Linked user account ID.
departamento
string
Department the professor belongs to.
activo
boolean
Whether the professor profile is active.
usuario
object
cubiculos
object[]

Example

curl https://api.example.com/api/profesores
[
  {
    "id_profesor": 1,
    "id_usuario": 10,
    "departamento": "Sistemas Computacionales",
    "activo": true,
    "usuario": {
      "nombre": "María López",
      "correo": "m.lopez@universidad.edu"
    },
    "cubiculos": [
      {
        "id_cubiculo": 3,
        "numero": "C-12",
        "piso": 2,
        "referencia": "Frente a la biblioteca",
        "activo": true,
        "edificio": {
          "id_edificio": 1,
          "nombre": "Edificio A",
          "latitud": "19.43200000",
          "longitud": "-99.13300000",
          "tipo": "academico"
        }
      }
    ]
  }
]

Get a professor by ID


GET /api/profesores/:id Returns a single professor profile with linked user data, cubicle assignments, and full building details for each cubicle.

Path parameters

id
integer
required
The id_profesor of the professor to retrieve.

Response

Returns the professor object. Returns 404 with { "error": "Profesor no encontrado" } if no professor with the given ID exists.

Example

curl https://api.example.com/api/profesores/1
{
  "id_profesor": 1,
  "id_usuario": 10,
  "departamento": "Sistemas Computacionales",
  "activo": true,
  "usuario": {
    "nombre": "María López",
    "correo": "m.lopez@universidad.edu"
  },
  "cubiculos": [
    {
      "id_cubiculo": 3,
      "id_profesor": 1,
      "id_edificio": 1,
      "numero": "C-12",
      "piso": 2,
      "referencia": "Frente a la biblioteca",
      "activo": true,
      "edificio": {
        "id_edificio": 1,
        "nombre": "Edificio A",
        "descripcion": "Facultad de Ingeniería",
        "latitud": "19.43200000",
        "longitud": "-99.13300000",
        "tipo": "academico",
        "activo": true
      }
    }
  ]
}

Create a professor


POST /api/profesores Creates a professor profile for an existing user. Requires admin authentication.
Creating a professor profile automatically updates the referenced user’s rol field to "profesor". Make sure the id_usuario refers to an existing user account before calling this endpoint.

Request body

id_usuario
integer
required
ID of the existing user account to link. Their role will be set to profesor as a side effect.
departamento
string
required
Department the professor belongs to (e.g., "Ingeniería de Software").
id_cubiculo
integer
Optional cubicle to assign to this professor. The cubicle record’s id_profesor field is updated to point to the new professor.
activo
boolean
default:"true"
Set to false to create the profile in an inactive state.

Response

Returns the created professor profile with user info and cubicle assignments, and HTTP 201 Created.

Example

curl -X POST https://api.example.com/api/profesores \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_usuario": 15,
    "departamento": "Matemáticas Aplicadas",
    "id_cubiculo": 7,
    "activo": true
  }'
{
  "id_profesor": 4,
  "id_usuario": 15,
  "departamento": "Matemáticas Aplicadas",
  "activo": true,
  "usuario": {
    "nombre": "Carlos Ramírez",
    "correo": "c.ramirez@universidad.edu"
  },
  "cubiculos": []
}
After creation, the cubicle assignment (id_cubiculo) is applied as a separate update to the cubicle record. Fetch the professor by ID immediately after creation to see the updated cubicle list.

Update a professor


PUT /api/profesores/:id Updates an existing professor profile. Requires admin authentication.

Path parameters

id
integer
required
The id_profesor of the professor to update.

Request body

All fields are optional.
departamento
string
Department name.
activo
boolean
Active status of the professor profile.
id_cubiculo
integer
Assign a new cubicle to this professor. The cubicle record is updated accordingly.

Response

Returns the updated professor with user info and cubicle assignments.

Example

curl -X PUT https://api.example.com/api/profesores/4 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "departamento": "Física y Matemáticas",
    "activo": true,
    "id_cubiculo": 9
  }'
{
  "id_profesor": 4,
  "id_usuario": 15,
  "departamento": "Física y Matemáticas",
  "activo": true,
  "usuario": {
    "nombre": "Carlos Ramírez",
    "correo": "c.ramirez@universidad.edu"
  },
  "cubiculos": []
}

Delete a professor


DELETE /api/profesores/:id Permanently deletes a professor profile. The linked user account is not deleted. Requires admin authentication.

Path parameters

id
integer
required
The id_profesor of the professor to delete.

Response

{
  "message": "Profesor eliminado"
}

Example

curl -X DELETE https://api.example.com/api/profesores/4 \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love