feat(reports): align live grouped errors

This commit is contained in:
2026-06-07 00:53:06 +08:00
parent ea56eb16c2
commit 64d5e2420e
3 changed files with 52 additions and 6 deletions
@@ -64,8 +64,8 @@ func (h *LiveReportHandler) GroupedConversationMetrics(c *gin.Context) {
groupBy := c.Query("group_by")
if groupBy != "team_id" && groupBy != "assignee_id" {
// Reference: Chatwoot returns 422 for invalid group_by
response.AbortWithStatusError(c, http.StatusUnprocessableEntity, response.ErrBadRequest, "invalid group_by, must be team_id or assignee_id")
// Reference: Chatwoot returns 422 with a raw { error } body for invalid group_by.
c.AbortWithStatusJSON(http.StatusUnprocessableEntity, gin.H{"error": "invalid group_by"})
return
}