Use MIN_ADVANCE_DAYS constant globally instead of hardcoded value

- Updated availability.py to use MIN_ADVANCE_DAYS constant instead of hardcoded timedelta(days=1)
- Ensures consistency between booking and availability date ranges
- Both now use the same constant from shared_constants
This commit is contained in:
counterweight 2025-12-21 17:53:47 +01:00
parent a14405a998
commit 208278bddb
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -15,16 +15,16 @@ from schemas import (
SetAvailabilityRequest, SetAvailabilityRequest,
CopyAvailabilityRequest, CopyAvailabilityRequest,
) )
from shared_constants import MAX_ADVANCE_DAYS from shared_constants import MIN_ADVANCE_DAYS, MAX_ADVANCE_DAYS
router = APIRouter(prefix="/api/admin/availability", tags=["availability"]) router = APIRouter(prefix="/api/admin/availability", tags=["availability"])
def _get_date_range_bounds() -> tuple[date, date]: def _get_date_range_bounds() -> tuple[date, date]:
"""Get the valid date range for availability (tomorrow to +30 days).""" """Get the valid date range for availability (using MIN_ADVANCE_DAYS to MAX_ADVANCE_DAYS)."""
today = date.today() today = date.today()
min_date = today + timedelta(days=1) # Tomorrow min_date = today + timedelta(days=MIN_ADVANCE_DAYS)
max_date = today + timedelta(days=MAX_ADVANCE_DAYS) max_date = today + timedelta(days=MAX_ADVANCE_DAYS)
return min_date, max_date return min_date, max_date