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 cubicles resource (/api/edificios/cubiculos) lets you list, create, update, and delete professor cubicles. Each cubicle belongs to a building and is assigned to a professor. The response always includes the parent building summary and the professor’s linked user account details. 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 cubicles


GET /api/edificios/cubiculos Returns all cubicles in the system ordered by building. Each record includes the building name and the assigned professor’s user account information.

Response

id_cubiculo
integer
Cubicle ID.
id_profesor
integer
Assigned professor’s ID.
id_edificio
integer
Parent building ID.
numero
string
Cubicle number or label (e.g., "C-05").
piso
integer
Floor number where the cubicle is located.
referencia
string | null
Optional free-text description of the cubicle’s location.
activo
boolean
Whether the cubicle is active.
edificio
object
profesor
object

Example

curl https://api.example.com/api/edificios/cubiculos
[
  {
    "id_cubiculo": 1,
    "id_profesor": 2,
    "id_edificio": 1,
    "numero": "C-05",
    "piso": 2,
    "referencia": "Junto al elevador, pasillo norte",
    "activo": true,
    "edificio": {
      "id_edificio": 1,
      "nombre": "Edificio A"
    },
    "profesor": {
      "id_profesor": 2,
      "departamento": "Sistemas Computacionales",
      "activo": true,
      "usuario": {
        "nombre": "María López",
        "correo": "m.lopez@universidad.edu"
      }
    }
  }
]

Create a cubicle


POST /api/edificios/cubiculos Creates a new cubicle and assigns it to a professor in a building. Requires admin authentication.

Request body

id_profesor
integer
required
ID of the professor to assign to this cubicle.
id_edificio
integer
required
ID of the building where the cubicle is located.
numero
string
required
Cubicle number or label (e.g., "C-12", "Oficina 3B").
piso
integer
required
Floor number. Use 0 for ground floor.
referencia
string
Optional location reference to help visitors find the cubicle (e.g., "Al fondo del pasillo, frente a las escaleras").
activo
boolean
default:"true"
Set to false to create the cubicle in an inactive state.

Response

Returns the created cubicle with building and professor details, and HTTP 201 Created.

Example

curl -X POST https://api.example.com/api/edificios/cubiculos \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_profesor": 3,
    "id_edificio": 2,
    "numero": "B-08",
    "piso": 1,
    "referencia": "Primera puerta a la derecha después de la recepción",
    "activo": true
  }'
{
  "id_cubiculo": 9,
  "id_profesor": 3,
  "id_edificio": 2,
  "numero": "B-08",
  "piso": 1,
  "referencia": "Primera puerta a la derecha después de la recepción",
  "activo": true,
  "edificio": {
    "id_edificio": 2,
    "nombre": "Edificio B"
  },
  "profesor": {
    "id_profesor": 3,
    "departamento": "Química",
    "activo": true,
    "usuario": {
      "nombre": "Ana Torres",
      "correo": "a.torres@universidad.edu"
    }
  }
}

Update a cubicle


PUT /api/edificios/cubiculos/:id Replaces the full set of fields on an existing cubicle. All fields are required for this operation. Requires admin authentication.
This endpoint performs a full replacement, not a partial update. You must supply all fields — including those you do not intend to change — to avoid overwriting them with empty values.

Path parameters

id
integer
required
The id_cubiculo of the cubicle to update.

Request body

id_profesor
integer
required
Assigned professor ID. To reassign the cubicle, provide the new professor’s ID.
id_edificio
integer
required
Building ID. To move the cubicle to another building, provide the new building’s ID.
numero
string
required
Cubicle number or label.
piso
integer
required
Floor number.
referencia
string
required
Location reference description. Pass an empty string if not applicable.
activo
boolean
required
Active status.

Response

Returns the updated cubicle with building and professor details.

Example

curl -X PUT https://api.example.com/api/edificios/cubiculos/9 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_profesor": 3,
    "id_edificio": 2,
    "numero": "B-08",
    "piso": 2,
    "referencia": "Segunda planta, frente al laboratorio de química",
    "activo": true
  }'
{
  "id_cubiculo": 9,
  "id_profesor": 3,
  "id_edificio": 2,
  "numero": "B-08",
  "piso": 2,
  "referencia": "Segunda planta, frente al laboratorio de química",
  "activo": true,
  "edificio": {
    "id_edificio": 2,
    "nombre": "Edificio B"
  },
  "profesor": {
    "id_profesor": 3,
    "departamento": "Química",
    "activo": true,
    "usuario": {
      "nombre": "Ana Torres",
      "correo": "a.torres@universidad.edu"
    }
  }
}

Delete a cubicle


DELETE /api/edificios/cubiculos/:id Permanently deletes a cubicle record. The associated professor and building records are not affected. Requires admin authentication.

Path parameters

id
integer
required
The id_cubiculo of the cubicle to delete.

Response

{
  "message": "Cubículo eliminado exitosamente"
}

Example

curl -X DELETE https://api.example.com/api/edificios/cubiculos/9 \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love