From 3957f81d6bed5fff9a3f5276521d2307e851219c Mon Sep 17 00:00:00 2001 From: Brant DeBow Date: Wed, 2 Apr 2025 09:31:35 -0400 Subject: [PATCH] Updated with changes from PR comments --- .../OrganizationIntegrationConfigurationDetails.cs | 4 ++-- .../IOrganizationIntegrationConfigurationRepository.cs | 2 +- .../OrganizationIntegrationConfigurationRepository.cs | 2 +- .../OrganizationIntegrationConfigurationRepository.cs | 2 +- ...OrganizationIntegrationConfigurationDetailsTests.cs | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetails.cs b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetails.cs index 3829ef5749..139a7aff25 100644 --- a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetails.cs +++ b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetails.cs @@ -36,7 +36,7 @@ public class OrganizationIntegrationConfigurationDetails { try { - var configuration = Configuration ?? "{}"; + var configuration = Configuration ?? string.Empty; return JsonNode.Parse(configuration) as JsonObject ?? new JsonObject(); } catch @@ -52,7 +52,7 @@ public class OrganizationIntegrationConfigurationDetails { try { - var integration = IntegrationConfiguration ?? "{}"; + var integration = IntegrationConfiguration ?? string.Empty; return JsonNode.Parse(integration) as JsonObject ?? new JsonObject(); } catch diff --git a/src/Core/AdminConsole/Repositories/IOrganizationIntegrationConfigurationRepository.cs b/src/Core/AdminConsole/Repositories/IOrganizationIntegrationConfigurationRepository.cs index 3d1cb7b952..516918fff9 100644 --- a/src/Core/AdminConsole/Repositories/IOrganizationIntegrationConfigurationRepository.cs +++ b/src/Core/AdminConsole/Repositories/IOrganizationIntegrationConfigurationRepository.cs @@ -6,7 +6,7 @@ namespace Bit.Core.Repositories; public interface IOrganizationIntegrationConfigurationRepository : IRepository { - Task> GetConfigurationsAsync( + Task> GetConfigurationDetailsAsync( Guid organizationId, IntegrationType integrationType, EventType eventType); diff --git a/src/Infrastructure.Dapper/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs b/src/Infrastructure.Dapper/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs index 1896b8ea3f..f3227dfd22 100644 --- a/src/Infrastructure.Dapper/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs +++ b/src/Infrastructure.Dapper/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs @@ -20,7 +20,7 @@ public class OrganizationIntegrationConfigurationRepository : Repository> GetConfigurationsAsync( + public async Task> GetConfigurationDetailsAsync( Guid organizationId, IntegrationType integrationType, EventType eventType) diff --git a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs index 7c51130570..f051830035 100644 --- a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs +++ b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationIntegrationConfigurationRepository.cs @@ -16,7 +16,7 @@ public class OrganizationIntegrationConfigurationRepository : Repository context.OrganizationIntegrationConfigurations) { } - public async Task> GetConfigurationsAsync( + public async Task> GetConfigurationDetailsAsync( Guid organizationId, IntegrationType integrationType, EventType eventType) diff --git a/test/Core.Test/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetailsTests.cs b/test/Core.Test/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetailsTests.cs index 3c5eec751f..99a11903b4 100644 --- a/test/Core.Test/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetailsTests.cs +++ b/test/Core.Test/AdminConsole/Models/Data/Organizations/OrganizationIntegrationConfigurationDetailsTests.cs @@ -7,7 +7,7 @@ namespace Bit.Core.Test.Models.Data.Organizations; public class OrganizationIntegrationConfigurationDetailsTests { [Fact] - public void MergedConfiguration_BothHaveValues() + public void MergedConfiguration_WithValidConfigAndIntegration_ReturnsMergedJson() { var config = new { config = "A new config value" }; var integration = new { integration = "An integration value" }; @@ -23,7 +23,7 @@ public class OrganizationIntegrationConfigurationDetailsTests } [Fact] - public void MergedConfiguration_BothNotJson() + public void MergedConfiguration_WithInvalidJsonConfigAndIntegration_ReturnsEmptyJson() { var expectedObj = new { }; var expected = JsonSerializer.Serialize(expectedObj); @@ -37,7 +37,7 @@ public class OrganizationIntegrationConfigurationDetailsTests } [Fact] - public void MergedConfiguration_BothNull() + public void MergedConfiguration_WithNullConfigAndIntegration_ReturnsEmptyJson() { var expectedObj = new { }; var expected = JsonSerializer.Serialize(expectedObj); @@ -51,7 +51,7 @@ public class OrganizationIntegrationConfigurationDetailsTests } [Fact] - public void MergedConfiguration_ConfigNull() + public void MergedConfiguration_WithValidIntegrationAndNullConfig_ReturnsIntegrationJson() { var integration = new { integration = "An integration value" }; var expectedObj = new { integration = "An integration value" }; @@ -66,7 +66,7 @@ public class OrganizationIntegrationConfigurationDetailsTests } [Fact] - public void MergedConfiguration_IntegrationNull() + public void MergedConfiguration_WithValidConfigAndNullIntegration_ReturnsConfigJson() { var config = new { config = "A new config value" }; var expectedObj = new { config = "A new config value" };