diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs index 5c3a276e..e18e21ef 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs @@ -2,7 +2,10 @@ namespace BotSharp.Abstraction.Agents.Models; public class AgentRule { - public string Name { get; set; } + [JsonPropertyName("trigger_name")] + public string TriggerName { get; set; } + + [JsonPropertyName("disabled")] public bool Disabled { get; set; } [JsonPropertyName("event_name")] @@ -10,4 +13,7 @@ public class AgentRule [JsonPropertyName("entity_type")] public string EntityType { get; set; } + + [JsonPropertyName("criteria")] + public string Criteria { get; set; } } diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs index 6efb7104..c8e1e889 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/AgentController.cs @@ -170,6 +170,6 @@ public class AgentController : ControllerBase { hook.AddRules(rules); } - return rules.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderBy(x => x.Name).ToList(); + return rules.Where(x => !string.IsNullOrWhiteSpace(x.TriggerName)).OrderBy(x => x.TriggerName).ToList(); } } \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentRuleMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentRuleMongoElement.cs index 1b346768..a8888749 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentRuleMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentRuleMongoElement.cs @@ -4,19 +4,21 @@ namespace BotSharp.Plugin.MongoStorage.Models; public class AgentRuleMongoElement { - public string Name { get; set; } + public string TriggerName { get; set; } public bool Disabled { get; set; } public string EventName { get; set; } public string EntityType { get; set; } + public string Criteria { get; set; } public static AgentRuleMongoElement ToMongoElement(AgentRule rule) { return new AgentRuleMongoElement { - Name = rule.Name, + TriggerName = rule.TriggerName, Disabled = rule.Disabled, EventName = rule.EventName, - EntityType = rule.EntityType + EntityType = rule.EntityType, + Criteria = rule.Criteria }; } @@ -24,10 +26,11 @@ public class AgentRuleMongoElement { return new AgentRule { - Name = rule.Name, + TriggerName = rule.TriggerName, Disabled = rule.Disabled, EventName = rule.EventName, - EntityType = rule.EntityType + EntityType = rule.EntityType, + Criteria = rule.Criteria }; } }