feat(conversation): expose current team in responses

This commit is contained in:
mlogclub
2026-05-02 11:34:32 +08:00
parent 11998799c9
commit 0e0747bfc4
2 changed files with 8 additions and 0 deletions
@@ -24,6 +24,7 @@ func BuildConversation(item *models.Conversation) response.ConversationResponse
ServiceMode: item.ServiceMode,
Priority: item.Priority,
CurrentAssigneeID: item.CurrentAssigneeID,
CurrentTeamID: item.CurrentTeamID,
LastMessageID: item.LastMessageID,
LastMessageAt: utils.FormatTime(item.LastMessageAt),
LastActiveAt: utils.FormatTime(item.LastActiveAt),
@@ -51,6 +52,11 @@ func BuildConversation(item *models.Conversation) response.ConversationResponse
}
}
}
if item.CurrentTeamID > 0 {
if team := services.AgentTeamService.Get(item.CurrentTeamID); team != nil {
ret.CurrentTeamName = team.Name
}
}
if item.ClosedBy > 0 {
if user := services.UserService.Get(item.ClosedBy); user != nil {
ret.ClosedByName = user.Nickname
@@ -28,6 +28,8 @@ type ConversationResponse struct {
Priority int `json:"priority"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
CurrentAssigneeName string `json:"currentAssigneeName,omitempty"`
CurrentTeamID int64 `json:"currentTeamId"`
CurrentTeamName string `json:"currentTeamName,omitempty"`
LastMessageID int64 `json:"lastMessageId"`
LastMessageAt string `json:"lastMessageAt,omitempty"`
LastActiveAt string `json:"lastActiveAt,omitempty"`