feat(crm): persist contact data imports
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user