|
|
@@ -987,6 +987,27 @@ module.exports = function(crowi) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ pageSchema.statics.completelyDeletePageRecursively = function (pageData, user, options) {
|
|
|
+ // Delete Bookmarks, Attachments, Revisions, Pages and emit delete
|
|
|
+ var Page = this
|
|
|
+ , path = pageData.path
|
|
|
+ , options = options || { includeDeletedPage: true }
|
|
|
+ ;
|
|
|
+
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ Page
|
|
|
+ .generateQueryToListByStartWith(path, user, options)
|
|
|
+ .then(function (pages) {
|
|
|
+ Promise.all(pages.map(function (page) {
|
|
|
+ return Page.completelyDeletePage(page, user, options);
|
|
|
+ }))
|
|
|
+ .then(function (data) {
|
|
|
+ return resolve(data[0]);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
pageSchema.statics.removePageById = function(pageId) {
|
|
|
var Page = this;
|
|
|
|