aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-07-09 13:46:20 +0200
committerneodarz <neodarz@neodarz.net>2019-07-09 13:46:20 +0200
commit59795e4fa34d0adbfb56e16496eb0617409dce46 (patch)
tree1eea99245001a69b14cf2c3291b76d29dcde9d4d
parent55f6054edc2d8d4dcc7d7e1225380b0ea168dc88 (diff)
downloadumosapi-59795e4fa34d0adbfb56e16496eb0617409dce46.tar.xz
umosapi-59795e4fa34d0adbfb56e16496eb0617409dce46.zip
Clean API structure
Diffstat (limited to '')
-rw-r--r--umosapi/api.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/umosapi/api.py b/umosapi/api.py
index 9379a55..b60b610 100644
--- a/umosapi/api.py
+++ b/umosapi/api.py
@@ -43,8 +43,8 @@ uobject_model = api.model('UObject', {
})
-@api.route('/objects', endpoint='objetcs')
-class Objects(Resource):
+@api.route('/objects')
+class ObjectsList(Resource):
def get(self):
""" Get uobjects list """
uobjects = uobject.all()
@@ -52,9 +52,6 @@ class Objects(Resource):
return loads('{"msg": "No uobjects"}'), 404
return sanitize(uobjects), 200
-
-@api.route("/objects/register")
-class Register(Resource):
@api.expect(uobject_model)
def post(self):
""" Register new uobject """
@@ -68,8 +65,9 @@ class Register(Resource):
@api.route("/objects/<_id>")
-class Update(Resource):
+class Objects(Resource):
@api.expect(uobject_model)
+ @api.doc(params={'_id': '5d244cc13f3d46cb739912ae'})
def patch(self, _id):
""" Edit an uobject. """
args = request.get_json(force=True)
@@ -78,9 +76,7 @@ class Update(Resource):
return {"msg": status['msg']}, status['code']
-@api.route('/objects/<_id>')
-@api.doc(params={'_id': '5d244cc13f3d46cb739912ae'})
-class Remove(Resource):
+ @api.doc(params={'_id': '5d244cc13f3d46cb739912ae'})
def delete(self, _id):
""" Remove an uobject """
status = uobject.remove(_id)