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:
parent
19c313767c
commit
1cd60b4bbc
3 changed files with 15 additions and 8 deletions
13
backend/shared_constants.py
Normal file
13
backend/shared_constants.py
Normal 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"]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue