Files
api/models/chapters/remove.go
T
gisle a5410dff2c
the build was successful
Eugh.
2019-05-16 15:57:22 +02:00

25 lines
506 B
Go

package chapters
import (
"git.aiterp.net/rpdata/api/models"
"github.com/globalsign/mgo/bson"
)
// Remove removes a chapter.
func Remove(chapter models.Chapter) (*models.Chapter, error) {
if err := collection.RemoveId(chapter.ID); err != nil {
return nil, err
}
return chapter, nil
}
// RemoveStory removes all chapters belonging to a story
func RemoveStory(story models.Story) error {
if _, err := collection.RemoveAll(bson.M{"storyId": story.ID}); err != nil {
return err
}
return nil
}