mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
@@ -127,18 +127,30 @@ def get_jobs_by_service(service_id):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
errors = {
|
errors = {
|
||||||
"limit_days": [
|
"limit_days": [
|
||||||
"{} is not an integer".format(request.args["limit_days"])
|
f"{request.args['limit_days']} is not an integer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
raise InvalidRequest(errors, status_code=400)
|
raise InvalidRequest(errors, status_code=400)
|
||||||
else:
|
else:
|
||||||
limit_days = None
|
limit_days = None
|
||||||
|
|
||||||
|
valid_statuses = set(JobStatus)
|
||||||
|
statuses_arg = request.args.get("statuses", "")
|
||||||
|
if statuses_arg == "":
|
||||||
|
statuses = None
|
||||||
|
else:
|
||||||
|
statuses = []
|
||||||
|
for x in statuses_arg.split(","):
|
||||||
|
status = x.strip()
|
||||||
|
if status in valid_statuses:
|
||||||
|
statuses.append(status)
|
||||||
|
else:
|
||||||
|
statuses.append(None)
|
||||||
return jsonify(
|
return jsonify(
|
||||||
**get_paginated_jobs(
|
**get_paginated_jobs(
|
||||||
service_id,
|
service_id,
|
||||||
limit_days=limit_days,
|
limit_days=limit_days,
|
||||||
statuses=[x.strip() for x in request.args.get("statuses", "").split(",")],
|
statuses=statuses,
|
||||||
page=int(request.args.get("page", 1)),
|
page=int(request.args.get("page", 1)),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user