feat(agents): align serializer fields
This commit is contained in:
@@ -244,14 +244,7 @@ func serializeAgentDetail(agent *repository.AgentDetail, accountID uint) map[str
|
||||
if agent == nil {
|
||||
return map[string]any{}
|
||||
}
|
||||
payload := serializeAgentUser(&agent.User, accountID, agent.Role, agent.Availability, agent.AutoOffline, agent.CustomRoleID)
|
||||
if agent.InvitedBy != 0 {
|
||||
payload["invited_by"] = agent.InvitedBy
|
||||
}
|
||||
if agent.AccountUserID != 0 {
|
||||
payload["account_user_id"] = agent.AccountUserID
|
||||
}
|
||||
return payload
|
||||
return serializeAgentUser(&agent.User, accountID, agent.Role, agent.Availability, agent.AutoOffline, agent.CustomRoleID)
|
||||
}
|
||||
|
||||
func serializeAgentUser(user *model.User, accountID uint, role string, availability string, autoOffline bool, customRoleID uint) map[string]any {
|
||||
|
||||
@@ -179,6 +179,8 @@ func (s *AgentHandlerTestSuite) TestCreateAgent() {
|
||||
assert.Equal(s.T(), "offline", data["availability_status"])
|
||||
assert.Equal(s.T(), float64(7), data["custom_role_id"])
|
||||
assert.Contains(s.T(), data, "confirmed")
|
||||
assert.NotContains(s.T(), data, "invited_by")
|
||||
assert.NotContains(s.T(), data, "account_user_id")
|
||||
}
|
||||
|
||||
func (s *AgentHandlerTestSuite) TestCreateAgentDefaultsBlankNameFromEmail() {
|
||||
|
||||
Reference in New Issue
Block a user