Fix watcher list endpoint

This commit is contained in:
Andre Medeiros 2022-05-19 12:43:37 -04:00
parent 8c5422af20
commit af592c446f

View file

@ -240,7 +240,7 @@ type watcherItem struct {
Type string `json:"type"` Type string `json:"type"`
Label string `json:"label"` Label string `json:"label"`
SourceLabel string `json:"source_label"` SourceLabel string `json:"source_label"`
Upvotes *int64 `json:"upvotes,omitempty"` Upvotes int64 `json:"upvotes,omitempty"`
Keyword string `json:"keyword,omitempty"` Keyword string `json:"keyword,omitempty"`
Flair string `json:"flair,omitempty"` Flair string `json:"flair,omitempty"`
Domain string `json:"domain,omitempty"` Domain string `json:"domain,omitempty"`
@ -274,10 +274,7 @@ func (a *api) listWatchersHandler(w http.ResponseWriter, r *http.Request) {
Domain: watcher.Domain, Domain: watcher.Domain,
Hits: watcher.Hits, Hits: watcher.Hits,
Author: watcher.Author, Author: watcher.Author,
} Upvotes: watcher.Upvotes,
if watcher.Upvotes != 0 {
wi.Upvotes = &watcher.Upvotes
} }
wis[i] = wi wis[i] = wi