fix: derive valid slot minutes from SLOT_DURATION_MINUTES constant

Replace hardcoded (0, 15, 30, 45) tuple with computed range based on
the SLOT_DURATION_MINUTES constant. This ensures the validation stays
in sync if the slot duration is ever changed.

Add test to verify slot minute boundary validation.
This commit is contained in:
counterweight 2025-12-23 12:17:40 +01:00
parent 0d8369ce65
commit 2efbd2c665
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 23 additions and 2 deletions

View file

@ -401,8 +401,8 @@ async def create_exchange(
detail=f"EUR amount must be a multiple of €{EUR_TRADE_INCREMENT}",
)
# Validate slot timing
valid_minutes = (0, 15, 30, 45)
# Validate slot timing - compute valid boundaries from slot duration
valid_minutes = tuple(range(0, 60, SLOT_DURATION_MINUTES))
if request.slot_start.minute not in valid_minutes:
raise HTTPException(
status_code=400,