Skip to content

Commit

Permalink
Fix: restrict user to extract more than 24 hour active projects
Browse files Browse the repository at this point in the history
  • Loading branch information
kaditya97 committed Dec 28, 2023
1 parent 0a3e152 commit c9fb313
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/api/projects/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,13 @@ def get(self):
"""
interval = request.args.get("interval", "24")
if not interval.isdigit():
return {"Error": "Interval must be a number greater than 0"}, 400
return {
"Error": "Interval must be a number greater than 0 and less than or equal to 24"
}, 400
interval = int(interval)
if interval <= 0 or interval > 24:
return {
"Error": "Interval must be a number greater than 0 and less than or equal to 24"
}, 400
projects_dto = ProjectService.get_active_projects(interval)
return projects_dto, 200

0 comments on commit c9fb313

Please sign in to comment.