add sortByFictionalDate field to Story, and sorting by fictional date if set.
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-28 22:45:13 +02:00
parent c4eabd69ac
commit 63bc262091
5 changed files with 79 additions and 36 deletions
+4 -2
View File
@@ -36,7 +36,9 @@ func (r *mutationResolver) AddStory(ctx context.Context, input graphcore.StoryAd
fictionalDate = *input.FictionalDate
}
return r.s.Stories.CreateStory(ctx, input.Name, input.Author, input.Category, listed, open, tags, time.Now(), fictionalDate)
sortByFictionalDate := input.SortByFictionalDate != nil && *input.SortByFictionalDate
return r.s.Stories.CreateStory(ctx, input.Name, input.Author, input.Category, listed, open, tags, time.Now(), fictionalDate, sortByFictionalDate)
}
func (r *mutationResolver) AddStoryTag(ctx context.Context, input graphcore.StoryTagAddInput) (*models.Story, error) {
@@ -63,7 +65,7 @@ func (r *mutationResolver) EditStory(ctx context.Context, input graphcore.StoryE
return nil, err
}
return r.s.Stories.EditStory(ctx, story, input.Name, input.Category, input.Listed, input.Open, input.FictionalDate)
return r.s.Stories.EditStory(ctx, story, input.Name, input.Category, input.Listed, input.Open, input.FictionalDate, input.SortByFictionalDate)
}
func (r *mutationResolver) RemoveStory(ctx context.Context, input graphcore.StoryRemoveInput) (*models.Story, error) {
+9
View File
@@ -33,6 +33,9 @@ type Story {
# The date of the last major update to the story. This being bumped means a new chapter has been added.
updatedDate: Time!
# Whether to sort by fictional date.
sortByFictionalDate: Boolean!
}
# Filter for stories query.
@@ -86,6 +89,9 @@ input StoryAddInput {
# Set the fictional date of the story.
fictionalDate: Time
# Whether to sort by fictional date.
sortByFictionalDate: Boolean
}
# Input for the editStory mutation
@@ -115,6 +121,9 @@ input StoryEditInput {
# Clear the fictional date of the story.
clearFictionalDate: Boolean
# Whether to sort by fictional date.
sortByFictionalDate: Boolean
}
# Input for the addStoryTag mutation