From 8388ee24463b12d4bdd37d2aa022592e5097f927 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Wed, 19 Sep 2018 22:19:39 +0200 Subject: [PATCH] graph2: Added clearFictionalDate option to editChapter mutation input --- graph2/queries/chapter.go | 4 ++++ graph2/schema/types/Chapter.gql | 3 +++ 2 files changed, 7 insertions(+) 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