diff --git a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationFilter.cs index e5eed361..9ba98c5d 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationFilter.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationFilter.cs @@ -12,6 +12,7 @@ public class ConversationFilter public string? AgentId { get; set; } public string? Status { get; set; } public string? Channel { get; set; } + public string? ChannelId { get; set; } public string? UserId { get; set; } public DateTime? StartTime { get; set; } diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs index b8ff420e..3b60a61a 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs @@ -430,6 +430,10 @@ public partial class FileRepository { matched = matched && record.Channel == filter.Channel; } + if(filter?.ChannelId != null) + { + matched = matched && record.ChannelId == filter.ChannelId; + } if (filter?.UserId != null) { matched = matched && record.UserId == filter.UserId; diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs index f0e89473..722c7730 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Conversation.cs @@ -371,6 +371,10 @@ public partial class MongoRepository { convFilters.Add(convBuilder.Eq(x => x.Channel, filter.Channel)); } + if (!string.IsNullOrEmpty(filter?.ChannelId)) + { + convFilters.Add(convBuilder.Eq(x => x.ChannelId, filter.ChannelId)); + } if (!string.IsNullOrEmpty(filter?.UserId)) { convFilters.Add(convBuilder.Eq(x => x.UserId, filter.UserId));