[notification] /read add types param
This commit is contained in:
parent
272f29403d
commit
97f5b958b3
|
@ -70,6 +70,7 @@ func (h *NotificationAPI) listNotifications(w http.ResponseWriter, req *http.Req
|
|||
|
||||
type SetNotificationsReadRequest struct {
|
||||
Ids []string `json:"ids"`
|
||||
Types []model.NotificationType `json:"types"`
|
||||
}
|
||||
|
||||
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{
|
||||
"query": util.MapStr{
|
||||
"bool": util.MapStr{
|
||||
"should": []util.MapStr{
|
||||
util.MapStr{
|
||||
"bool": 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{
|
||||
"source": fmt.Sprintf("ctx._source['status'] = '%s';ctx._source['updated'] = '%s'", model.NotificationStatusRead, now),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue