Neo4j Set Business Hours icon

Neo4j Set Business Hours

設定或更新指定商家的常規每週營業時間。此操作會 **完全覆蓋** 該商家所有舊的營業時間設定。 通過 'Hours Data' (JSON 陣列) 提供時間段: 每個時間段物件需包含 'day_of_week' (數字 1-7 或英文星期名), 'start_time' (HH:MM), 'end_time' (HH:MM)。 - **基本格式**: {"day_of_week": 1, "start_time": "09:00", "end_time": "17:00"} - **設定休息時間**: 您可以為同一天提供多個不連續的時間段來表示休息時間。 範例 (週一 9-12, 13-17,中間休息): [ {"day_of_week": 1, "start_time": "09:00", "end_time": "12:00"}, {"day_of_week": 1, "start_time": "13:00", "end_time": "17:00"} ] **重要**: 請確保 start_time 早於 end_time。

Neo4j Set Business Hours

AI-generated

Overview

This node sets or updates the regular weekly business hours for a specified business in a Neo4j graph database. It completely replaces any existing business hours for the given business with the new schedule provided. The input is a JSON array describing daily time intervals, allowing multiple segments per day to represent breaks or split shifts.

Common scenarios include:

  • Automating the update of store or office opening hours in a centralized database.
  • Managing complex schedules with multiple open-close periods per day (e.g., morning and afternoon sessions).
  • Synchronizing business hours from external systems into Neo4j for use in applications like booking, availability checks, or analytics.

Example usage:

  • Setting Monday hours as 9:00–12:00 and 13:00–17:00, Tuesday as 9:00–17:00, etc.
  • Clearing old hours and applying a new weekly schedule after a policy change.

Properties

Name Meaning
Business ID The unique identifier (UUID) of the business whose hours are being set or updated.
Hours Data A JSON array specifying daily business hours. Each element must include:
- day_of_week: number (1-7) or English weekday name (Monday-Sunday)
- start_time: string in "HH:MM" format
- end_time: string in "HH:MM" format
Multiple entries for the same day allow defining breaks within that day.

Output

The node outputs an array of JSON objects, one per input item, each containing:

  • success: Boolean indicating if the operation succeeded.
  • businessId: The business ID for which hours were set.
  • deletedCount: Number of previous business hours records deleted.
  • hoursSetCount: Number of new business hours records created.

If errors occur and "Continue On Fail" is enabled, the output includes an error object detailing the issue along with the expected input format.

No binary data is produced by this node.

Dependencies

  • Requires a Neo4j database connection configured via credentials including host, port, username, password, and optionally database name.
  • Uses the official Neo4j driver to connect and run Cypher queries.
  • The node expects the Neo4j graph to have Business nodes identified by business_id property.
  • Business hours are stored as BusinessHours nodes connected to Business nodes via HAS_HOURS relationships.

Troubleshooting

  • Invalid JSON Format: If the Hours Data input is not a valid JSON array, the node will throw an error. Ensure the input is properly formatted JSON.
  • Invalid Day of Week: The day_of_week must be an integer 1-7 or a valid English weekday name (case-insensitive). Invalid values cause errors.
  • Invalid Time Format: start_time and end_time must be in "HH:MM" 24-hour format. Incorrect formats will trigger validation errors.
  • Missing or Incomplete Credentials: The node requires fully configured Neo4j credentials; missing fields will prevent connection.
  • Neo4j Connection Issues: Errors connecting to Neo4j (wrong host/port, authentication failure) will be reported.
  • Empty Hours Data: If no hours are provided, the node deletes existing hours but does not create new ones.
  • Multiple Input Items Warning: When processing multiple items, the node logs a warning since it sets hours individually per business ID.

To resolve errors:

  • Validate JSON input externally before passing it to the node.
  • Double-check day names and numeric ranges.
  • Confirm time strings follow "HH:MM" format.
  • Verify Neo4j credentials and connectivity.
  • Use the error messages and descriptions returned by the node for guidance.

Links and References

Discussion