Add meta and count field to teams endpoints to make it easier to show graphs (#2072)

* Add meta and count field to teams endpoints to make it easier to show graphs
This commit is contained in:
Kevin Chung
2022-03-21 19:46:11 -04:00
committed by GitHub
parent f39043427b
commit d29102dae8

View File

@@ -498,7 +498,8 @@ class TeamPrivateSolves(Resource):
if response.errors: if response.errors:
return {"success": False, "errors": response.errors}, 400 return {"success": False, "errors": response.errors}, 400
return {"success": True, "data": response.data} count = len(response.data)
return {"success": True, "data": response.data, "meta": {"count": count}}
@teams_namespace.route("/me/fails") @teams_namespace.route("/me/fails")
@@ -562,7 +563,8 @@ class TeamPublicSolves(Resource):
if response.errors: if response.errors:
return {"success": False, "errors": response.errors}, 400 return {"success": False, "errors": response.errors}, 400
return {"success": True, "data": response.data} count = len(response.data)
return {"success": True, "data": response.data, "meta": {"count": count}}
@teams_namespace.route("/<team_id>/fails") @teams_namespace.route("/<team_id>/fails")