feat(crm): align shared attachment payloads
This commit is contained in:
@@ -764,13 +764,17 @@ func (h *ConversationHandler) ListAttachments(c *gin.Context) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
attachments, _, 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, p.Offset, p.PerPage)
|
||||
if svcErr != nil {
|
||||
handleServiceError(c, svcErr)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"payload": attachments})
|
||||
payload := make([]any, 0, len(attachments))
|
||||
for i := range attachments {
|
||||
payload = append(payload, serializeAttachment(c.Request.Context(), h.conversationSvc.DB(), &attachments[i]))
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"meta": gin.H{"total_count": total}, "payload": payload})
|
||||
}
|
||||
|
||||
// ToggleTyping toggles the typing status for an agent in a conversation.
|
||||
|
||||
Reference in New Issue
Block a user