feat(crm): persist contact data imports

This commit is contained in:
2026-06-05 03:20:34 +08:00
parent ab2ca840fb
commit 8eed2f1943
10 changed files with 289 additions and 46 deletions
+3 -3
View File
@@ -724,18 +724,18 @@ func (h *ContactHandler) Import(c *gin.Context) {
file, _, fileErr = c.Request.FormFile("file")
}
if fileErr != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "csv file required"})
c.JSON(http.StatusUnprocessableEntity, gin.H{"error": "failed to import contacts"})
return
}
defer file.Close()
result, svcErr := h.svc.ImportCSV(c.Request.Context(), accountID, file)
_, svcErr := h.svc.ImportContacts(c.Request.Context(), accountID, getUserID(c), file)
if svcErr != nil {
c.JSON(http.StatusUnprocessableEntity, gin.H{"error": "failed to import contacts"})
return
}
c.JSON(http.StatusOK, result)
c.Status(http.StatusOK)
}
// ContactableInboxes returns inboxes that a contact can be associated with.