|
@ -8,6 +8,7 @@ import ( |
|
|
"git.aiterp.net/rpdata/api/graph2/input" |
|
|
"git.aiterp.net/rpdata/api/graph2/input" |
|
|
"git.aiterp.net/rpdata/api/internal/auth" |
|
|
"git.aiterp.net/rpdata/api/internal/auth" |
|
|
"git.aiterp.net/rpdata/api/models" |
|
|
"git.aiterp.net/rpdata/api/models" |
|
|
|
|
|
"git.aiterp.net/rpdata/api/models/chapters" |
|
|
"git.aiterp.net/rpdata/api/models/stories" |
|
|
"git.aiterp.net/rpdata/api/models/stories" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -121,5 +122,15 @@ func (r *mutationResolver) RemoveStory(ctx context.Context, input input.StoryRem |
|
|
return models.Story{}, errors.New("You are not permitted to remove this story") |
|
|
return models.Story{}, errors.New("You are not permitted to remove this story") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return stories.Remove(story) |
|
|
|
|
|
|
|
|
story, err = stories.Remove(story) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return models.Story{}, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = chapters.RemoveStory(story) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return models.Story{}, errors.New("Failed to remove chapters, but story is removed: " + err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return story, nil |
|
|
} |
|
|
} |