Added category to StoriesFilter
the build was successful

This commit is contained in:
2018-08-01 14:38:09 +02:00
parent d5df624188
commit 132cf28f0f
3 changed files with 17 additions and 7 deletions
+5 -1
View File
@@ -193,13 +193,17 @@ func FindID(id string) (Story, error) {
}
// List lists stories by any non-zero criteria passed with it.
func List(author 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{}
if author != "" {
query["author"] = author
}
if category != nil {
query["category"] = category
}
if len(tags) > 0 {
query["tags"] = bson.M{"$in": tags}
}