Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Edfermachado/proyectoSistemas/llms.txt

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

Spaces represent the physical venues that faculty events take place in. Every event in UniEvents must be assigned to a space, which establishes the physical location and contributes to the automatic conflict detection that prevents double-booking. Faculty admins manage their spaces from the /faculty-admin/spaces page, with full CRUD access available to tenant_admin and event_manager roles.

What is a Space?

A space is a physical venue owned and managed by a faculty tenant. It can be a classroom, an auditorium, a sports field, a lab, or any bookable location within the faculty. The spaces table in the database has three core fields:
FieldTypeDescription
namevarchar(255)The display name of the venue (e.g. “Auditorio Principal”, “Aula 204”).
capacityintegerThe maximum number of people the venue can physically hold.
tenantIduuidThe faculty tenant this space belongs to. Spaces are always tenant-scoped.
Spaces are linked to events via the spaceId foreign key on the events table. A single space can be used by many events — but never by two events at the same time.

Creating a Space

Navigate to /faculty-admin/spaces/new. Enter the space name and its physical capacity, then submit the form. The space will be scoped to your faculty’s tenantId automatically. Example — creating a space via the API:
POST /api/spaces
Content-Type: application/json

{
  "name": "Auditorio Simón Bolívar",
  "capacity": 400,
  "tenantId": "8f3e1a2b-1234-5678-abcd-ef0123456789"
}
Success response (201 Created):
{
  "id": "spc-uuid",
  "name": "Auditorio Simón Bolívar",
  "capacity": 400,
  "tenantId": "8f3e1a2b-1234-5678-abcd-ef0123456789",
  "createdAt": "2025-08-01T10:00:00.000Z"
}

Editing a Space

Navigate to /faculty-admin/spaces/[id]/edit to update a space’s name or capacity. You can update either field independently — both are optional in the PUT request body.

Space Availability and Conflict Detection

Once a space is assigned to an event, it is blocked for the entire duration of that event. The blocked window runs from the event’s date through date + (duration × 60 seconds). The EventsService.checkSpaceConflict method uses interval overlap logic to determine whether a new booking collides with an existing one:
// A conflict exists when:
newStart < existingEnd && existingStart < newEnd
This check is applied on every event creation and every event update that changes the space, date, or duration. If a conflict is found, the API returns HTTP 409 with error code CONF_001, and the creation or update is aborted.
When editing an existing event, the conflict check automatically excludes the event being edited from the overlap scan — so changing an event’s duration without changing its space or start time will not conflict with itself.

Capacity vs. Event Capacity

Spaces define a physical capacity — the maximum number of people that can fit in the venue. Events can optionally define their own event capacity (the capacity field on the events table), which completely overrides the space’s physical capacity for registration enforcement purposes. The event capacity may be set higher or lower than the space’s capacity. The AttendeesService.registerAttendee method enforces the effective capacity at registration time:
const capacity = event.capacity ?? event.space?.capacity;
If neither the event nor the space defines a capacity, registration is unlimited. If a capacity is set and the event is sold out, registration returns an error.

API Endpoints

MethodEndpointDescription
GET/api/spaces?tenantId={id}List all spaces for a faculty tenant.
POST/api/spacesCreate a new space. Body: { name, capacity, tenantId }.
GET/api/spaces/{id}Retrieve a single space by ID.
PUT/api/spaces/{id}Update a space’s name and/or capacity.
DELETE/api/spaces/{id}Delete a space permanently.
Listing spaces for a tenant:
curl "https://your-domain.com/api/spaces?tenantId=8f3e1a2b-1234-5678-abcd-ef0123456789" \
  -H "Cookie: session=<your-jwt-cookie>"
[
  {
    "id": "spc-uuid-1",
    "name": "Auditorio Simón Bolívar",
    "capacity": 400,
    "tenantId": "8f3e1a2b-1234-5678-abcd-ef0123456789",
    "createdAt": "2025-07-01T08:00:00.000Z"
  },
  {
    "id": "spc-uuid-2",
    "name": "Sala de Conferencias B",
    "capacity": 60,
    "tenantId": "8f3e1a2b-1234-5678-abcd-ef0123456789",
    "createdAt": "2025-07-15T09:30:00.000Z"
  }
]

Build docs developers (and LLMs) love