feat(crm): align shared attachment payloads

This commit is contained in:
2026-06-05 23:17:05 +08:00
parent ad5d864944
commit f8263a3402
10 changed files with 209 additions and 30 deletions
@@ -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.