Add meta and count field to teams awards endpoints (#2095)

* Add meta and count field to `/api/v1/teams/[team_id]/awards` and `/api/v1/teams/me/awards`
This commit is contained in:
Kevin Chung
2022-04-20 04:21:25 -04:00
committed by GitHub
parent a626d4b4bf
commit fce5ee418b
2 changed files with 6 additions and 3 deletions

View File

@@ -23,11 +23,12 @@
- `/api/v1/users/me/solves`
- `/api/v1/users/me/fails`
- `/api/v1/users/me/awards`
- `/api/v1/teams/me/awards`
- `/api/v1/users/[user_id]/solves`
- `/api/v1/users/[user_id]/fails`
- `/api/v1/users/[user_id]/awards`
- `/api/v1/teams/[team_id]/solves`
- TODO: Add more of this for the teams endpoints
- `/api/v1/teams/[team_id]/awards`
- Improve speed of `/api/v1/teams/me/fails`
- Improve speed of `/api/v1/teams/[team_id]/fails`
- Improve speed of `/api/v1/users/me/fails`

View File

@@ -544,7 +544,8 @@ class TeamPrivateAwards(Resource):
if response.errors:
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>/solves")
@@ -620,4 +621,5 @@ class TeamPublicAwards(Resource):
if response.errors:
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}}