mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
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:
@@ -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`
|
||||
|
||||
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user