feat(reports): align v2 report envelopes
This commit is contained in:
@@ -46,7 +46,7 @@ func (h *SummaryReportHandler) Agent(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, result)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// Team returns team-level summary metrics.
|
||||
@@ -68,7 +68,7 @@ func (h *SummaryReportHandler) Team(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, result)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// Inbox returns inbox-level summary metrics.
|
||||
@@ -90,7 +90,7 @@ func (h *SummaryReportHandler) Inbox(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, result)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// Label returns label-level summary metrics.
|
||||
@@ -112,7 +112,7 @@ func (h *SummaryReportHandler) Label(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, result)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// Channel returns channel-level summary metrics.
|
||||
@@ -144,7 +144,7 @@ func (h *SummaryReportHandler) Channel(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response.OK(c, result)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// parseSummaryDateRange extracts since/until from query params for summary reports.
|
||||
@@ -157,15 +157,15 @@ func parseSummaryDateRange(c *gin.Context) (since, until time.Time, ok bool) {
|
||||
return time.Time{}, time.Time{}, false
|
||||
}
|
||||
|
||||
since, err := time.Parse(time.RFC3339, sinceStr)
|
||||
since, err := parseChatwootReportTime(sinceStr)
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid since date format (use RFC3339)")
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid since date format")
|
||||
return time.Time{}, time.Time{}, false
|
||||
}
|
||||
|
||||
until, err = time.Parse(time.RFC3339, untilStr)
|
||||
until, err = parseChatwootReportTime(untilStr)
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid until date format (use RFC3339)")
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid until date format")
|
||||
return time.Time{}, time.Time{}, false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user