|
|
@ -193,14 +193,14 @@ func FindID(id string) (Story, error) { |
|
|
|
} |
|
|
|
|
|
|
|
// 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{} |
|
|
|
|
|
|
|
if author != "" { |
|
|
|
query["author"] = author |
|
|
|
} |
|
|
|
|
|
|
|
if category != nil { |
|
|
|
if 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 { |
|
|
|
query["open"] = *open |
|
|
|