|
@@ -278,40 +278,56 @@ class PageTagRelation {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // /**
|
|
|
|
|
+ // * remove all relation for Page
|
|
|
|
|
+ // *
|
|
|
|
|
+ // * @static
|
|
|
|
|
+ // * @param {Page} page related page for remove
|
|
|
|
|
+ // * @returns {Promise<any>}
|
|
|
|
|
+ // * @memberof PageTagRelation
|
|
|
|
|
+ // */
|
|
|
|
|
+ // static removeAllByPage(page) {
|
|
|
|
|
+ // return this.deleteMany({
|
|
|
|
|
+ // relatedPage: page
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * remove all relation for Page
|
|
|
|
|
|
|
+ * remove relation by id
|
|
|
*
|
|
*
|
|
|
* @static
|
|
* @static
|
|
|
- * @param {Page} page related page for remove
|
|
|
|
|
|
|
+ * @param {ObjectId} id
|
|
|
* @returns {Promise<any>}
|
|
* @returns {Promise<any>}
|
|
|
* @memberof PageTagRelation
|
|
* @memberof PageTagRelation
|
|
|
*/
|
|
*/
|
|
|
- static removeAllByPage(page) {
|
|
|
|
|
- return this.deleteMany({
|
|
|
|
|
- relatedPage: page
|
|
|
|
|
|
|
+ static removeByTagId(tagId) {
|
|
|
|
|
+ return this.remove({relatedTag: tagId}, function(err, removedData) {
|
|
|
|
|
+ if (err) {
|
|
|
|
|
+ throw new Error('PageTagRelation data is not exists. tag_id:', tagId);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * remove relation by id
|
|
|
|
|
- *
|
|
|
|
|
- * @static
|
|
|
|
|
- * @param {ObjectId} id
|
|
|
|
|
- * @returns {Promise<any>}
|
|
|
|
|
- * @memberof UserGroupRelation
|
|
|
|
|
- */
|
|
|
|
|
- static removeById(id) {
|
|
|
|
|
|
|
+ // /**
|
|
|
|
|
+ // * remove relation by id
|
|
|
|
|
+ // *
|
|
|
|
|
+ // * @static
|
|
|
|
|
+ // * @param {ObjectId} id
|
|
|
|
|
+ // * @returns {Promise<any>}
|
|
|
|
|
+ // * @memberof UserGroupRelation
|
|
|
|
|
+ // */
|
|
|
|
|
+ // static removeById(id) {
|
|
|
|
|
|
|
|
- return this.findById(id)
|
|
|
|
|
- .then((relationData) => {
|
|
|
|
|
- if (relationData == null) {
|
|
|
|
|
- throw new Error('PageTagRelation data is not exists. id:', id);
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- relationData.remove();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // return this.findById(id)
|
|
|
|
|
+ // .then((relationData) => {
|
|
|
|
|
+ // if (relationData == null) {
|
|
|
|
|
+ // throw new Error('PageTagRelation data is not exists. id:', id);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else {
|
|
|
|
|
+ // relationData.remove();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|