Fix: Load booking constants from shared/constants.json

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.
This commit is contained in:
counterweight 2025-12-21 17:29:39 +01:00
parent 19c313767c
commit 1cd60b4bbc
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 15 additions and 8 deletions

View file

@ -0,0 +1,13 @@
"""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"]