aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-07-10 11:34:58 +0200
committerneodarz <neodarz@neodarz.net>2019-07-10 11:34:58 +0200
commit869beb6f11bcf151c9f90be36dc7a798d8e2bb2c (patch)
treea848ddd4b42302383ebb2a2598ab9067eb82d13b
parent2ec8ef353eeaf133f87177cca2dae828454ba83b (diff)
downloadumosapi-869beb6f11bcf151c9f90be36dc7a798d8e2bb2c.tar.xz
umosapi-869beb6f11bcf151c9f90be36dc7a798d8e2bb2c.zip
Add reset function
Diffstat (limited to '')
-rw-r--r--umosapi/api.py8
-rw-r--r--umosapi/app_db/uobject.py6
2 files changed, 14 insertions, 0 deletions
diff --git a/umosapi/api.py b/umosapi/api.py
index 8a0945f..45bab9c 100644
--- a/umosapi/api.py
+++ b/umosapi/api.py
@@ -98,3 +98,11 @@ class ObjectsEq(Resource):
"msg": status['msg'],
"datas": sanitize(status['datas'])
}, status['code']
+
+
+@api.route("/objects/reset")
+class ObjectsClean(Resource):
+ def get(self):
+ """ Reset collection """
+ uobject.reset()
+ return "done"
diff --git a/umosapi/app_db/uobject.py b/umosapi/app_db/uobject.py
index 60094c7..00aa9b7 100644
--- a/umosapi/app_db/uobject.py
+++ b/umosapi/app_db/uobject.py
@@ -85,3 +85,9 @@ class UObject(object):
"datas": datas,
"code": 404
}
+
+ def reset(self):
+ db = MongoDB(self.app)
+ mongo = db.connection()
+ mongo.db.uobjects.remove()
+ return "done"