chore: stabilize chatwoot parity baseline

This commit is contained in:
2026-06-04 18:12:50 +08:00
parent 8ac150bc7b
commit 42cdab880c
39 changed files with 1028 additions and 696 deletions
@@ -2,6 +2,7 @@ package v1
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
@@ -26,6 +27,11 @@ func NewIntegrationHookHandler(svc *service.IntegrationHookService) *Integration
// ListApps retrieves all available integration apps.
// GET /api/v1/accounts/:account_id/integrations/apps
func (h *IntegrationHookHandler) ListApps(c *gin.Context) {
if !h.svc.Ready() {
response.AbortWithStatusError(c, http.StatusUnprocessableEntity, response.ErrInternal, "failed to list integration apps")
return
}
apps, err := h.svc.ListApps(c.Request.Context())
if err != nil {
handleServiceError(c, err)
@@ -174,7 +180,11 @@ func (h *IntegrationHookHandler) ProcessHookEvent(c *gin.Context) {
}
if svcErr := h.svc.ProcessEvent(c.Request.Context(), id, eventData); svcErr != nil {
handleServiceError(c, svcErr)
if strings.Contains(strings.ToLower(svcErr.Error()), "not found") {
response.AbortWithStatusError(c, http.StatusNotFound, response.ErrNotFound, svcErr.Error())
return
}
response.AbortWithStatusError(c, http.StatusUnprocessableEntity, response.ErrInternal, svcErr.Error())
return
}
response.OK(c, gin.H{"message": "event processed"})