models, graph2: Added comment removal on chapter removal.
the build was successful

This commit is contained in:
2019-01-14 18:01:43 +01:00
parent f9fe0bb5f8
commit 39a4fef506
2 changed files with 23 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
package comments
import (
"git.aiterp.net/rpdata/api/models"
"github.com/globalsign/mgo/bson"
)
// Remove removes one comment.
func Remove(comment models.Comment) error {
return collection.RemoveId(comment.ID)
}
// RemoveChapter removes all comments for the given chapter.
func RemoveChapter(chapter models.Chapter) error {
_, err := collection.RemoveAll(bson.M{"chapterId": chapter.ID})
return err
}