mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-26 05:37:42 +00:00
catch the subreddit criteria
This commit is contained in:
parent
0674ddf730
commit
db3268b0d0
1 changed files with 8 additions and 11 deletions
|
@ -13,6 +13,7 @@ import (
|
||||||
|
|
||||||
type watcherCriteria struct {
|
type watcherCriteria struct {
|
||||||
Author string
|
Author string
|
||||||
|
Subreddit string
|
||||||
Upvotes int64
|
Upvotes int64
|
||||||
Keyword string
|
Keyword string
|
||||||
Flair string
|
Flair string
|
||||||
|
@ -35,12 +36,7 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
redditID := vars["redditID"]
|
redditID := vars["redditID"]
|
||||||
|
|
||||||
cwr := &createWatcherRequest{
|
cwr := &createWatcherRequest{
|
||||||
Criteria: watcherCriteria{
|
Criteria: watcherCriteria{},
|
||||||
Upvotes: 0,
|
|
||||||
Keyword: "",
|
|
||||||
Flair: "",
|
|
||||||
Domain: "",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
if err := json.NewDecoder(r.Body).Decode(cwr); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(cwr); err != nil {
|
||||||
a.errorResponse(w, r, 500, err.Error())
|
a.errorResponse(w, r, 500, err.Error())
|
||||||
|
@ -80,6 +76,7 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
DeviceID: dev.ID,
|
DeviceID: dev.ID,
|
||||||
AccountID: account.ID,
|
AccountID: account.ID,
|
||||||
Author: strings.ToLower(cwr.Criteria.Author),
|
Author: strings.ToLower(cwr.Criteria.Author),
|
||||||
|
Subreddit: strings.ToLower(cwr.Criteria.Subreddit),
|
||||||
Upvotes: cwr.Criteria.Upvotes,
|
Upvotes: cwr.Criteria.Upvotes,
|
||||||
Keyword: strings.ToLower(cwr.Criteria.Keyword),
|
Keyword: strings.ToLower(cwr.Criteria.Keyword),
|
||||||
Flair: strings.ToLower(cwr.Criteria.Flair),
|
Flair: strings.ToLower(cwr.Criteria.Flair),
|
||||||
|
|
Loading…
Reference in a new issue