feat(inboxes): queue template sync jobs

This commit is contained in:
2026-06-05 22:40:35 +08:00
parent af9e1eb711
commit 9db133697e
6 changed files with 168 additions and 43 deletions
+6 -2
View File
@@ -656,13 +656,17 @@ func (h *InboxHandler) SyncTemplates(c *gin.Context) {
return
}
templates, svcErr := h.svc.SyncTemplates(c.Request.Context(), accountID, inboxID)
svcErr := h.svc.SyncTemplates(c.Request.Context(), accountID, inboxID)
if svcErr != nil {
if errors.Is(svcErr, service.ErrInboxTemplateSyncWhatsAppOnly) {
c.JSON(http.StatusUnprocessableEntity, gin.H{"error": service.InboxTemplateSyncWhatsAppOnlyMessage})
return
}
handleServiceError(c, svcErr)
return
}
c.JSON(http.StatusOK, gin.H{"templates": templates})
c.JSON(http.StatusOK, gin.H{"message": service.InboxTemplateSyncInitiatedMessage})
}
// RegisterWebhook registers a webhook URL with the channel provider for an inbox.