aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/api.py
diff options
context:
space:
mode:
authorJocelyn Delalande <jocelyn@crapouillou.net>2018-02-03 18:52:04 +0100
committerJocelyn Delalande <jocelyn@crapouillou.net>2018-02-07 00:06:08 +0100
commitb95ea7f4e68a0794a44e68621a8210bb4db43e67 (patch)
tree161190c22b4c6257d3a6839d610d865e0b63aa09 /ihatemoney/api.py
parent036cd05e5716a694f575b3c65f6541f04a8b48bf (diff)
downloadihatemoney-mirror-b95ea7f4e68a0794a44e68621a8210bb4db43e67.zip
ihatemoney-mirror-b95ea7f4e68a0794a44e68621a8210bb4db43e67.tar.gz
ihatemoney-mirror-b95ea7f4e68a0794a44e68621a8210bb4db43e67.tar.bz2
Add statistics support to API
Diffstat (limited to 'ihatemoney/api.py')
-rw-r--r--ihatemoney/api.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ihatemoney/api.py b/ihatemoney/api.py
index 31ed06c..6068cf7 100644
--- a/ihatemoney/api.py
+++ b/ihatemoney/api.py
@@ -65,6 +65,13 @@ class ProjectHandler(Resource):
return form.errors, 400
+class ProjectStatsHandler(Resource):
+ method_decorators = [need_auth]
+
+ def get(self, project):
+ return project.members_stats
+
+
class APIMemberForm(MemberForm):
""" Member is not disablable via a Form.
@@ -163,6 +170,7 @@ class BillHandler(Resource):
restful_api.add_resource(ProjectsHandler, '/projects')
restful_api.add_resource(ProjectHandler, '/projects/<string:project_id>')
restful_api.add_resource(MembersHandler, "/projects/<string:project_id>/members")
+restful_api.add_resource(ProjectStatsHandler, "/projects/<string:project_id>/statistics")
restful_api.add_resource(MemberHandler, "/projects/<string:project_id>/members/<int:member_id>")
restful_api.add_resource(BillsHandler, "/projects/<string:project_id>/bills")
restful_api.add_resource(BillHandler, "/projects/<string:project_id>/bills/<int:bill_id>")