feat(attachments): align list pagination

This commit is contained in:
2026-06-06 02:19:10 +08:00
parent 0fb4e6c500
commit 3c30596bad
6 changed files with 97 additions and 9 deletions
+2 -3
View File
@@ -11,7 +11,6 @@ import (
"github.com/gochat/gochat/internal/repository"
"github.com/gochat/gochat/internal/search"
"github.com/gochat/gochat/internal/service"
"github.com/gochat/gochat/pkg/pagination"
"github.com/gochat/gochat/pkg/response"
)
@@ -847,8 +846,8 @@ func (h *ContactHandler) ListAttachments(c *gin.Context) {
return
}
p := pagination.Parse(c)
attachments, total, svcErr := h.svc.ListAttachments(c.Request.Context(), accountID, contactID, p.Offset, p.PerPage)
_, offset := fixedPageOffset(c, chatwootAttachmentResultsPerPage)
attachments, total, svcErr := h.svc.ListAttachments(c.Request.Context(), accountID, contactID, offset, chatwootAttachmentResultsPerPage)
if svcErr != nil {
c.JSON(http.StatusUnprocessableEntity, gin.H{"error": "failed to list contact attachments"})
return