From 15ce459971aa89068f9cd4ba18f69d6bb18012ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E7=A3=8A?= Date: Tue, 22 Oct 2024 09:05:56 +0800 Subject: [PATCH] Add a CallingPhone column to the ConversationDocument --- .../BotSharp.Abstraction/Conversations/Models/Conversation.cs | 2 ++ .../BotSharp.Core/Conversations/Services/ConversationService.cs | 2 ++ .../Collections/ConversationDocument.cs | 1 + .../Repository/MongoRepository.Conversation.cs | 1 + 4 files changed, 6 insertions(+) diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs index 38734d75..c2be970f 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs @@ -28,6 +28,8 @@ public class Conversation public List Tags { get; set; } = new(); + public string CallingPhone { get; set; } + public DateTime UpdatedTime { get; set; } = DateTime.UtcNow; public DateTime CreatedTime { get; set; } = DateTime.UtcNow; } diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs index 97b69d44..a9c56fa9 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs @@ -172,10 +172,12 @@ public partial class ConversationService : IConversationService { var state = _services.GetRequiredService(); var channel = state.GetState("channel"); + var callingPhone = state.GetState("calling_phone"); var sess = new Conversation { Id = _conversationId, Channel = channel, + CallingPhone = callingPhone, AgentId = agentId }; converation = await NewConversation(sess); diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDocument.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDocument.cs index 609d637d..b23f26a4 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDocument.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDocument.cs @@ -10,6 +10,7 @@ public class ConversationDocument : MongoBase public string Status { get; set; } public int DialogCount { get; set; } public List Tags { get; set; } + public string CallingPhone { get; set; } public DateTime CreatedTime { get; set; } public DateTime UpdatedTime { get; set; } } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs index ff7cefcd..f0104788 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs @@ -17,6 +17,7 @@ public partial class MongoRepository UserId = !string.IsNullOrEmpty(conversation.UserId) ? conversation.UserId : string.Empty, Title = conversation.Title, Channel = conversation.Channel, + CallingPhone = conversation.CallingPhone, TaskId = conversation.TaskId, Status = conversation.Status, Tags = conversation.Tags ?? new(),