feat(conversations): align custom attribute response
This commit is contained in:
@@ -744,7 +744,7 @@ func (h *ConversationHandler) UpdateCustomAttributes(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, serializeConversation(c.Request.Context(), h.conversationSvc.DB(), conversation))
|
||||
c.JSON(http.StatusOK, gin.H{"custom_attributes": conversation.CustomAttributes})
|
||||
}
|
||||
|
||||
// ListAttachments returns paginated message attachments for a conversation.
|
||||
|
||||
@@ -327,13 +327,16 @@ func (s *ConversationHandlerTestSuite) TestUpdateCustomAttributes_Success() {
|
||||
assert.Equal(s.T(), http.StatusOK, w.Code)
|
||||
|
||||
var resp struct {
|
||||
ID uint `json:"id"`
|
||||
CustomAttributes map[string]interface{} `json:"custom_attributes"`
|
||||
}
|
||||
err := json.Unmarshal(w.Body.Bytes(), &resp)
|
||||
assert.NoError(s.T(), err)
|
||||
assert.Equal(s.T(), s.testConv.ID, resp.ID)
|
||||
assert.Equal(s.T(), "vip_customer", resp.CustomAttributes["priority_reason"])
|
||||
var rawResp map[string]interface{}
|
||||
err = json.Unmarshal(w.Body.Bytes(), &rawResp)
|
||||
assert.NoError(s.T(), err)
|
||||
assert.NotContains(s.T(), rawResp, "id")
|
||||
assert.NotContains(s.T(), rawResp, "success")
|
||||
}
|
||||
|
||||
func (s *ConversationHandlerTestSuite) TestUpdateCustomAttributes_InvalidAccountID() {
|
||||
|
||||
Reference in New Issue
Block a user