From 2ee75d619ca71029b582c6a1cccc2a321d2bac86 Mon Sep 17 00:00:00 2001 From: Conner Turnbull Date: Tue, 10 Jun 2025 12:18:04 -0400 Subject: [PATCH] Moved cqrs stuff to billing --- src/Admin/Controllers/ToolsController.cs | 2 +- src/Api/Billing/Controllers/OrganizationsController.cs | 2 +- src/Api/Controllers/LicensesController.cs | 2 +- .../SelfHosted/SelfHostedOrganizationLicensesController.cs | 3 ++- .../Licenses/Commands}/IUpdateOrganizationLicenseCommand.cs | 2 +- .../Implementations}/UpdateOrganizationLicenseCommand.cs | 3 +-- .../Licenses/Queries}/IGetOrganizationLicenseQuery.cs | 2 +- .../Implementations}/CloudGetOrganizationLicenseQuery.cs | 3 +-- .../SelfHostedGetOrganizationLicenseQuery.cs | 3 +-- .../OrganizationServiceCollectionExtensions.cs | 6 ++++-- .../Billing/Controllers/OrganizationsControllerTests.cs | 2 +- .../CloudGetOrganizationLicenseQueryTests.cs | 2 +- .../SelfHostedGetOrganizationLicenseQueryTests.cs | 2 +- .../UpdateOrganizationLicenseCommandTests.cs | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) rename src/Core/{OrganizationFeatures/OrganizationLicenses/Interfaces => Billing/Licenses/Commands}/IUpdateOrganizationLicenseCommand.cs (83%) rename src/Core/{OrganizationFeatures/OrganizationLicenses => Billing/Licenses/Commands/Implementations}/UpdateOrganizationLicenseCommand.cs (95%) rename src/Core/{OrganizationFeatures/OrganizationLicenses/Interfaces => Billing/Licenses/Queries}/IGetOrganizationLicenseQuery.cs (86%) rename src/Core/{OrganizationFeatures/OrganizationLicenses/Cloud => Billing/Licenses/Queries/Implementations}/CloudGetOrganizationLicenseQuery.cs (97%) rename src/Core/{OrganizationFeatures/OrganizationLicenses/SelfHosted => Billing/Licenses/Queries/Implementations}/SelfHostedGetOrganizationLicenseQuery.cs (95%) diff --git a/src/Admin/Controllers/ToolsController.cs b/src/Admin/Controllers/ToolsController.cs index eaf3de4be5..2db0de121b 100644 --- a/src/Admin/Controllers/ToolsController.cs +++ b/src/Admin/Controllers/ToolsController.cs @@ -5,9 +5,9 @@ using Bit.Admin.Models; using Bit.Admin.Utilities; using Bit.Core.AdminConsole.Entities; using Bit.Core.AdminConsole.Repositories; +using Bit.Core.Billing.Licenses.Queries; using Bit.Core.Entities; using Bit.Core.Models.BitStripe; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Platform.Installations; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/src/Api/Billing/Controllers/OrganizationsController.cs b/src/Api/Billing/Controllers/OrganizationsController.cs index 13b13a144a..ea6d4c0c70 100644 --- a/src/Api/Billing/Controllers/OrganizationsController.cs +++ b/src/Api/Billing/Controllers/OrganizationsController.cs @@ -8,6 +8,7 @@ using Bit.Core.AdminConsole.Entities; using Bit.Core.Billing.Constants; using Bit.Core.Billing.Entities; using Bit.Core.Billing.Licenses.Models; +using Bit.Core.Billing.Licenses.Queries; using Bit.Core.Billing.Models; using Bit.Core.Billing.Pricing; using Bit.Core.Billing.Repositories; @@ -16,7 +17,6 @@ using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.OrganizationFeatures.OrganizationSubscriptions.Interface; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/src/Api/Controllers/LicensesController.cs b/src/Api/Controllers/LicensesController.cs index 49f82e13a7..f4f8c082f7 100644 --- a/src/Api/Controllers/LicensesController.cs +++ b/src/Api/Controllers/LicensesController.cs @@ -1,9 +1,9 @@ using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationConnections.Interfaces; using Bit.Core.Billing.Licenses.Models; +using Bit.Core.Billing.Licenses.Queries; using Bit.Core.Context; using Bit.Core.Exceptions; using Bit.Core.Models.Api.OrganizationLicenses; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/src/Api/Controllers/SelfHosted/SelfHostedOrganizationLicensesController.cs b/src/Api/Controllers/SelfHosted/SelfHostedOrganizationLicensesController.cs index 9979be5272..960b01eaf3 100644 --- a/src/Api/Controllers/SelfHosted/SelfHostedOrganizationLicensesController.cs +++ b/src/Api/Controllers/SelfHosted/SelfHostedOrganizationLicensesController.cs @@ -2,12 +2,13 @@ using Bit.Api.Models.Request; using Bit.Api.Models.Request.Organizations; using Bit.Api.Utilities; +using Bit.Core.Billing.Licenses.Commands; using Bit.Core.Billing.Licenses.Models; +using Bit.Core.Billing.Licenses.Queries; using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.OrganizationConnectionConfigs; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IUpdateOrganizationLicenseCommand.cs b/src/Core/Billing/Licenses/Commands/IUpdateOrganizationLicenseCommand.cs similarity index 83% rename from src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IUpdateOrganizationLicenseCommand.cs rename to src/Core/Billing/Licenses/Commands/IUpdateOrganizationLicenseCommand.cs index 5d525c5e58..905d5bf87d 100644 --- a/src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IUpdateOrganizationLicenseCommand.cs +++ b/src/Core/Billing/Licenses/Commands/IUpdateOrganizationLicenseCommand.cs @@ -4,7 +4,7 @@ using Bit.Core.AdminConsole.Entities; using Bit.Core.Billing.Licenses.Models; using Bit.Core.Models.Data.Organizations; -namespace Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; +namespace Bit.Core.Billing.Licenses.Commands; public interface IUpdateOrganizationLicenseCommand { diff --git a/src/Core/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommand.cs b/src/Core/Billing/Licenses/Commands/Implementations/UpdateOrganizationLicenseCommand.cs similarity index 95% rename from src/Core/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommand.cs rename to src/Core/Billing/Licenses/Commands/Implementations/UpdateOrganizationLicenseCommand.cs index 1e5faa927d..2d894db983 100644 --- a/src/Core/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommand.cs +++ b/src/Core/Billing/Licenses/Commands/Implementations/UpdateOrganizationLicenseCommand.cs @@ -7,12 +7,11 @@ using Bit.Core.Billing.Licenses.Models; using Bit.Core.Billing.Services; using Bit.Core.Exceptions; using Bit.Core.Models.Data.Organizations; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; -namespace Bit.Core.OrganizationFeatures.OrganizationLicenses; +namespace Bit.Core.Billing.Licenses.Commands.Implementations; public class UpdateOrganizationLicenseCommand : IUpdateOrganizationLicenseCommand { diff --git a/src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IGetOrganizationLicenseQuery.cs b/src/Core/Billing/Licenses/Queries/IGetOrganizationLicenseQuery.cs similarity index 86% rename from src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IGetOrganizationLicenseQuery.cs rename to src/Core/Billing/Licenses/Queries/IGetOrganizationLicenseQuery.cs index 9a76c26ce8..bf14877c9b 100644 --- a/src/Core/OrganizationFeatures/OrganizationLicenses/Interfaces/IGetOrganizationLicenseQuery.cs +++ b/src/Core/Billing/Licenses/Queries/IGetOrganizationLicenseQuery.cs @@ -2,7 +2,7 @@ using Bit.Core.Billing.Licenses.Models; using Bit.Core.Entities; -namespace Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; +namespace Bit.Core.Billing.Licenses.Queries; public interface ICloudGetOrganizationLicenseQuery { diff --git a/src/Core/OrganizationFeatures/OrganizationLicenses/Cloud/CloudGetOrganizationLicenseQuery.cs b/src/Core/Billing/Licenses/Queries/Implementations/CloudGetOrganizationLicenseQuery.cs similarity index 97% rename from src/Core/OrganizationFeatures/OrganizationLicenses/Cloud/CloudGetOrganizationLicenseQuery.cs rename to src/Core/Billing/Licenses/Queries/Implementations/CloudGetOrganizationLicenseQuery.cs index 830b073301..fa687e9775 100644 --- a/src/Core/OrganizationFeatures/OrganizationLicenses/Cloud/CloudGetOrganizationLicenseQuery.cs +++ b/src/Core/Billing/Licenses/Queries/Implementations/CloudGetOrganizationLicenseQuery.cs @@ -7,11 +7,10 @@ using Bit.Core.Billing.Services; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Platform.Installations; using Bit.Core.Services; -namespace Bit.Core.OrganizationFeatures.OrganizationLicenses; +namespace Bit.Core.Billing.Licenses.Queries.Implementations; public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuery { diff --git a/src/Core/OrganizationFeatures/OrganizationLicenses/SelfHosted/SelfHostedGetOrganizationLicenseQuery.cs b/src/Core/Billing/Licenses/Queries/Implementations/SelfHostedGetOrganizationLicenseQuery.cs similarity index 95% rename from src/Core/OrganizationFeatures/OrganizationLicenses/SelfHosted/SelfHostedGetOrganizationLicenseQuery.cs rename to src/Core/Billing/Licenses/Queries/Implementations/SelfHostedGetOrganizationLicenseQuery.cs index ef1a08ccdf..efd99aa1aa 100644 --- a/src/Core/OrganizationFeatures/OrganizationLicenses/SelfHosted/SelfHostedGetOrganizationLicenseQuery.cs +++ b/src/Core/Billing/Licenses/Queries/Implementations/SelfHostedGetOrganizationLicenseQuery.cs @@ -5,12 +5,11 @@ using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Models.Api.OrganizationLicenses; using Bit.Core.Models.OrganizationConnectionConfigs; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Services; using Bit.Core.Settings; using Microsoft.Extensions.Logging; -namespace Bit.Core.OrganizationFeatures.OrganizationLicenses; +namespace Bit.Core.Billing.Licenses.Queries.Implementations; public class SelfHostedGetOrganizationLicenseQuery : BaseIdentityClientService, ISelfHostedGetOrganizationLicenseQuery { diff --git a/src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs b/src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs index 2bc05017d5..f87c65bee5 100644 --- a/src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs +++ b/src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs @@ -19,11 +19,13 @@ using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.V using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.Organization; using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.PasswordManager; using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.RestoreUser.v1; +using Bit.Core.Billing.Licenses.Commands; +using Bit.Core.Billing.Licenses.Commands.Implementations; +using Bit.Core.Billing.Licenses.Queries; +using Bit.Core.Billing.Licenses.Queries.Implementations; using Bit.Core.Models.Business.Tokenables; using Bit.Core.OrganizationFeatures.OrganizationCollections; using Bit.Core.OrganizationFeatures.OrganizationCollections.Interfaces; -using Bit.Core.OrganizationFeatures.OrganizationLicenses; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise; using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Cloud; using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces; diff --git a/test/Api.Test/Billing/Controllers/OrganizationsControllerTests.cs b/test/Api.Test/Billing/Controllers/OrganizationsControllerTests.cs index 63afb2a7a8..4f625afd6a 100644 --- a/test/Api.Test/Billing/Controllers/OrganizationsControllerTests.cs +++ b/test/Api.Test/Billing/Controllers/OrganizationsControllerTests.cs @@ -10,6 +10,7 @@ using Bit.Core.Auth.Enums; using Bit.Core.Auth.Models.Data; using Bit.Core.Auth.Repositories; using Bit.Core.Auth.Services; +using Bit.Core.Billing.Licenses.Queries; using Bit.Core.Billing.Pricing; using Bit.Core.Billing.Repositories; using Bit.Core.Billing.Services; @@ -19,7 +20,6 @@ using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data.Organizations.OrganizationUsers; -using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.OrganizationFeatures.OrganizationSubscriptions.Interface; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/CloudGetOrganizationLicenseQueryTests.cs b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/CloudGetOrganizationLicenseQueryTests.cs index 0fda7b7f85..1d6a458acc 100644 --- a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/CloudGetOrganizationLicenseQueryTests.cs +++ b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/CloudGetOrganizationLicenseQueryTests.cs @@ -3,11 +3,11 @@ using Bit.Core.AdminConsole.Entities.Provider; using Bit.Core.AdminConsole.Repositories; using Bit.Core.Billing.Licenses.Enums; using Bit.Core.Billing.Licenses.Models; +using Bit.Core.Billing.Licenses.Queries.Implementations; using Bit.Core.Billing.Services; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.OrganizationFeatures.OrganizationLicenses; using Bit.Core.Platform.Installations; using Bit.Core.Services; using Bit.Core.Test.AutoFixture; diff --git a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/SelfHostedGetOrganizationLicenseQueryTests.cs b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/SelfHostedGetOrganizationLicenseQueryTests.cs index 97a1a55a85..47faef1ffb 100644 --- a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/SelfHostedGetOrganizationLicenseQueryTests.cs +++ b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/SelfHostedGetOrganizationLicenseQueryTests.cs @@ -1,10 +1,10 @@ using System.Text.Json; using Bit.Core.AdminConsole.Entities; using Bit.Core.Billing.Licenses.Models; +using Bit.Core.Billing.Licenses.Queries.Implementations; using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Models.OrganizationConnectionConfigs; -using Bit.Core.OrganizationFeatures.OrganizationLicenses; using Bit.Core.Settings; using Bit.Core.Test.AutoFixture; using Bit.Test.Common.AutoFixture; diff --git a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommandTests.cs b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommandTests.cs index a151b5a41b..2ed033ecdd 100644 --- a/test/Core.Test/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommandTests.cs +++ b/test/Core.Test/OrganizationFeatures/OrganizationLicenses/UpdateOrganizationLicenseCommandTests.cs @@ -1,10 +1,10 @@ using System.Security.Claims; using Bit.Core.AdminConsole.Entities; +using Bit.Core.Billing.Licenses.Commands.Implementations; using Bit.Core.Billing.Licenses.Enums; using Bit.Core.Billing.Licenses.Models; using Bit.Core.Billing.Services; using Bit.Core.Models.Data.Organizations; -using Bit.Core.OrganizationFeatures.OrganizationLicenses; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Test.Common.AutoFixture;