Neo4j Find Available Slots StaffAndResource icon

Neo4j Find Available Slots StaffAndResource

根據時間、員工和資源可用性查找可用的預約時間段,businessId: 要查詢可用時段的商家 ID (UUID),serviceId: 要預約的服務 ID (UUID) (用於獲取時長),startDateTime: 查詢範圍的開始時間 (ISO 8601 格式, 需含時區),endDateTime: 查詢範圍的結束時間 (ISO 8601 格式, 需含時區),intervalMinutes: 生成潛在預約時段的時間間隔(分鐘),requiredStaffId: 指定員工的 ID (UUID)(在 StaffAndResource 模式下必填),requiredResourceTypeId: 需要的資源類型 ID (UUID)(在 StaffAndResource 模式下必填),requiredResourceCapacity: 所需資源的數量

Neo4j Find Available Slots StaffAndResource

AI-generated

Overview

This node queries a Neo4j database to find available booking time slots for a specified business, service, staff member, and resource type within a given date/time range. It is designed for scenarios where appointment scheduling depends on the simultaneous availability of both staff and specific resources.

Typical use cases include:

  • Scheduling appointments in service businesses (e.g., salons, clinics) where both staff availability and resource capacity must be considered.
  • Finding potential booking slots that respect business hours, staff working times, and resource constraints.
  • Automating calendar integrations or booking systems that require precise availability checks.

For example, a salon might use this node to find all 15-minute intervals between two dates when a particular stylist (staff) and a specific type of chair (resource) are both available to perform a haircut service.

Properties

Name Meaning
Business ID The unique identifier of the business to query available slots for.
Service ID The unique identifier of the service to book; used to determine the service duration.
Start Date/Time The start of the date/time range to search for available slots, in ISO 8601 format with timezone.
End Date/Time The end of the date/time range to search for available slots, in ISO 8601 format with timezone.
Slot Interval (Minutes) The interval in minutes at which to generate potential booking slots within the search range.
Required Staff ID The unique identifier of the staff member required for the booking (mandatory in this mode).
Required Resource Type The unique identifier of the resource type needed for the booking (mandatory in this mode).
Required Resource Capacity The quantity of the required resource type needed for the booking.

Output

The node outputs an array of JSON objects, each containing:

  • availableSlots: An array of ISO 8601 datetime strings representing the start times of available booking slots.
  • timezone: The timezone used for the output slots (detected from input or business settings).
  • mode: Always "StaffAndResource" indicating the mode of operation.
  • serviceId: The service identifier used in the query.
  • serviceDuration: Duration of the service in minutes.
  • staffName: Name of the staff member.
  • staffId: Identifier of the staff member.
  • resourceTypeName: Name of the resource type.
  • resourceTypeId: Identifier of the resource type.
  • requiredCapacity: Number of resources requested.
  • totalCapacity: Total capacity available for the resource type.
  • resourceDescription: Description of the resource type.

No binary data output is produced by this node.

Dependencies

  • Requires a Neo4j database connection configured via credentials including host, port, username, password, and optionally database name.
  • Uses Neo4j driver library to connect and run Cypher queries.
  • Relies on helper utilities for date/time normalization, timezone detection, and availability checking.
  • Requires proper configuration of the Neo4j instance with relevant nodes and relationships representing businesses, services, staff, resource types, and their availabilities.

Troubleshooting

  • Missing Required Staff or Resource IDs: The node throws errors if either the required staff ID or resource type ID is not provided, as these are mandatory in this mode.
  • Invalid Credentials: Errors occur if Neo4j credentials are incomplete or incorrect; ensure all required fields are set.
  • Invalid Date/Time Format: Input start or end date/time must be valid ISO 8601 strings including timezone information.
  • No Matching Records: If no matching business, service, staff, or resource type is found, the node reports an error indicating which ID could not be found.
  • Insufficient Resource Capacity: If the total capacity of the resource type is less than the requested capacity, an error is thrown.
  • Neo4j Connection Issues: Connection failures or query errors will be reported; verify network connectivity and Neo4j server status.
  • Timezone Detection Fails: If the timezone cannot be detected from the query or business settings, UTC is used as fallback.

Links and References

Discussion