|
@ -48,7 +48,12 @@ func (r *mutationResolver) AddChapter(ctx context.Context, input input.ChapterAd |
|
|
return models.Chapter{}, errors.New("Story is not open") |
|
|
return models.Chapter{}, errors.New("Story is not open") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
chapter, err := chapters.Add(story, input.Title, author, input.Source, time.Now(), input.FictionalDate) |
|
|
|
|
|
|
|
|
commentMode := models.ChapterCommentModeDisabled |
|
|
|
|
|
if input.CommentMode != nil { |
|
|
|
|
|
commentMode = *input.CommentMode |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
chapter, err := chapters.Add(story, input.Title, author, input.Source, time.Now(), input.FictionalDate, commentMode) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return models.Chapter{}, errors.New("Failed to create chapter: " + err.Error()) |
|
|
return models.Chapter{}, errors.New("Failed to create chapter: " + err.Error()) |
|
|
} |
|
|
} |
|
@ -117,7 +122,7 @@ func (r *mutationResolver) EditChapter(ctx context.Context, input input.ChapterE |
|
|
input.FictionalDate = &time.Time{} |
|
|
input.FictionalDate = &time.Time{} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
chapter, err = chapters.Edit(chapter, input.Title, input.Source, input.FictionalDate) |
|
|
|
|
|
|
|
|
chapter, err = chapters.Edit(chapter, input.Title, input.Source, input.FictionalDate, input.CommentMode, input.CommentsLocked) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return models.Chapter{}, errors.New("Failed to edit chapter: " + err.Error()) |
|
|
return models.Chapter{}, errors.New("Failed to edit chapter: " + err.Error()) |
|
|
} |
|
|
} |
|
|