mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-29 07:07:42 +00:00
allow editing watchers too
This commit is contained in:
parent
db3268b0d0
commit
08fd2ef9a5
1 changed files with 6 additions and 9 deletions
|
@ -163,12 +163,7 @@ func (a *api) editWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ewr := &createWatcherRequest{
|
ewr := &createWatcherRequest{
|
||||||
Criteria: watcherCriteria{
|
Criteria: watcherCriteria{},
|
||||||
Upvotes: 0,
|
|
||||||
Keyword: "",
|
|
||||||
Flair: "",
|
|
||||||
Domain: "",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(ewr); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(ewr); err != nil {
|
||||||
|
@ -177,10 +172,12 @@ func (a *api) editWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
watcher.Label = ewr.Label
|
watcher.Label = ewr.Label
|
||||||
|
watcher.Author = strings.ToLower(ewr.Criteria.Author)
|
||||||
|
watcher.Subreddit = strings.ToLower(ewr.Criteria.Subreddit)
|
||||||
watcher.Upvotes = ewr.Criteria.Upvotes
|
watcher.Upvotes = ewr.Criteria.Upvotes
|
||||||
watcher.Keyword = ewr.Criteria.Keyword
|
watcher.Keyword = strings.ToLower(ewr.Criteria.Keyword)
|
||||||
watcher.Flair = ewr.Criteria.Flair
|
watcher.Flair = strings.ToLower(ewr.Criteria.Flair)
|
||||||
watcher.Domain = ewr.Criteria.Domain
|
watcher.Domain = strings.ToLower(ewr.Criteria.Domain)
|
||||||
|
|
||||||
if err := a.watcherRepo.Update(ctx, &watcher); err != nil {
|
if err := a.watcherRepo.Update(ctx, &watcher); err != nil {
|
||||||
a.errorResponse(w, r, 500, err.Error())
|
a.errorResponse(w, r, 500, err.Error())
|
||||||
|
|
Loading…
Reference in a new issue