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:
parent
a14405a998
commit
208278bddb
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue