GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
518 B

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 models.Chapter{}, 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
}