Skip to content

Booking Management

Radch-enko edited this page Jul 24, 2025 · 3 revisions

Booking Management

This document provides comprehensive room and workspace reservation functionality for the Effective Office platform. This system handles booking creation, updates, deletion, and availability checking through a pluggable calendar provider architecture. The core functionality integrates with external calendar systems (primarily Google Calendar) to maintain synchronized booking data and enable real-time updates.

For information about workspace and room management, see [Workspace Management](Workspace Management). For real-time notifications and calendar synchronization, see [Notifications & Real-time Updates](Notifications and Real-time Updates). For complete booking workflows from the client perspective, see [Room Booking Workflow](Room Booking Workflow).

Calendar Provider Architecture

The booking system uses a pluggable calendar provider architecture that allows different calendar implementations to be used based on configuration.

Calendar Provider Interface Design

calendar-provider-interface-design.svg

Core Domain Model

The booking domain model represents workspace reservations with support for recurring bookings and external calendar integration.

Booking Domain Structure

booking-domain-structure.svg

Google Calendar Integration

The GoogleCalendarProvider implements comprehensive Google Calendar integration with availability checking, event conversion, and workspace calendar mapping. For detailed instructions on setting up Google Workspace and Google Calendar for your organization, see Google Workspace & Calendar Integration.

Key Integration Features

Feature Implementation Description
Availability Checking checkBookingAvailability() Prevents overlapping bookings by querying existing events
Event Conversion convertToGoogleEvent() / convertToBooking() Bidirectional conversion between domain models and Google Calendar events
Workspace Mapping getCalendarIdByWorkspace() Maps workspace IDs to Google Calendar IDs
User Management findOrCreateUserByEmail() Automatically creates system users for external calendar events
Recurrence Support RecurrenceRuleConverter Converts between domain recurrence rules and Google Calendar RRULE format

Google Calendar Event Flow

google-calendar-event-flow.svgWorkspaceDomainServiceGoogle Calendar API

REST API Layer

The booking API provides comprehensive CRUD operations with filtering, validation, and error handling.

API Endpoints and Operations

Method Endpoint Controller Method Description
GET /v1/bookings/{id} getBookingById() Retrieve specific booking
GET /v1/bookings getBookings() List bookings with filters
POST /v1/bookings createBooking() Create new booking
PUT /v1/bookings/{id} updateBooking() Update existing booking
DELETE /v1/bookings/{id} deleteBooking() Delete booking

Request/Response Data Flow

rest-api-data-flow.svg

Exception Handling

The API provides comprehensive exception handling for booking-specific errors:

Exception HTTP Status Error Code Description
BookingNotFoundException 404 Not Found Booking does not exist
UserNotFoundException 404 Not Found Owner/participant not found
WorkspaceNotFoundException 404 Not Found Workspace does not exist
InvalidTimeRangeException 400 Bad Request Invalid booking time range
OverlappingBookingException 409 Conflict Booking conflicts with existing event

Data Transfer Objects

The system uses layered DTOs for API communication, validation, and data transformation.

DTO Hierarchy

dto-hierarhy.svg

Booking Availability and Conflict Resolution

The system implements robust availability checking to prevent double-booking and ensure data consistency.

Availability Checking Process

availability-checking-process.svg

Overlap Detection Algorithm

The overlap detection uses interval comparison logic:

  • Two bookings overlap if: startTime < existingEnd && existingStart < endTime
  • Self-updates are excluded by comparing booking IDs
  • The system queries only the specific time range for efficiency

Client Integration

The tablet client integrates with the booking system through mapped domain models and reactive UI components.

Client-Side Booking Model

client-side-booking-model.svg

The isEditable flag controls whether users can modify bookings from the tablet interface, distinguishing between system-created bookings and external calendar events.

Clone this wiki locally