Added check so number must be more than zero

This commit is contained in:
Ben Arc
2022-03-14 11:22:56 +00:00
parent ff70efd1eb
commit eb8bbd3896
2 changed files with 10 additions and 0 deletions

View File

@ -76,6 +76,11 @@ async def api_link_create_or_update(
link_id=None,
wallet: WalletTypeInfo = Depends(get_key_type),
):
if data.min < 1:
raise HTTPException(
detail="Min must be more than 1.", status_code=HTTPStatus.BAD_REQUEST
)
if data.min > data.max:
raise HTTPException(
detail="Min is greater than max.", status_code=HTTPStatus.BAD_REQUEST

View File

@ -71,6 +71,11 @@ async def api_link_create_or_update(
link_id: str = None,
wallet: WalletTypeInfo = Depends(require_admin_key),
):
if data.min_withdrawable < 1:
raise HTTPException(
detail="Min must be more than 1.", status_code=HTTPStatus.BAD_REQUEST
)
if data.max_withdrawable < data.min_withdrawable:
raise HTTPException(
detail="`max_withdrawable` needs to be at least `min_withdrawable`.",