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:
parent
0d8369ce65
commit
2efbd2c665
2 changed files with 23 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue