Endpoint for purging all objects in class (#2032)

* Endpoint for purging all objects in class

* Use deleteObjectsByQuery

* Standalone handling function and purge cache

* Change endpoint url
This commit is contained in:
Marco Cheung
2016-06-15 06:52:49 +08:00
committed by Drew
parent d9f8486790
commit b2a5092627
5 changed files with 145 additions and 1 deletions

View File

@@ -91,6 +91,16 @@ DatabaseController.prototype.collectionExists = function(className) {
return this.adapter.classExists(className);
};
DatabaseController.prototype.purgeCollection = function(className) {
return this.loadSchema()
.then((schema) => {
schema.getOneSchema(className)
})
.then((schema) => {
this.adapter.deleteObjectsByQuery(className, {}, schema);
});
};
DatabaseController.prototype.validateClassName = function(className) {
if (this.skipValidation) {
return Promise.resolve();