feat(conversations): align meta counts

This commit is contained in:
2026-06-07 02:54:41 +08:00
parent 8591fe1d33
commit cdc0978476
7 changed files with 273 additions and 95 deletions
@@ -635,13 +635,25 @@ func (h *ConversationHandler) Meta(c *gin.Context) {
return
}
meta, svcErr := h.conversationSvc.GetMeta(c.Request.Context(), accountID)
var params service.FilterParams
if err := c.ShouldBindQuery(&params); err != nil {
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, err.Error())
return
}
if params.Labels == "" {
labels := append(c.QueryArray("labels"), c.QueryArray("labels[]")...)
if len(labels) > 0 {
params.Labels = strings.Join(labels, ",")
}
}
meta, svcErr := h.conversationSvc.GetMeta(c.Request.Context(), accountID, currentUserID(c), params)
if svcErr != nil {
handleServiceError(c, svcErr)
return
}
response.OK(c, meta)
c.JSON(http.StatusOK, gin.H{"meta": meta})
}
// Unread marks a conversation as unread by resetting agent_last_seen_at.