[notification] /read add types param
This commit is contained in:
parent
272f29403d
commit
97f5b958b3
|
@ -69,7 +69,8 @@ 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) {
|
||||||
|
@ -98,20 +99,45 @@ func (h *NotificationAPI) setNotificationsRead(w http.ResponseWriter, req *http.
|
||||||
queryDsl := util.MapStr{
|
queryDsl := util.MapStr{
|
||||||
"query": util.MapStr{
|
"query": util.MapStr{
|
||||||
"bool": util.MapStr{
|
"bool": util.MapStr{
|
||||||
"must": []util.MapStr{
|
"should": []util.MapStr{
|
||||||
{
|
util.MapStr{
|
||||||
"terms": util.MapStr{
|
"bool": util.MapStr{
|
||||||
"_id": reqData.Ids,
|
"must": []util.MapStr{
|
||||||
|
{
|
||||||
|
"terms": util.MapStr{
|
||||||
|
"_id": reqData.Ids,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"term": util.MapStr{
|
||||||
|
"status": util.MapStr{
|
||||||
|
"value": model.NotificationStatusNew,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
util.MapStr{
|
||||||
"term": util.MapStr{
|
"bool": util.MapStr{
|
||||||
"status": util.MapStr{
|
"must": []util.MapStr{
|
||||||
"value": model.NotificationStatusNew,
|
{
|
||||||
|
"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{
|
||||||
|
|
Loading…
Reference in New Issue