Merge pull request '[notification] /read add types param' (#51) from feature/notification into master
This commit is contained in:
commit
325022cc1e
|
@ -70,6 +70,7 @@ func (h *NotificationAPI) listNotifications(w http.ResponseWriter, req *http.Req
|
||||||
|
|
||||||
type SetNotificationsReadRequest struct {
|
type SetNotificationsReadRequest struct {
|
||||||
Ids []string `json:"ids"`
|
Ids []string `json:"ids"`
|
||||||
|
Types []model.NotificationType `json:"types"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *NotificationAPI) setNotificationsRead(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
func (h *NotificationAPI) setNotificationsRead(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
|
@ -97,6 +98,9 @@ func (h *NotificationAPI) setNotificationsRead(w http.ResponseWriter, req *http.
|
||||||
|
|
||||||
queryDsl := util.MapStr{
|
queryDsl := util.MapStr{
|
||||||
"query": util.MapStr{
|
"query": util.MapStr{
|
||||||
|
"bool": util.MapStr{
|
||||||
|
"should": []util.MapStr{
|
||||||
|
util.MapStr{
|
||||||
"bool": util.MapStr{
|
"bool": util.MapStr{
|
||||||
"must": []util.MapStr{
|
"must": []util.MapStr{
|
||||||
{
|
{
|
||||||
|
@ -114,6 +118,28 @@ func (h *NotificationAPI) setNotificationsRead(w http.ResponseWriter, req *http.
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
util.MapStr{
|
||||||
|
"bool": util.MapStr{
|
||||||
|
"must": []util.MapStr{
|
||||||
|
{
|
||||||
|
"terms": util.MapStr{
|
||||||
|
"notification_type": reqData.Types,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"term": util.MapStr{
|
||||||
|
"status": util.MapStr{
|
||||||
|
"value": model.NotificationStatusNew,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
"script": util.MapStr{
|
"script": util.MapStr{
|
||||||
"source": fmt.Sprintf("ctx._source['status'] = '%s';ctx._source['updated'] = '%s'", model.NotificationStatusRead, now),
|
"source": fmt.Sprintf("ctx._source['status'] = '%s';ctx._source['updated'] = '%s'", model.NotificationStatusRead, now),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue