Created shared_constants.py module that loads constants from the shared JSON file. Updated availability.py and booking.py to import from this module instead of hardcoding values. This ensures backend and frontend stay in sync with the same source of truth for booking configuration.
13 lines
510 B
Python
13 lines
510 B
Python
"""Load shared constants from shared/constants.json."""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
_constants_path = Path(__file__).parent.parent / "shared" / "constants.json"
|
|
_constants = json.loads(_constants_path.read_text())
|
|
|
|
# Booking constants
|
|
SLOT_DURATION_MINUTES: int = _constants["booking"]["slotDurationMinutes"]
|
|
MIN_ADVANCE_DAYS: int = _constants["booking"]["minAdvanceDays"]
|
|
MAX_ADVANCE_DAYS: int = _constants["booking"]["maxAdvanceDays"]
|
|
NOTE_MAX_LENGTH: int = _constants["booking"]["noteMaxLength"]
|
|
|