feat(notification): 新增全部标记已读接口
This commit is contained in:
@@ -77,6 +77,22 @@ func (h *NotificationHandler) Get(c *gin.Context) {
|
||||
response.ToResponse(out)
|
||||
}
|
||||
|
||||
// ReadAll 将当前用户全部通知标记为已读(前端进入通知页时调用)。
|
||||
func (h *NotificationHandler) ReadAll(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
userID, ok := middleware.GetUserID(c.Request.Context())
|
||||
if !ok {
|
||||
response.ToErrorResponse(errcode.Unauthorized)
|
||||
return
|
||||
}
|
||||
out, e := h.svc.ReadAll(c.Request.Context(), userID)
|
||||
if e != nil {
|
||||
response.ToErrorResponse(e)
|
||||
return
|
||||
}
|
||||
response.ToResponse(out)
|
||||
}
|
||||
|
||||
// Read 标记通知已读(uuid 来自路径参数)。
|
||||
func (h *NotificationHandler) Read(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
|
||||
Reference in New Issue
Block a user