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
|
|
@ -15,13 +15,11 @@ from schemas import (
|
|||
SetAvailabilityRequest,
|
||||
CopyAvailabilityRequest,
|
||||
)
|
||||
from shared_constants import MAX_ADVANCE_DAYS
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/admin/availability", tags=["availability"])
|
||||
|
||||
# From shared/constants.json
|
||||
MAX_ADVANCE_DAYS = 30
|
||||
|
||||
|
||||
def _get_date_range_bounds() -> tuple[date, date]:
|
||||
"""Get the valid date range for availability (tomorrow to +30 days)."""
|
||||
|
|
|
|||
|
|
@ -15,15 +15,11 @@ from schemas import (
|
|||
BookingRequest,
|
||||
AppointmentResponse,
|
||||
)
|
||||
from shared_constants import SLOT_DURATION_MINUTES, MIN_ADVANCE_DAYS, MAX_ADVANCE_DAYS
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/booking", tags=["booking"])
|
||||
|
||||
# From shared/constants.json
|
||||
SLOT_DURATION_MINUTES = 15
|
||||
MIN_ADVANCE_DAYS = 1
|
||||
MAX_ADVANCE_DAYS = 30
|
||||
|
||||
|
||||
def _get_bookable_date_range() -> tuple[date, date]:
|
||||
"""Get the valid date range for booking (tomorrow to +30 days)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue