Neo4j Update Booking icon

Neo4j Update Booking

根據 booking_id 更新預約資訊。如果更新 bookingTime 或 staffId,會先檢查新時段/員工的可用性。bookingId: 要更新的預約 ID (UUID)。其他欄位為可選更新項。

Neo4j Update Booking

AI-generated

Overview

This node updates booking information stored in a Neo4j database based on a given booking ID. It allows modifying fields such as the booking start time, status, assigned staff member, and notes. Before applying changes that affect booking time or staff assignment, it performs availability checks to ensure no conflicts arise with existing bookings.

Common scenarios for this node include:

  • Rescheduling an appointment by changing its start time.
  • Updating the status of a booking (e.g., marking it as Confirmed, Cancelled, or Completed).
  • Reassigning the staff member responsible for the service.
  • Adding or updating notes related to the booking.

Practical example: A salon management system can use this node to update customer appointments when clients request new times or change their preferred stylist.

Properties

Name Meaning
Booking ID The unique identifier (UUID) of the booking to update. This is required.
Booking Time New start time for the booking in ISO 8601 format including timezone. Optional.
Status New status of the booking, e.g., Confirmed, Cancelled, Completed. Optional.
Staff ID UUID of the staff member assigned to the booking. Leave empty to remove the staff assignment. Optional.
Notes Additional notes or comments about the booking. Optional.

Output

The node outputs an array of items where each item contains a json object with a booking field representing the updated booking record. The booking object includes all booking properties plus related entity IDs:

  • booking_time: The updated booking start time, converted to the detected or business timezone.
  • status: Current status of the booking.
  • business_id: ID of the associated business.
  • service_id: ID of the booked service.
  • customer_id: ID of the customer who made the booking.
  • staff_id: ID of the assigned staff member (if any).
  • resource_type_id: ID of the resource type used (if applicable).
  • resource_quantity: Quantity of resources used (default 1 if not specified).
  • notes: Updated notes for the booking.

If binary data were involved, it would be summarized here, but this node only deals with JSON data.

In case of errors during processing individual items, the output item will contain error details under error and error_details fields alongside the original input data.

Dependencies

  • Requires a Neo4j database connection configured via credentials providing host, port, username, password, and optionally database name.
  • Uses the official Neo4j driver library to connect and run Cypher queries.
  • Relies on helper modules for:
    • Running Cypher queries safely.
    • Converting Neo4j date/time values.
    • Detecting and handling timezones.
    • Checking availability of time slots, staff, and resources before updating bookings.

Troubleshooting

Common Issues

  • Missing or incomplete Neo4j credentials: The node requires full connection details; missing any part will cause failure.
  • Invalid booking ID: If the provided booking ID does not exist, the node throws an error.
  • Invalid date/time format: The booking time must be in ISO 8601 format with timezone info; otherwise, the update is rejected.
  • Availability conflicts: When changing booking time or staff, the node checks availability and will error if conflicts are detected.
  • Missing required fields for certain booking modes: For example, staff ID is mandatory for some booking modes; omitting it causes errors.

Error Messages and Resolutions

  • "Neo4j credentials are not fully configured."
    Ensure all required credential fields (host, port, username, password) are set correctly.

  • "Booking ID is required."
    Provide a valid booking ID for each item.

  • "Booking not found with ID: ..."
    Verify the booking ID exists in the database.

  • "Invalid new booking time format: ... Use ISO 8601."
    Correct the booking time format to ISO 8601 with timezone.

  • "Cannot update: Staff ID is required for StaffOnly service booking mode."
    Provide a staff ID when updating bookings with this mode.

  • Availability check failures indicate scheduling conflicts; adjust booking time or staff accordingly.

  • Errors related to Neo4j connectivity or query execution suggest checking database availability and credentials.

Links and References

Discussion