feat(reports): align conversation agent metrics
This commit is contained in:
@@ -416,11 +416,17 @@ func (h *AnalyticsHandler) Conversations(c *gin.Context) {
|
||||
reportType := c.Query("type")
|
||||
if reportType == "" {
|
||||
// Reference: Chatwoot returns head :unprocessable_entity if type is blank
|
||||
response.AbortWithStatusError(c, http.StatusUnprocessableEntity, response.ErrBadRequest, "type parameter is required")
|
||||
c.Status(http.StatusUnprocessableEntity)
|
||||
return
|
||||
}
|
||||
page := 1
|
||||
if rawPage := c.Query("page"); rawPage != "" {
|
||||
if parsed, err := strconv.Atoi(rawPage); err == nil && parsed > 0 {
|
||||
page = parsed
|
||||
}
|
||||
}
|
||||
|
||||
result, err := h.svc.GetConversationsByType(c.Request.Context(), accountID, reportType, time.Time{}, time.Time{})
|
||||
result, err := h.svc.GetConversationsByType(c.Request.Context(), accountID, reportType, page)
|
||||
if err != nil {
|
||||
applogger.L().Errorf("Conversations report: %v", err)
|
||||
response.AbortWithStatusError(c, http.StatusInternalServerError, response.ErrInternal, "failed to generate conversations report")
|
||||
|
||||
Reference in New Issue
Block a user