Skip to main content

Booking & Reservation System

Concordia’s booking system enables customers to reserve services with providers through an availability-based scheduling system with status management and cancellation policies.

Overview

The booking system consists of two main components:
  • Availability Schedules (services_availability.schema.ts) - Provider defines when they’re available
  • Bookings (services_bookings.schema.ts) - Customer reservations of specific time slots

Availability Management

From src/database/schemas/services_availability.schema.ts:

Availability Fields

text
required
Unique availability entry identifier
text
required
Reference to the service listing
integer
required
Day of the week using numeric representation:
  • 0 = Sunday
  • 1 = Monday
  • 2 = Tuesday
  • 3 = Wednesday
  • 4 = Thursday
  • 5 = Friday
  • 6 = Saturday
text
required
Start time in 24-hour HH:MM formatExample: "09:00", "14:30"
text
required
End time in 24-hour HH:MM formatExample: "17:00", "18:30"
boolean
default:true
Whether this time slot is currently available for bookingSet to false to temporarily block a recurring time slot without deleting it
timestamp
required
When this availability entry was created

Unique Constraint

The schema enforces uniqueness on (serviceId, dayOfWeek, startTime) to prevent duplicate time slots:
You cannot create two availability entries with the same service, day, and start time. This prevents scheduling conflicts.

Recurring Weekly Schedule

Availability entries define a recurring weekly schedule. For example:
This creates:
  • Monday: Available 9am-12pm and 2pm-5pm
  • Wednesday: Available 9am-5pm
Multiple availability windows per day are supported, perfect for providers with lunch breaks or split schedules.

Booking Management

From src/database/schemas/services_bookings.schema.ts:

Core Booking Fields

text
required
Unique booking identifier
text
required
Reference to the service being booked
text
required
User ID of the customer making the booking
text
required
User ID of the service provider

Schedule Details

text
required
Date of the service in YYYY-MM-DD formatExample: "2026-03-15"
text
required
Start time of the service in HH:MM formatExample: "14:00"
integer
required
Duration of the booked service in minutesExample: 90 for 1.5 hours
The combination of bookingDate, bookingTime, and durationMinutes defines the exact time slot reserved.

Payment Information

text
Final price as a string for decimal precisionExample: "75.00"
text
default:"EUR"
ISO 4217 currency codeExample: "EUR", "USD", "GBP"

Booking Status

text
default:"pending"
Current booking status with possible values:
  • pending - Awaiting provider confirmation
  • confirmed - Provider has confirmed the booking
  • completed - Service has been delivered
  • cancelled - Booking was cancelled
  • no_show - Customer didn’t show up

Communication

text
Optional message from customer to providerExample: "I need wheelchair access. Is that available?"
text
Provider’s response to the booking or customer messageExample: "Yes, we have wheelchair access. See you at 2pm!"

Lifecycle Timestamps

timestamp
When the booking was cancelled (if applicable)Only set when status transitions to cancelled
timestamp
When the service was marked as completedSet when status transitions to completed
timestamp
required
When the booking was initially created
timestamp
required
Last modification time, automatically updated

Booking Status Workflow

Status Transitions

Provider accepts the booking requestTypically within 24-48 hours of booking
Either party cancels before confirmationSets cancelledAt timestamp
Service successfully deliveredSets completedAt timestamp, enables review
Cancellation after confirmationMay have policy implications (see cancellation policies)
Customer didn’t attend appointmentProvider marks as no-show

Cancellation Policies

From services_listings.schema.ts, services define cancellation rules:
integer
Minimum hours in advance required for bookingExample: 24 means customers must book at least 1 day ahead
integer
Hours before service when free cancellation is allowedExample: 48 means free cancellation up to 2 days before

Example Policy Enforcement

Database Indexes

From the schema files:

Availability Indexes

Optimizes queries for all availability slots for a service.

Booking Indexes

Indexes support efficient queries for:
  • All bookings for a service
  • Customer’s booking history
  • Provider’s booking calendar
  • Bookings by status for dashboards
  • Bookings by date for calendar views

Integration with Services

From services_listings.schema.ts, the relationship is defined:
Each service can have:
  • Multiple availability windows (recurring weekly schedule)
  • Multiple bookings (past and future reservations)

Booking Flow Example

1. Provider Sets Availability

2. Customer Requests Booking

3. Provider Confirms

4. Service Completed

Conflict Prevention

To prevent double-booking:
  1. Check availability - Verify day/time matches an active availability entry
  2. Check existing bookings - Ensure no overlapping confirmed bookings
  3. Consider duration - Account for service duration when checking conflicts

Best Practices

For Providers

  1. Set realistic availability - Only mark times you can reliably serve customers
  2. Use isAvailable: false - Temporarily block slots without deleting recurring schedule
  3. Respond promptly - Confirm or decline bookings within 24 hours
  4. Communicate clearly - Use providerResponse for important details

For Booking System

  1. Validate against availability - Check day/time matches provider schedule
  2. Prevent double-booking - Lock slots or use transactions
  3. Enforce policies - Respect bookingAdvanceHours and cancellationHours
  4. Send notifications - Email/notify on booking, confirmation, cancellation
  5. Enable reviews - Only allow reviews for completed bookings

For Customers

  1. Book in advance - Respect bookingAdvanceHours requirement
  2. Provide details - Use customerMessage for special requests
  3. Cancel early - Follow cancellationHours policy for free cancellation
  4. Leave reviews - Help other customers after completed bookings