Booking Service
Appointment scheduling and "time inventory" management for service businesses.
Overview
Booking Service manages appointments for service-oriented businesses like spas, salons, and clinics. It tracks staff availability, resource scheduling, and time slot management.
Key Features
- Staff Scheduling - Working hours per staff member
- Resource Management - Rooms, beds, equipment availability
- Appointment Booking - Find and reserve time slots
- Availability Algorithm - Intersection of staff + resource schedules
Architecture Context
graph LR
ORDER["📝 Order Service"] --> BOOKING["📅 Booking Service"]
POS["POS"] --> BOOKING
BOOKING --> MERCHANT["🏪 Merchant Service"]
style BOOKING fill:#9b59b6,stroke:#7d3c98,color:#fff
Quick Start
cd services/booking-service-net
cp .env.example .env
dotnet run --project src/BookingService.API
API Endpoints
Staff Schedules
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/staff/{id}/schedule |
Get staff schedule |
PUT |
/api/v1/staff/{id}/schedule |
Update schedule |
GET |
/api/v1/staff/{id}/availability |
Get available slots |
Resources
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/resources |
List resources by shop |
POST |
/api/v1/resources |
Create resource |
PUT |
/api/v1/resources/{id} |
Update resource |
GET |
/api/v1/resources/{id}/availability |
Get available slots |
Appointments
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/appointments |
List appointments |
POST |
/api/v1/appointments |
Create appointment |
GET |
/api/v1/appointments/{id} |
Get appointment details |
PATCH |
/api/v1/appointments/{id}/status |
Update status |
DELETE |
/api/v1/appointments/{id} |
Cancel appointment |
Slot Finder
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/slots/find |
Find available slots |
Domain Model
StaffSchedule
public class StaffSchedule : Entity
{
public Guid StaffId { get; private set; }
public Guid ShopId { get; private set; }
public DayOfWeek DayOfWeek { get; private set; }
public TimeOnly StartTime { get; private set; }
public TimeOnly EndTime { get; private set; }
}
Resource
public class Resource : Entity, IAggregateRoot
{
public Guid ShopId { get; private set; }
public string Name { get; private set; }
public ResourceType Type { get; private set; } // Room, Bed, Equipment
public int Capacity { get; private set; }
}
Appointment
public class Appointment : Entity, IAggregateRoot
{
public Guid ShopId { get; private set; }
public Guid? CustomerId { get; private set; }
public Guid? StaffId { get; private set; }
public Guid? ResourceId { get; private set; }
public Guid ServiceId { get; private set; }
public DateTime StartTime { get; private set; }
public DateTime EndTime { get; private set; }
public AppointmentStatus Status { get; private set; }
}
Slot Finding Algorithm
Available Slots = Staff Schedule ∩ Resource Schedule - Existing Appointments
sequenceDiagram
participant Client
participant Booking as Booking Service
participant DB as Database
Client->>Booking: Find Slots (Service, Date, Staff?)
Booking->>DB: Get Staff Schedules
Booking->>DB: Get Resource Schedules
Booking->>DB: Get Existing Appointments
Booking->>Booking: Calculate Intersection
Booking->>Booking: Remove Booked Slots
Booking-->>Client: Available Slots
Related Services
- Order Service - Uses ServiceStrategy
- Merchant Service - Shop configuration
- Catalog Service - Service products
License
Proprietary - GoodGo Platform