This commit is contained in:
@@ -35,7 +35,10 @@ func (r *QueryResolver) Stories(ctx context.Context, args *StoriesArg) ([]*types
|
|||||||
author = *filter.Author
|
author = *filter.Author
|
||||||
}
|
}
|
||||||
|
|
||||||
category := filter.Category
|
category := ""
|
||||||
|
if filter != nil && filter.Category != nil {
|
||||||
|
category = *filter.Category
|
||||||
|
}
|
||||||
|
|
||||||
tags := make([]story.Tag, 0, 8)
|
tags := make([]story.Tag, 0, 8)
|
||||||
if filter != nil && filter.Tags != nil {
|
if filter != nil && filter.Tags != nil {
|
||||||
|
|||||||
@@ -193,14 +193,14 @@ func FindID(id string) (Story, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List lists stories by any non-zero criteria passed with it.
|
// List lists stories by any non-zero criteria passed with it.
|
||||||
func List(author string, category *string, tags []Tag, earliest, latest time.Time, unlisted bool, open *bool, limit int) ([]Story, error) {
|
func List(author string, category string, tags []Tag, earliest, latest time.Time, unlisted bool, open *bool, limit int) ([]Story, error) {
|
||||||
query := bson.M{}
|
query := bson.M{}
|
||||||
|
|
||||||
if author != "" {
|
if author != "" {
|
||||||
query["author"] = author
|
query["author"] = author
|
||||||
}
|
}
|
||||||
|
|
||||||
if category != nil {
|
if category != "" {
|
||||||
query["category"] = category
|
query["category"] = category
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,9 @@ func List(author string, category *string, tags []Tag, earliest, latest time.Tim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query["unlisted"] = unlisted
|
if unlisted {
|
||||||
|
query["listed"] = false
|
||||||
|
}
|
||||||
|
|
||||||
if open != nil {
|
if open != nil {
|
||||||
query["open"] = *open
|
query["open"] = *open
|
||||||
|
|||||||
Reference in New Issue
Block a user