diff --git a/graph2/queries/chapter.go b/graph2/queries/chapter.go index 3a36390..188349e 100644 --- a/graph2/queries/chapter.go +++ b/graph2/queries/chapter.go @@ -55,6 +55,10 @@ func (r *mutationResolver) EditChapter(ctx context.Context, input input.ChapterE return models.Chapter{}, errors.New("Unauthorized") } + if input.ClearFictionalDate != nil && *input.ClearFictionalDate == true { + input.FictionalDate = &time.Time{} + } + return chapters.Edit(chapter, input.Title, input.Source, input.FictionalDate) } diff --git a/graph2/schema/types/Chapter.gql b/graph2/schema/types/Chapter.gql index 99755aa..50eaa27 100644 --- a/graph2/schema/types/Chapter.gql +++ b/graph2/schema/types/Chapter.gql @@ -56,6 +56,9 @@ input ChapterEditInput { # Set the fictional date for a chapter fictionalDate: Date + + # Remove the fictional date for a chapter + clearFictionalDate: Boolean } # Input for removeChapter mutation