From 7867863b6cd21a87b97df7cabd6871f6a5204602 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 18 Aug 2018 21:49:20 +0200 Subject: Add ability to remove a user --- src/lb_app/api.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lb_app/api.py') diff --git a/src/lb_app/api.py b/src/lb_app/api.py index 6dfe2e8..9827828 100644 --- a/src/lb_app/api.py +++ b/src/lb_app/api.py @@ -41,3 +41,14 @@ class Register(Resource): if status is None: return loads('{"msg": "done"}'), 201 return loads('{"msg": "'+status+'"}'), 200 + +@api.route('/users/') +@api.doc(params={'username': 'Jean'}) +class Remove(Resource): + def delete(self, username): + """ Remove a user """ + status = user.remove(username) + + if status is None: + return loads('{"msg": "done"}'), 201 + return loads('{"msg": "'+status+'"}'), 200 -- cgit v1.2.1