aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/api.py
diff options
context:
space:
mode:
authorJocelynDelalande <JocelynDelalande@users.noreply.github.com>2018-02-07 00:07:09 +0100
committerGitHub <noreply@github.com>2018-02-07 00:07:09 +0100
commit667e555d6726f1e27e8e5cdcfb79981b413571e9 (patch)
tree161190c22b4c6257d3a6839d610d865e0b63aa09 /ihatemoney/api.py
parentcf7bd572489aad17bf60026c6618d0ff49f822a9 (diff)
parentb95ea7f4e68a0794a44e68621a8210bb4db43e67 (diff)
downloadihatemoney-mirror-667e555d6726f1e27e8e5cdcfb79981b413571e9.zip
ihatemoney-mirror-667e555d6726f1e27e8e5cdcfb79981b413571e9.tar.gz
ihatemoney-mirror-667e555d6726f1e27e8e5cdcfb79981b413571e9.tar.bz2
Merge pull request #324 from JocelynDelalande/jd-stats-api
Add an API endpoint for statistics
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>")