feat(attachments): align list pagination
This commit is contained in:
@@ -24,6 +24,8 @@ type ConversationHandler struct {
|
||||
auditSvc *service.AuditService
|
||||
}
|
||||
|
||||
const chatwootAttachmentResultsPerPage = 100
|
||||
|
||||
// NewConversationHandler creates a new ConversationHandler.
|
||||
func NewConversationHandler(conversationSvc *service.ConversationService, messageSvc *service.MessageService) *ConversationHandler {
|
||||
return &ConversationHandler{conversationSvc: conversationSvc, messageSvc: messageSvc}
|
||||
@@ -763,12 +765,12 @@ func (h *ConversationHandler) ListAttachments(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
p := pagination.Parse(c)
|
||||
_, offset := fixedPageOffset(c, chatwootAttachmentResultsPerPage)
|
||||
conversation, ok := h.resolveConversationRoute(c, accountID, conversationID)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
attachments, total, svcErr := h.messageSvc.ListAttachments(c.Request.Context(), accountID, conversation.ID, p.Offset, p.PerPage)
|
||||
attachments, total, svcErr := h.messageSvc.ListAttachments(c.Request.Context(), accountID, conversation.ID, offset, chatwootAttachmentResultsPerPage)
|
||||
if svcErr != nil {
|
||||
handleServiceError(c, svcErr)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user