diff --git a/app/routers_v2/gauntletrewards.py b/app/routers_v2/gauntletrewards.py index 6022da6..607a125 100644 --- a/app/routers_v2/gauntletrewards.py +++ b/app/routers_v2/gauntletrewards.py @@ -30,6 +30,7 @@ async def v1_gauntletreward_get( reward_id: list = Query(default=None), win_num: Optional[int] = None, loss_max: Optional[int] = None, + limit: int = 100, ): all_rewards = GauntletReward.select().order_by(GauntletReward.id) @@ -46,6 +47,9 @@ async def v1_gauntletreward_get( all_rewards = all_rewards.order_by(-GauntletReward.loss_max, GauntletReward.win_num) + limit = max(0, min(limit, 500)) + all_rewards = all_rewards.limit(limit) + return_val = {"count": all_rewards.count(), "rewards": []} for x in all_rewards: return_val["rewards"].append(model_to_dict(x))