Skip to content

Fast Booking System

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

Fast Booking Feature

Purpose and Scope

The Fast Booking Feature provides a streamlined interface for immediate room reservations in the Effective Office system. This feature enables users to quickly book available meeting rooms for a minimum duration without navigating through the full booking editor workflow. The system automatically finds the most suitable available room and creates an instant booking.

For information about the complete booking workflow including custom duration and organizer selection, see Room Booking Workflow. For details about the booking editor interface, see Booking Features.

Architecture Overview

The Fast Booking Feature follows a component-based architecture with clear separation between presentation, domain logic, and data management.

Component Architecture

component-architecture.svg

Component Structure

FastBookingComponent

The FastBookingComponent serves as the main coordinator for the fast booking feature, implementing the ModalWindow interface and managing the entire booking lifecycle.

Property Type Purpose
minEventDuration Int Minimum booking duration in minutes
selectedRoom RoomInfo Currently selected room for booking
rooms List<RoomInfo> Available rooms for booking
onCloseRequest () -> Unit Callback to close the modal

State Management

The component uses a MutableStateFlow<State> to manage the booking state:

state-management.svg

Fast Booking Workflow

Room Selection and Booking Process

room-selection-and-booking-process.svg

Room Selection Algorithm

The room selection logic is handled by SelectRoomUseCase which implements intelligent room selection:

  1. Primary Selection: Attempts to book the currently selected room if available
  2. Fallback Selection: Finds alternative rooms from the provided list
  3. Availability Calculation: Determines the nearest available room and wait time

Event Creation

The booking creation process involves:

event-creation.svg

The system creates an EventInfo object with the current time as start time and adds the minimum duration:

Field Value
startTime currentLocalDateTime.cropSeconds()
finishTime currentInstant.plus(minDuration.minutes).asLocalDateTime.cropSeconds()
id Generated by external calendar service

User Interactions

Room Freeing Process

When a user requests to free a room, the system:

  1. Sets loading state
  2. Calls DeleteBookingUseCase with the current event
  3. Waits for external service synchronization
  4. Closes the modal on success

Time Management

The component maintains real-time updates using BootstrapperTimer:

  • Update Interval: 1 minute
  • Timer Use Case: TimerUseCase for time calculations
  • Current Time Display: Updates state with currentLocalDateTime

Error Handling

The system implements comprehensive error handling:

Error Scenarios

Error Type Handling Strategy User Feedback
Room Selection Failure Log error, show failure modal "No available rooms" message
Booking Creation Failure Restore previous state, show error Generic error message
Network Timeout Retry logic in use cases Loading state with timeout
Calendar Sync Delay Built-in delays for external sync Loading indicators

Synchronization Delays

The system includes explicit delays to account for external service synchronization:

  • Booking Creation: 2000ms delay after successful creation
  • Booking Deletion: 3000ms delay after successful deletion

These delays ensure that external calendar services have time to process changes before the UI updates.

Clone this wiki locally