From e4a10aae270b05baa44821de8143d913a3e1e918 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 11 Jan 2022 10:40:51 +0100 Subject: [PATCH] Split out repositories to Infrastructure.Dapper / EntityFramework (#1759) --- bitwarden-server.sln | 20 ++++ .../src/CommCore/Services/ProviderService.cs | 4 +- .../src/Sso/Controllers/AccountController.cs | 2 +- bitwarden_license/src/Sso/Sso.csproj | 1 + bitwarden_license/src/Sso/Startup.cs | 1 + .../DynamicAuthenticationSchemeProvider.cs | 2 +- .../Utilities/ServiceCollectionExtensions.cs | 1 + .../AutoFixture/ProviderUserFixtures.cs | 2 +- .../Services/ProviderServiceTests.cs | 6 +- src/Admin/Admin.csproj | 1 + .../Controllers/OrganizationsController.cs | 2 +- src/Admin/Controllers/ProvidersController.cs | 2 +- src/Admin/Controllers/ToolsController.cs | 2 +- src/Admin/Controllers/UsersController.cs | 2 +- .../Models/CreateUpdateTransactionModel.cs | 2 +- src/Admin/Models/OrganizationEditModel.cs | 2 +- src/Admin/Models/OrganizationViewModel.cs | 2 +- src/Admin/Models/OrganizationsModel.cs | 2 +- src/Admin/Models/ProviderEditModel.cs | 2 +- src/Admin/Models/ProviderViewModel.cs | 2 +- src/Admin/Models/ProvidersModel.cs | 3 +- src/Admin/Models/TaxRatesModel.cs | 2 +- src/Admin/Models/UserEditModel.cs | 2 +- src/Admin/Models/UserViewModel.cs | 2 +- src/Admin/Models/UsersModel.cs | 2 +- src/Admin/Startup.cs | 1 + src/Admin/Views/Tools/TaxRate.cshtml | 2 - src/Api/Api.csproj | 1 + src/Api/Controllers/AccountsController.cs | 2 +- src/Api/Controllers/CiphersController.cs | 2 +- src/Api/Controllers/CollectionsController.cs | 2 +- src/Api/Controllers/DevicesController.cs | 2 +- .../Controllers/EmergencyAccessController.cs | 2 +- .../OrganizationSponsorshipsController.cs | 2 +- src/Api/Controllers/SendsController.cs | 2 +- src/Api/Controllers/SyncController.cs | 2 +- src/Api/Controllers/TwoFactorController.cs | 2 +- src/Api/Models/Public/MemberBaseModel.cs | 2 +- .../Request/CollectionUpdateRequestModel.cs | 2 +- .../Request/GroupCreateUpdateRequestModel.cs | 2 +- .../Request/MemberCreateRequestModel.cs | 2 +- .../Request/MemberUpdateRequestModel.cs | 2 +- .../Request/OrganizationImportRequestModel.cs | 4 +- .../Request/PolicyUpdateRequestModel.cs | 2 +- .../Response/CollectionResponseModel.cs | 2 +- .../Public/Response/GroupResponseModel.cs | 2 +- .../Public/Response/MemberResponseModel.cs | 2 +- .../Public/Response/PolicyResponseModel.cs | 2 +- .../Request/Accounts/KeysRequestModel.cs | 2 +- .../Request/Accounts/RegisterRequestModel.cs | 2 +- .../SetKeyConnectorKeyRequestModel.cs | 2 +- .../Accounts/SetPasswordRequestModel.cs | 2 +- .../Accounts/UpdateProfileRequestModel.cs | 2 +- src/Api/Models/Request/CipherRequestModel.cs | 2 +- .../Models/Request/CollectionRequestModel.cs | 2 +- src/Api/Models/Request/DeviceRequestModels.cs | 2 +- .../Request/EmergencyAccessRequstModels.cs | 2 +- src/Api/Models/Request/FolderRequestModel.cs | 2 +- src/Api/Models/Request/GroupRequestModel.cs | 2 +- .../Request/InstallationRequestModel.cs | 2 +- .../ImportOrganizationUsersRequestModel.cs | 3 +- .../OrganizationCreateRequestModel.cs | 2 +- .../OrganizationKeysRequestModel.cs | 2 +- .../OrganizationSsoRequestModel.cs | 2 +- .../OrganizationUpdateRequestModel.cs | 2 +- .../OrganizationUserRequestModels.cs | 2 +- src/Api/Models/Request/PolicyRequestModel.cs | 2 +- .../Providers/ProviderSetupRequestModel.cs | 2 +- .../Providers/ProviderUpdateRequestModel.cs | 2 +- .../Providers/ProviderUserRequestModels.cs | 2 +- src/Api/Models/Request/SendRequestModel.cs | 2 +- .../Models/Request/TwoFactorRequestModels.cs | 2 +- .../Request/UpdateDomainsRequestModel.cs | 2 +- .../Models/Response/ApiKeyResponseModel.cs | 2 +- .../Response/AttachmentResponseModel.cs | 2 +- .../Models/Response/CipherResponseModel.cs | 2 +- .../Response/CollectionResponseModel.cs | 2 +- .../Models/Response/DeviceResponseModel.cs | 2 +- .../Models/Response/DomainsResponseModel.cs | 2 +- .../Response/EmergencyAccessResponseModel.cs | 2 +- .../Models/Response/FolderResponseModel.cs | 2 +- src/Api/Models/Response/GroupResponseModel.cs | 2 +- .../Response/InstallationResponseModel.cs | 4 +- src/Api/Models/Response/KeysResponseModel.cs | 2 +- .../Response/OrganizationKeysResponseModel.cs | 2 +- .../Response/OrganizationResponseModel.cs | 2 +- .../Response/OrganizationSsoResponseModel.cs | 4 +- .../Response/OrganizationUserResponseModel.cs | 2 +- .../Models/Response/PolicyResponseModel.cs | 2 +- .../Models/Response/ProfileResponseModel.cs | 2 +- .../ProviderOrganizationResponseModel.cs | 2 +- .../Providers/ProviderResponseModel.cs | 2 +- .../Providers/ProviderUserResponseModel.cs | 2 +- .../Response/SendAccessResponseModel.cs | 2 +- src/Api/Models/Response/SendResponseModel.cs | 2 +- .../Response/SubscriptionResponseModel.cs | 2 +- src/Api/Models/Response/SyncResponseModel.cs | 2 +- .../Models/Response/TaxRateResponseModel.cs | 2 +- .../TwoFactorAuthenticatorResponseModel.cs | 2 +- .../TwoFactor/TwoFactorDuoResponseModel.cs | 2 +- .../TwoFactor/TwoFactorEmailResponseModel.cs | 2 +- .../TwoFactorProviderResponseModel.cs | 2 +- .../TwoFactorRecoverResponseModel.cs | 2 +- .../TwoFactorWebAuthnResponseModel.cs | 2 +- .../TwoFactorYubiKeyResponseModel.cs | 2 +- src/Api/Startup.cs | 1 + src/Billing/Billing.csproj | 1 + src/Billing/Controllers/BitPayController.cs | 3 +- src/Billing/Controllers/PayPalController.cs | 2 +- src/Billing/Controllers/StripeController.cs | 5 +- src/Billing/Startup.cs | 1 + .../Context/CurrentContentOrganization.cs | 2 +- src/Core/Context/CurrentContentProvider.cs | 3 +- src/Core/Context/CurrentContext.cs | 2 +- src/Core/Context/ICurrentContext.cs | 2 +- src/Core/Core.csproj | 8 +- src/Core/{Models/Table => Entities}/Cipher.cs | 8 +- .../{Models/Table => Entities}/Collection.cs | 6 +- .../Table => Entities}/CollectionCipher.cs | 2 +- .../Table => Entities}/CollectionGroup.cs | 3 +- .../Table => Entities}/CollectionUser.cs | 3 +- src/Core/{Models/Table => Entities}/Device.cs | 2 +- .../Table => Entities}/EmergencyAccess.cs | 10 +- src/Core/{Models/Table => Entities}/Event.cs | 2 +- src/Core/{Models/Table => Entities}/Folder.cs | 2 +- src/Core/{Models/Table => Entities}/Grant.cs | 2 +- src/Core/{Models/Table => Entities}/Group.cs | 3 +- .../{Models/Table => Entities}/GroupUser.cs | 3 +- .../Table => Entities}/IReferenceable.cs | 2 +- .../{Models/Table => Entities}/IRevisable.cs | 2 +- .../{Models/Table => Entities}/IStorable.cs | 2 +- .../Table => Entities}/IStorableSubscriber.cs | 2 +- .../{Models/Table => Entities}/ISubscriber.cs | 3 +- .../Table => Entities}/ITableObject.cs | 2 +- .../Table => Entities}/Installation.cs | 2 +- .../Table => Entities}/Organization.cs | 7 +- .../OrganizationSponsorship.cs | 2 +- .../Table => Entities}/OrganizationUser.cs | 3 +- src/Core/{Models/Table => Entities}/Policy.cs | 2 +- .../Table => Entities}/Provider/Provider.cs | 2 +- .../Provider/ProviderOrganization.cs | 2 +- .../Provider/ProviderUser.cs | 2 +- src/Core/{Models/Table => Entities}/Role.cs | 2 +- src/Core/{Models/Table => Entities}/Send.cs | 2 +- .../{Models/Table => Entities}/SsoConfig.cs | 2 +- .../{Models/Table => Entities}/SsoUser.cs | 2 +- .../{Models/Table => Entities}/TaxRate.cs | 2 +- .../{Models/Table => Entities}/Transaction.cs | 2 +- src/Core/{Models/Table => Entities}/U2f.cs | 2 +- src/Core/{Models/Table => Entities}/User.cs | 9 +- .../Identity/AuthenticatorTokenProvider.cs | 2 +- src/Core/Identity/DuoWebTokenProvider.cs | 2 +- src/Core/Identity/EmailTokenProvider.cs | 2 +- .../IOrganizationTwoFactorTokenProvider.cs | 2 +- .../OrganizationDuoWebTokenProvider.cs | 2 +- src/Core/Identity/RoleStore.cs | 2 +- .../TwoFactorRememberTokenProvider.cs | 2 +- src/Core/Identity/U2fTokenProvider.cs | 2 +- src/Core/Identity/UserStore.cs | 2 +- src/Core/Identity/WebAuthnTokenProvider.cs | 2 +- src/Core/Identity/YubicoOtpTokenProvider.cs | 2 +- .../IdentityServer/BaseRequestValidator.cs | 2 +- .../CustomTokenRequestValidator.cs | 2 +- .../IdentityServer/PersistedGrantStore.cs | 7 +- .../ResourceOwnerPasswordValidator.cs | 2 +- .../Models/Business/AppleReceiptStatus.cs | 2 +- src/Core/Models/Business/BillingInfo.cs | 2 +- src/Core/Models/Business/ImportedGroup.cs | 2 +- .../Models/Business/OrganizationLicense.cs | 2 +- .../Models/Business/OrganizationSignup.cs | 4 +- src/Core/Models/Business/ReferenceEvent.cs | 1 + .../Business/SubscriptionCreateOptions.cs | 2 +- .../Models/Business/SubscriptionUpdate.cs | 2 +- .../EmergencyAccessInviteTokenable.cs | 2 +- .../Business/Tokenables/HCaptchaTokenable.cs | 2 +- src/Core/Models/Business/UserLicense.cs | 2 +- .../Models/Data/AttachmentResponseData.cs | 2 +- .../Models/Data/CipherOrganizationDetails.cs | 2 +- src/Core/Models/Data/CollectionDetails.cs | 2 +- .../Models/Data/EmergencyAccessDetails.cs | 2 +- src/Core/Models/Data/EmergencyAccessNotify.cs | 2 +- .../Models/Data/EmergencyAccessViewData.cs | 2 +- src/Core/Models/Data/GroupWithCollections.cs | 2 +- src/Core/Models/Data/OrganizationAbility.cs | 2 +- .../OrganizationUserResetPasswordDetails.cs | 2 +- .../Data/OrganizationUserWithCollections.cs | 2 +- .../Models/Data/Provider/ProviderAbility.cs | 3 +- src/Core/Models/EntityFramework/Device.cs | 19 --- .../Models/EntityFramework/EmergencyAccess.cs | 20 ---- src/Core/Models/EntityFramework/Event.cs | 16 --- src/Core/Models/EntityFramework/Folder.cs | 19 --- src/Core/Models/EntityFramework/Grant.cs | 18 --- .../Models/EntityFramework/Installation.cs | 18 --- src/Core/Models/EntityFramework/Policy.cs | 19 --- .../EntityFramework/Provider/Provider.cs | 16 --- src/Core/Models/EntityFramework/Role.cs | 18 --- src/Core/Models/EntityFramework/SsoConfig.cs | 19 --- src/Core/Models/EntityFramework/TaxRate.cs | 18 --- src/Core/Models/EntityFramework/U2f.cs | 19 --- .../EntityFramework/InstallationRepository.cs | 20 ---- src/Core/Repositories/ICipherRepository.cs | 2 +- .../ICollectionCipherRepository.cs | 2 +- .../Repositories/ICollectionRepository.cs | 2 +- src/Core/Repositories/IDeviceRepository.cs | 2 +- .../IEmergencyAccessRepository.cs | 2 +- src/Core/Repositories/IEventRepository.cs | 2 +- src/Core/Repositories/IFolderRepository.cs | 2 +- src/Core/Repositories/IGrantRepository.cs | 2 +- src/Core/Repositories/IGroupRepository.cs | 2 +- .../Repositories/IInstallationRepository.cs | 2 +- .../Repositories/IOrganizationRepository.cs | 2 +- .../IOrganizationSponsorshipRepository.cs | 2 +- .../IOrganizationUserRepository.cs | 2 +- src/Core/Repositories/IPolicyRepository.cs | 2 +- .../IProviderOrganizationRepository.cs | 2 +- src/Core/Repositories/IProviderRepository.cs | 2 +- .../Repositories/IProviderUserRepository.cs | 2 +- src/Core/Repositories/IRepository.cs | 2 +- src/Core/Repositories/ISendRepository.cs | 2 +- src/Core/Repositories/ISsoConfigRepository.cs | 2 +- src/Core/Repositories/ISsoUserRepository.cs | 2 +- src/Core/Repositories/ITaxRateRepository.cs | 2 +- .../Repositories/ITransactionRepository.cs | 2 +- src/Core/Repositories/IU2fRepository.cs | 2 +- src/Core/Repositories/IUserRepository.cs | 2 +- .../Repositories/SqlServer/DateTimeHandler.cs | 16 --- .../TableStorage/EventRepository.cs | 2 +- src/Core/Services/IApplicationCacheService.cs | 4 +- .../Services/IAttachmentStorageService.cs | 2 +- .../Services/ICaptchaValidationService.cs | 2 +- src/Core/Services/ICipherService.cs | 2 +- src/Core/Services/ICollectionService.cs | 2 +- src/Core/Services/IDeviceService.cs | 2 +- src/Core/Services/IEmergencyAccessService.cs | 2 +- src/Core/Services/IEventService.cs | 4 +- src/Core/Services/IGroupService.cs | 2 +- src/Core/Services/ILicensingService.cs | 2 +- src/Core/Services/IMailService.cs | 4 +- src/Core/Services/IOrganizationService.cs | 2 +- .../IOrganizationSponsorshipService.cs | 2 +- src/Core/Services/IPaymentService.cs | 2 +- src/Core/Services/IPolicyService.cs | 2 +- src/Core/Services/IProviderService.cs | 4 +- src/Core/Services/IPushNotificationService.cs | 2 +- src/Core/Services/ISendService.cs | 2 +- src/Core/Services/ISendStorageService.cs | 2 +- src/Core/Services/ISsoConfigService.cs | 2 +- src/Core/Services/IUserService.cs | 2 +- .../AzureAttachmentStorageService.cs | 2 +- .../AzureQueuePushNotificationService.cs | 2 +- .../Implementations/AzureQueueService.cs | 1 - .../AzureSendFileStorageService.cs | 3 +- .../Services/Implementations/CipherService.cs | 2 +- .../Implementations/CollectionService.cs | 2 +- .../Services/Implementations/DeviceService.cs | 2 +- .../Implementations/EmergencyAccessService.cs | 2 +- .../Services/Implementations/EventService.cs | 4 +- .../Services/Implementations/GroupService.cs | 2 +- .../HCaptchaValidationService.cs | 2 +- .../Implementations/HandlebarsMailService.cs | 4 +- .../InMemoryApplicationCacheService.cs | 4 +- ...MemoryServiceBusApplicationCacheService.cs | 2 +- .../Implementations/LicensingService.cs | 2 +- .../LocalAttachmentStorageService.cs | 2 +- .../LocalSendStorageService.cs | 2 +- .../MultiServicePushNotificationService.cs | 2 +- .../NotificationHubPushNotificationService.cs | 2 +- ...NotificationsApiPushNotificationService.cs | 2 +- .../Implementations/OrganizationService.cs | 2 +- .../OrganizationSponsorshipService.cs | 2 +- .../Services/Implementations/PolicyService.cs | 2 +- .../RelayPushNotificationService.cs | 2 +- .../Services/Implementations/SendService.cs | 2 +- .../Implementations/SsoConfigService.cs | 2 +- .../Implementations/StripePaymentService.cs | 8 +- .../Services/Implementations/UserService.cs | 2 +- .../NoopAttachmentStorageService.cs | 2 +- .../NoopCaptchaValidationService.cs | 2 +- .../NoopImplementations/NoopEventService.cs | 4 +- .../NoopLicensingService.cs | 2 +- .../NoopImplementations/NoopMailService.cs | 4 +- .../NoopProviderService.cs | 4 +- .../NoopPushNotificationService.cs | 2 +- .../NoopSendFileStorageService.cs | 2 +- src/Core/Utilities/BillingHelpers.cs | 2 +- src/Core/Utilities/CoreHelpers.cs | 103 +--------------- src/Events/Controllers/CollectController.cs | 2 +- src/Events/Events.csproj | 1 + src/Events/Startup.cs | 1 + src/EventsProcessor/EventsProcessor.csproj | 1 + src/EventsProcessor/Startup.cs | 1 + src/Icons/Icons.csproj | 1 + src/Icons/Startup.cs | 1 + src/Identity/Controllers/AccountController.cs | 2 +- src/Identity/Identity.csproj | 1 + src/Identity/Startup.cs | 1 + .../Utilities/ServiceCollectionExtensions.cs | 1 + src/Infrastructure.Dapper/DapperHelpers.cs | 110 ++++++++++++++++++ .../DapperServiceCollectionExtensions.cs | 43 +++++++ .../Infrastructure.Dapper.csproj | 16 +++ .../Repositories/BaseRepository.cs | 2 +- .../Repositories}/CipherRepository.cs | 5 +- .../CollectionCipherRepository.cs | 5 +- .../Repositories}/CollectionRepository.cs | 5 +- .../Repositories/DateTimeHandler.cs | 19 +++ .../Repositories}/DeviceRepository.cs | 5 +- .../EmergencyAccessRepository.cs | 5 +- .../Repositories}/EventRepository.cs | 5 +- .../Repositories}/FolderRepository.cs | 5 +- .../Repositories}/GrantRepository.cs | 5 +- .../Repositories}/GroupRepository.cs | 5 +- .../Repositories}/InstallationRepository.cs | 5 +- .../Repositories}/MaintenanceRepository.cs | 3 +- .../Repositories}/OrganizationRepository.cs | 5 +- .../OrganizationSponsorshipRepository.cs | 5 +- .../OrganizationUserRepository.cs | 5 +- .../Repositories}/PolicyRepository.cs | 5 +- .../ProviderOrganizationRepository.cs | 5 +- .../Repositories}/ProviderRepository.cs | 5 +- .../Repositories}/ProviderUserRepository.cs | 5 +- .../Repositories}/Repository.cs | 5 +- .../Repositories}/SendRepository.cs | 5 +- .../Repositories}/SsoConfigRepository.cs | 5 +- .../Repositories}/SsoUserRepository.cs | 5 +- .../Repositories}/TaxRateRepository.cs | 5 +- .../Repositories}/TransactionRepository.cs | 5 +- .../Repositories}/U2fRepository.cs | 5 +- .../Repositories}/UserRepository.cs | 5 +- ...ityFrameworkServiceCollectionExtensions.cs | 65 +++++++++++ .../Infrastructure.EntityFramework.csproj | 19 +++ .../Models}/Cipher.cs | 7 +- .../Models}/Collection.cs | 7 +- .../Models}/CollectionCipher.cs | 10 +- .../Models}/CollectionGroup.cs | 6 +- .../Models}/CollectionUser.cs | 6 +- .../Models/Device.cs | 17 +++ .../Models/EmergencyAccess.cs | 18 +++ .../Models/Event.cs | 16 +++ .../Models/Folder.cs | 17 +++ .../Models/Grant.cs | 16 +++ .../Models}/Group.cs | 7 +- .../Models}/GroupUser.cs | 10 +- .../Models/Installation.cs | 16 +++ .../Models}/Organization.cs | 6 +- .../Models}/OrganizationSponsorship.cs | 9 +- .../Models}/OrganizationUser.cs | 7 +- .../Models/Policy.cs | 17 +++ .../Models/Provider/Provider.cs | 16 +++ .../Models}/Provider/ProviderOrganization.cs | 6 +- .../Models}/Provider/ProviderUser.cs | 6 +- .../Models/Role.cs | 16 +++ .../Models}/Send.cs | 10 +- .../Models/SsoConfig.cs | 17 +++ .../Models}/SsoUser.cs | 10 +- .../Models/TaxRate.cs | 16 +++ .../Models}/Transaction.cs | 10 +- .../Models/U2f.cs | 17 +++ .../Models}/User.cs | 7 +- .../BaseEntityFrameworkRepository.cs | 13 ++- .../Repositories}/CipherRepository.cs | 59 +++++----- .../CollectionCipherRepository.cs | 20 ++-- .../Repositories}/CollectionRepository.cs | 31 +++-- .../Repositories}/DatabaseContext.cs | 5 +- .../Repositories}/DeviceRepository.cs | 25 ++-- .../EmergencyAccessRepository.cs | 10 +- .../Repositories}/EventRepository.cs | 21 ++-- .../Repositories}/FolderRepository.cs | 16 ++- .../Repositories}/GrantRepository.cs | 21 ++-- .../Repositories}/GroupRepository.cs | 30 +++-- .../Repositories/InstallationRepository.cs | 15 +++ .../Repositories}/MaintenanceRepository.cs | 3 +- .../Repositories}/OrganizationRepository.cs | 27 +++-- .../OrganizationSponsorshipRepository.cs | 15 ++- .../OrganizationUserRepository.cs | 57 +++++---- .../Repositories}/PolicyRepository.cs | 28 +++-- .../ProviderOrganizationRepository.cs | 11 +- .../Repositories}/ProviderRepository.cs | 9 +- .../Repositories}/ProviderUserRepository.cs | 11 +- .../Queries/CipherDetailsQuery.cs | 2 +- .../CipherOrganizationDetailsReadByIdQuery.cs | 2 +- .../CipherReadCanEditByIdUserIdQuery.cs | 4 +- .../Queries/CipherUpdateCollectionsQuery.cs | 10 +- ...llectionCipherReadByUserIdCipherIdQuery.cs | 4 +- .../CollectionCipherReadByUserIdQuery.cs | 4 +- ...ollectionReadCountByOrganizationIdQuery.cs | 4 +- .../Queries/CollectionUserUpdateUsersQuery.cs | 24 ++-- .../EmergencyAccessDetailsViewQuery.cs | 2 +- ...ncyAccessReadCountByGrantorIdEmailQuery.cs | 4 +- .../Queries/EventReadPageByCipherIdQuery.cs | 12 +- ...adPageByOrganizationIdActingUserIdQuery.cs | 4 +- .../EventReadPageByOrganizationIdQuery.cs | 4 +- ...ntReadPageByProviderIdActingUserIdQuery.cs | 4 +- .../Queries/EventReadPageByProviderIdQuery.cs | 4 +- .../Queries/EventReadPageByUserIdQuery.cs | 4 +- .../Queries/GroupUserUpdateGroupsQuery.cs | 5 +- .../Repositories}/Queries/IQuery.cs | 2 +- ...izationUserOrganizationDetailsViewQuery.cs | 6 +- ...adCountByFreeOrganizationAdminUserQuery.cs | 5 +- ...ganizationUserReadCountByOnlyOwnerQuery.cs | 5 +- ...UserReadCountByOrganizationIdEmailQuery.cs | 4 +- ...ationUserReadCountByOrganizationIdQuery.cs | 4 +- ...anizationUserUpdateWithCollectionsQuery.cs | 24 ++-- .../Queries/OrganizationUserUserViewQuery.cs | 2 +- .../PolicyReadByTypeApplicableToUserQuery.cs | 5 +- .../Queries/PolicyReadByUserIdQuery.cs | 5 +- ...rganizationDetailsReadByProviderIdQuery.cs | 2 +- ...roviderUserOrganizationDetailsViewQuery.cs | 5 +- ...rProviderDetailsReadByUserIdStatusQuery.cs | 2 +- .../ProviderUserReadCountByOnlyOwnerQuery.cs | 4 +- ...rBumpAccountRevisionDateByCipherIdQuery.cs | 13 +-- ...ccountRevisionDateByOrganizationIdQuery.cs | 5 +- .../Queries/UserCipherDetailsQuery.cs | 4 +- .../Queries/UserCollectionDetailsQuery.cs | 3 +- ...serReadPublicKeysByProviderUserIdsQuery.cs | 4 +- .../Repositories}/Repository.cs | 7 +- .../Repositories}/SendRepository.cs | 20 ++-- .../Repositories}/SsoConfigRepository.cs | 21 ++-- .../Repositories}/SsoUserRepository.cs | 10 +- .../Repositories}/TaxRateRepository.cs | 29 +++-- .../Repositories}/TransactionRepository.cs | 22 ++-- .../Repositories}/U2fRepository.cs | 20 ++-- .../Repositories}/UserRepository.cs | 32 +++-- src/Notifications/Notifications.csproj | 1 + src/Notifications/Startup.cs | 1 + src/SharedWeb/SharedWeb.csproj | 13 +++ .../Utilities/ServiceCollectionExtensions.cs | 88 +------------- src/Sql/Sql.sqlproj | 2 +- .../Controllers/AccountsControllerTests.cs | 2 +- ...OrganizationSponsorshipsControllerTests.cs | 2 +- .../OrganizationsControllerTests.cs | 2 +- .../Controllers/SendsControllerTests.cs | 2 +- .../Controllers/FreshsalesControllerTests.cs | 4 +- test/Common/Helpers/Factories.cs | 5 +- test/Core.Test/AutoFixture/CipherFixtures.cs | 4 +- .../AutoFixture/CollectionCipherFixtures.cs | 8 +- .../AutoFixture/CollectionFixtures.cs | 8 +- test/Core.Test/AutoFixture/DeviceFixtures.cs | 8 +- .../AutoFixture/EmergencyAccessFixtures.cs | 8 +- .../EntityFrameworkRepositoryFixtures.cs | 5 +- test/Core.Test/AutoFixture/EventFixtures.cs | 8 +- test/Core.Test/AutoFixture/FolderFixtures.cs | 8 +- test/Core.Test/AutoFixture/GrantFixtures.cs | 8 +- test/Core.Test/AutoFixture/GroupFixtures.cs | 8 +- .../AutoFixture/GroupUserFixtures.cs | 8 +- .../AutoFixture/InstallationFixtures.cs | 8 +- .../AutoFixture/OrganizationFixtures.cs | 30 ++--- .../OrganizationSponsorshipFixtures.cs | 8 +- .../AutoFixture/OrganizationUserFixtures.cs | 9 +- test/Core.Test/AutoFixture/PolicyFixtures.cs | 9 +- test/Core.Test/AutoFixture/SendFixtures.cs | 4 +- .../AutoFixture/SsoConfigFixtures.cs | 8 +- test/Core.Test/AutoFixture/SsoUserFixtures.cs | 6 +- test/Core.Test/AutoFixture/TaxRateFixtures.cs | 8 +- .../AutoFixture/TransactionFixutres.cs | 9 +- test/Core.Test/AutoFixture/U2fFixtures.cs | 8 +- test/Core.Test/AutoFixture/UserFixtures.cs | 12 +- test/Core.Test/Helpers/Factories.cs | 6 +- .../EmergencyAccessInviteTokenableTests.cs | 2 +- .../Tokenables/HCaptchaTokenableTests.cs | 3 +- test/Core.Test/Models/CipherTests.cs | 2 +- test/Core.Test/Models/PermissionsTests.cs | 1 - test/Core.Test/Models/Tables/UserTests.cs | 2 +- .../EntityFramework/CipherRepositoryTests.cs | 10 +- .../EntityFramework/CollectionRepository.cs | 9 +- .../EntityFramework/DeviceRepositoryTests.cs | 6 +- .../EmergencyAccessRepositoryTests.cs | 6 +- .../EqualityComparers/CipherCompare.cs | 2 +- .../EqualityComparers/CollectionCompare.cs | 2 +- .../EqualityComparers/DeviceCompare.cs | 2 +- .../EmergencyAccessCompare.cs | 2 +- .../EqualityComparers/EventCompare.cs | 2 +- .../EqualityComparers/FolderCompare.cs | 2 +- .../EqualityComparers/GrantCompare.cs | 2 +- .../EqualityComparers/GroupCompare.cs | 2 +- .../EqualityComparers/InstallationCompare.cs | 2 +- .../EqualityComparers/OrganizationCompare.cs | 2 +- .../OrganizationSponsorshipCompare.cs | 2 +- .../OrganizationUserCompare.cs | 2 +- .../EqualityComparers/PolicyCompare.cs | 2 +- .../EqualityComparers/SendCompare.cs | 2 +- .../EqualityComparers/SsoConfigCompare.cs | 2 +- .../EqualityComparers/SsoUserCompare.cs | 2 +- .../EqualityComparers/TaxRateCompare.cs | 2 +- .../EqualityComparers/TransactionCompare.cs | 2 +- .../EqualityComparers/U2fCompare.cs | 2 +- .../EqualityComparers/UserCompare.cs | 2 +- .../EntityFramework/FolderRepositoryTests.cs | 6 +- .../InstallationRepositoryTests.cs | 6 +- .../OrganizationRepositoryTests.cs | 28 ++--- .../OrganizationSponsorshipRepositoryTests.cs | 20 ++-- .../OrganizationUserRepositoryTests.cs | 23 ++-- .../EntityFramework/PolicyRepositoryTests.cs | 37 +++--- .../EntityFramework/SendRepositoryTests.cs | 6 +- .../SsoConfigRepositoryTests.cs | 6 +- .../EntityFramework/SsoUserRepositoryTests.cs | 6 +- .../EntityFramework/TaxRateRepositoryTests.cs | 6 +- .../TransactionRepositoryTests.cs | 9 +- .../EntityFramework/U2fRepositoryTests.cs | 9 +- .../EntityFramework/UserRepositoryTests.cs | 6 +- test/Core.Test/Services/CipherServiceTests.cs | 2 +- .../Services/CollectionServiceTests.cs | 2 +- test/Core.Test/Services/DeviceServiceTests.cs | 2 +- .../Services/EmergencyAccessServiceTests.cs | 2 +- test/Core.Test/Services/GroupServiceTests.cs | 2 +- .../Services/HandlebarsMailServiceTests.cs | 4 +- .../LocalAttachmentStorageServiceTests.cs | 2 +- .../Services/OrganizationServiceTests.cs | 8 +- .../OrganizationSponsorshipServiceTests.cs | 2 +- test/Core.Test/Services/PolicyServiceTests.cs | 30 ++--- test/Core.Test/Services/SendServiceTests.cs | 2 +- .../Services/SsoConfigServiceTests.cs | 2 +- .../Services/StripePaymentServiceTests.cs | 2 +- test/Core.Test/Services/UserServiceTests.cs | 2 +- test/Core.Test/Utilities/CoreHelpersTests.cs | 3 +- util/MySqlMigrations/Factories.cs | 2 +- .../20210617183900_Init.Designer.cs | 2 +- ...oviderOrganizationProviderUser.Designer.cs | 2 +- ...6142145_UserForcePasswordReset.Designer.cs | 2 +- ...axAutoscaleSeatsToOrganization.Designer.cs | 2 +- ...tManageCollectionsPermissions2.Designer.cs | 2 +- ...toscaleSeatsToCurrentSeatCount.Designer.cs | 2 +- .../20211108041911_KeyConnector.Designer.cs | 2 +- ...225243_OrganizationSponsorship.Designer.cs | 2 +- ...0211115145402_KeyConnectorFlag.Designer.cs | 2 +- .../DatabaseContextModelSnapshot.cs | 2 +- util/PostgresMigrations/Factories.cs | 2 +- .../20210708191531_Init.Designer.cs | 2 +- ...oviderOrganizationProviderUser.Designer.cs | 2 +- ...6141748_UserForcePasswordReset.Designer.cs | 2 +- ...axAutoscaleSeatsToOrganization.Designer.cs | 2 +- ...tManageCollectionsPermissions2.Designer.cs | 2 +- ...toscaleSeatsToCurrentSeatCount.Designer.cs | 2 +- .../20211108041547_KeyConnector.Designer.cs | 2 +- ...225011_OrganizationSponsorship.Designer.cs | 2 +- ...0211115142623_KeyConnectorFlag.Designer.cs | 2 +- .../DatabaseContextModelSnapshot.cs | 2 +- 536 files changed, 1629 insertions(+), 1589 deletions(-) rename src/Core/{Models/Table => Entities}/Cipher.cs (92%) rename src/Core/{Models/Table => Entities}/Collection.cs (70%) rename src/Core/{Models/Table => Entities}/CollectionCipher.cs (83%) rename src/Core/{Models/Table => Entities}/CollectionGroup.cs (80%) rename src/Core/{Models/Table => Entities}/CollectionUser.cs (81%) rename src/Core/{Models/Table => Entities}/Device.cs (95%) rename src/Core/{Models/Table => Entities}/EmergencyAccess.cs (80%) rename src/Core/{Models/Table => Entities}/Event.cs (98%) rename src/Core/{Models/Table => Entities}/Folder.cs (93%) rename src/Core/{Models/Table => Entities}/Grant.cs (95%) rename src/Core/{Models/Table => Entities}/Group.cs (93%) rename src/Core/{Models/Table => Entities}/GroupUser.cs (72%) rename src/Core/{Models/Table => Entities}/IReferenceable.cs (85%) rename src/Core/{Models/Table => Entities}/IRevisable.cs (81%) rename src/Core/{Models/Table => Entities}/IStorable.cs (86%) rename src/Core/{Models/Table => Entities}/IStorableSubscriber.cs (69%) rename src/Core/{Models/Table => Entities}/ISubscriber.cs (88%) rename src/Core/{Models/Table => Entities}/ITableObject.cs (82%) rename src/Core/{Models/Table => Entities}/Installation.cs (94%) rename src/Core/{Models/Table => Entities}/Organization.cs (97%) rename src/Core/{Models/Table => Entities}/OrganizationSponsorship.cs (96%) rename src/Core/{Models/Table => Entities}/OrganizationUser.cs (95%) rename src/Core/{Models/Table => Entities}/Policy.cs (94%) rename src/Core/{Models/Table => Entities}/Provider/Provider.cs (96%) rename src/Core/{Models/Table => Entities}/Provider/ProviderOrganization.cs (94%) rename src/Core/{Models/Table => Entities}/Provider/ProviderUser.cs (95%) rename src/Core/{Models/Table => Entities}/Role.cs (85%) rename src/Core/{Models/Table => Entities}/Send.cs (97%) rename src/Core/{Models/Table => Entities}/SsoConfig.cs (96%) rename src/Core/{Models/Table => Entities}/SsoUser.cs (94%) rename src/Core/{Models/Table => Entities}/TaxRate.cs (95%) rename src/Core/{Models/Table => Entities}/Transaction.cs (96%) rename src/Core/{Models/Table => Entities}/U2f.cs (95%) rename src/Core/{Models/Table => Entities}/User.cs (95%) delete mode 100644 src/Core/Models/EntityFramework/Device.cs delete mode 100644 src/Core/Models/EntityFramework/EmergencyAccess.cs delete mode 100644 src/Core/Models/EntityFramework/Event.cs delete mode 100644 src/Core/Models/EntityFramework/Folder.cs delete mode 100644 src/Core/Models/EntityFramework/Grant.cs delete mode 100644 src/Core/Models/EntityFramework/Installation.cs delete mode 100644 src/Core/Models/EntityFramework/Policy.cs delete mode 100644 src/Core/Models/EntityFramework/Provider/Provider.cs delete mode 100644 src/Core/Models/EntityFramework/Role.cs delete mode 100644 src/Core/Models/EntityFramework/SsoConfig.cs delete mode 100644 src/Core/Models/EntityFramework/TaxRate.cs delete mode 100644 src/Core/Models/EntityFramework/U2f.cs delete mode 100644 src/Core/Repositories/EntityFramework/InstallationRepository.cs delete mode 100644 src/Core/Repositories/SqlServer/DateTimeHandler.cs create mode 100644 src/Infrastructure.Dapper/DapperHelpers.cs create mode 100644 src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs create mode 100644 src/Infrastructure.Dapper/Infrastructure.Dapper.csproj rename src/{Core => Infrastructure.Dapper}/Repositories/BaseRepository.cs (94%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/CipherRepository.cs (99%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/CollectionCipherRepository.cs (97%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/CollectionRepository.cs (98%) create mode 100644 src/Infrastructure.Dapper/Repositories/DateTimeHandler.cs rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/DeviceRepository.cs (96%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/EmergencyAccessRepository.cs (97%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/EventRepository.cs (99%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/FolderRepository.cs (93%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/GrantRepository.cs (96%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/GroupRepository.cs (98%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/InstallationRepository.cs (83%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/MaintenanceRepository.cs (96%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/OrganizationRepository.cs (97%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/OrganizationSponsorshipRepository.cs (96%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/OrganizationUserRepository.cs (99%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/PolicyRepository.cs (97%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/ProviderOrganizationRepository.cs (94%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/ProviderRepository.cs (93%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/ProviderUserRepository.cs (98%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/Repository.cs (96%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/SendRepository.cs (94%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/SsoConfigRepository.cs (95%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/SsoUserRepository.cs (93%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/TaxRateRepository.cs (95%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/TransactionRepository.cs (95%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/U2fRepository.cs (94%) rename src/{Core/Repositories/SqlServer => Infrastructure.Dapper/Repositories}/UserRepository.cs (98%) create mode 100644 src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs create mode 100644 src/Infrastructure.EntityFramework/Infrastructure.EntityFramework.csproj rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Cipher.cs (69%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Collection.cs (73%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/CollectionCipher.cs (50%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/CollectionGroup.cs (58%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/CollectionUser.cs (60%) create mode 100644 src/Infrastructure.EntityFramework/Models/Device.cs create mode 100644 src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs create mode 100644 src/Infrastructure.EntityFramework/Models/Event.cs create mode 100644 src/Infrastructure.EntityFramework/Models/Folder.cs create mode 100644 src/Infrastructure.EntityFramework/Models/Grant.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Group.cs (66%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/GroupUser.cs (52%) create mode 100644 src/Infrastructure.EntityFramework/Models/Installation.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Organization.cs (78%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/OrganizationSponsorship.cs (58%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/OrganizationUser.cs (65%) create mode 100644 src/Infrastructure.EntityFramework/Models/Policy.cs create mode 100644 src/Infrastructure.EntityFramework/Models/Provider/Provider.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Provider/ProviderOrganization.cs (55%) rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Provider/ProviderUser.cs (56%) create mode 100644 src/Infrastructure.EntityFramework/Models/Role.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Send.cs (53%) create mode 100644 src/Infrastructure.EntityFramework/Models/SsoConfig.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/SsoUser.cs (52%) create mode 100644 src/Infrastructure.EntityFramework/Models/TaxRate.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/Transaction.cs (51%) create mode 100644 src/Infrastructure.EntityFramework/Models/U2f.cs rename src/{Core/Models/EntityFramework => Infrastructure.EntityFramework/Models}/User.cs (82%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/BaseEntityFrameworkRepository.cs (96%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/CipherRepository.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/CollectionCipherRepository.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/CollectionRepository.cs (89%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/DatabaseContext.cs (98%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/DeviceRepository.cs (70%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/EmergencyAccessRepository.cs (92%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/EventRepository.cs (93%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/FolderRepository.cs (65%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/GrantRepository.cs (84%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/GroupRepository.cs (84%) create mode 100644 src/Infrastructure.EntityFramework/Repositories/InstallationRepository.cs rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/MaintenanceRepository.cs (93%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/OrganizationRepository.cs (79%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/OrganizationSponsorshipRepository.cs (71%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/OrganizationUserRepository.cs (86%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/PolicyRepository.cs (69%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/ProviderOrganizationRepository.cs (78%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/ProviderRepository.cs (88%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/ProviderUserRepository.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CipherDetailsQuery.cs (96%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CipherOrganizationDetailsReadByIdQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CipherReadCanEditByIdUserIdQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CipherUpdateCollectionsQuery.cs (88%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs (82%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CollectionCipherReadByUserIdQuery.cs (94%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CollectionReadCountByOrganizationIdQuery.cs (83%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/CollectionUserUpdateUsersQuery.cs (81%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EmergencyAccessDetailsViewQuery.cs (96%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs (90%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByCipherIdQuery.cs (76%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs (92%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByOrganizationIdQuery.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByProviderIdActingUserIdQuery.cs (92%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByProviderIdQuery.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/EventReadPageByUserIdQuery.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/GroupUserUpdateGroupsQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/IQuery.cs (66%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserOrganizationDetailsViewQuery.cs (94%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs (88%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs (90%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs (90%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs (84%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserUpdateWithCollectionsQuery.cs (84%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/OrganizationUserUserViewQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/PolicyReadByTypeApplicableToUserQuery.cs (94%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/PolicyReadByUserIdQuery.cs (87%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/ProviderUserOrganizationDetailsViewQuery.cs (94%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs (87%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs (86%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/UserCipherDetailsQuery.cs (96%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/UserCollectionDetailsQuery.cs (96%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs (91%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/Repository.cs (95%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/SendRepository.cs (64%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/SsoConfigRepository.cs (63%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/SsoUserRepository.cs (77%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/TaxRateRepository.cs (65%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/TransactionRepository.cs (63%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/U2fRepository.cs (68%) rename src/{Core/Repositories/EntityFramework => Infrastructure.EntityFramework/Repositories}/UserRepository.cs (82%) create mode 100644 src/SharedWeb/SharedWeb.csproj rename src/{Core => SharedWeb}/Utilities/ServiceCollectionExtensions.cs (80%) diff --git a/bitwarden-server.sln b/bitwarden-server.sln index 1e96c3aa0..6dae86dc3 100644 --- a/bitwarden-server.sln +++ b/bitwarden-server.sln @@ -76,6 +76,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostgresMigrations", "util\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "test\Common\Common.csproj", "{17DA09D7-0212-4009-879E-6B9CFDE5FA60}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Dapper", "src\Infrastructure.Dapper\Infrastructure.Dapper.csproj", "{AD933445-27CE-4D30-A6ED-9065309464AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedWeb", "src\SharedWeb\SharedWeb.csproj", "{713D44C0-1BC1-4024-96A3-A98A49F33908}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.EntityFramework", "src\Infrastructure.EntityFramework\Infrastructure.EntityFramework.csproj", "{ED880735-0250-43C7-9662-FDC7C7416E7F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Billing.Test", "test\Billing.Test\Billing.Test.csproj", "{B8639B10-2157-44BC-8CE1-D9EB4B50971F}" EndProject Global @@ -174,6 +179,18 @@ Global {17DA09D7-0212-4009-879E-6B9CFDE5FA60}.Debug|Any CPU.Build.0 = Debug|Any CPU {17DA09D7-0212-4009-879E-6B9CFDE5FA60}.Release|Any CPU.ActiveCfg = Release|Any CPU {17DA09D7-0212-4009-879E-6B9CFDE5FA60}.Release|Any CPU.Build.0 = Release|Any CPU + {AD933445-27CE-4D30-A6ED-9065309464AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD933445-27CE-4D30-A6ED-9065309464AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD933445-27CE-4D30-A6ED-9065309464AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD933445-27CE-4D30-A6ED-9065309464AD}.Release|Any CPU.Build.0 = Release|Any CPU + {713D44C0-1BC1-4024-96A3-A98A49F33908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {713D44C0-1BC1-4024-96A3-A98A49F33908}.Debug|Any CPU.Build.0 = Debug|Any CPU + {713D44C0-1BC1-4024-96A3-A98A49F33908}.Release|Any CPU.ActiveCfg = Release|Any CPU + {713D44C0-1BC1-4024-96A3-A98A49F33908}.Release|Any CPU.Build.0 = Release|Any CPU + {ED880735-0250-43C7-9662-FDC7C7416E7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED880735-0250-43C7-9662-FDC7C7416E7F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED880735-0250-43C7-9662-FDC7C7416E7F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED880735-0250-43C7-9662-FDC7C7416E7F}.Release|Any CPU.Build.0 = Release|Any CPU {B8639B10-2157-44BC-8CE1-D9EB4B50971F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8639B10-2157-44BC-8CE1-D9EB4B50971F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8639B10-2157-44BC-8CE1-D9EB4B50971F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -205,6 +222,9 @@ Global {EDC0D688-D58C-4CE1-AA07-3606AC6874B8} = {4FDB6543-F68B-4202-9EA6-7FEA984D2D0A} {0E99A21B-684B-4C59-9831-90F775CAB6F7} = {287CFF34-BBDB-4BC4-AF88-1E19A5A4679B} {17DA09D7-0212-4009-879E-6B9CFDE5FA60} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84F} + {AD933445-27CE-4D30-A6ED-9065309464AD} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} + {713D44C0-1BC1-4024-96A3-A98A49F33908} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} + {ED880735-0250-43C7-9662-FDC7C7416E7F} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D} {B8639B10-2157-44BC-8CE1-D9EB4B50971F} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/bitwarden_license/src/CommCore/Services/ProviderService.cs b/bitwarden_license/src/CommCore/Services/ProviderService.cs index 9bc513ece..85d074127 100644 --- a/bitwarden_license/src/CommCore/Services/ProviderService.cs +++ b/bitwarden_license/src/CommCore/Services/ProviderService.cs @@ -3,14 +3,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Business.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/bitwarden_license/src/Sso/Controllers/AccountController.cs b/bitwarden_license/src/Sso/Controllers/AccountController.cs index 6a8a54506..cffdbeab9 100644 --- a/bitwarden_license/src/Sso/Controllers/AccountController.cs +++ b/bitwarden_license/src/Sso/Controllers/AccountController.cs @@ -4,11 +4,11 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Bit.Core; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/bitwarden_license/src/Sso/Sso.csproj b/bitwarden_license/src/Sso/Sso.csproj index cb9e81ef8..3c95f4632 100644 --- a/bitwarden_license/src/Sso/Sso.csproj +++ b/bitwarden_license/src/Sso/Sso.csproj @@ -12,6 +12,7 @@ + diff --git a/bitwarden_license/src/Sso/Startup.cs b/bitwarden_license/src/Sso/Startup.cs index 95d9d6ce0..2b4550454 100644 --- a/bitwarden_license/src/Sso/Startup.cs +++ b/bitwarden_license/src/Sso/Startup.cs @@ -3,6 +3,7 @@ using Bit.Core; using Bit.Core.Context; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using Bit.Sso.Utilities; using IdentityServer4.Extensions; using Microsoft.AspNetCore.Builder; diff --git a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs index c774ba555..749bba2ad 100644 --- a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs +++ b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs @@ -5,9 +5,9 @@ using System.Security.Cryptography.X509Certificates; using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/bitwarden_license/src/Sso/Utilities/ServiceCollectionExtensions.cs b/bitwarden_license/src/Sso/Utilities/ServiceCollectionExtensions.cs index 38d9f38b5..2a9989118 100644 --- a/bitwarden_license/src/Sso/Utilities/ServiceCollectionExtensions.cs +++ b/bitwarden_license/src/Sso/Utilities/ServiceCollectionExtensions.cs @@ -4,6 +4,7 @@ using Bit.Core.Business.Sso; using Bit.Core.IdentityServer; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using Bit.Sso.Models; using IdentityServer4.Models; using IdentityServer4.ResponseHandling; diff --git a/bitwarden_license/test/CmmCore.Test/AutoFixture/ProviderUserFixtures.cs b/bitwarden_license/test/CmmCore.Test/AutoFixture/ProviderUserFixtures.cs index c732fc3ba..8860f5227 100644 --- a/bitwarden_license/test/CmmCore.Test/AutoFixture/ProviderUserFixtures.cs +++ b/bitwarden_license/test/CmmCore.Test/AutoFixture/ProviderUserFixtures.cs @@ -18,7 +18,7 @@ namespace Bit.CommCore.Test.AutoFixture.ProviderUserFixtures public void Customize(IFixture fixture) { - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.Type, Type) .With(o => o.Status, Status)); } diff --git a/bitwarden_license/test/CmmCore.Test/Services/ProviderServiceTests.cs b/bitwarden_license/test/CmmCore.Test/Services/ProviderServiceTests.cs index 09bf1c2da..ded503b7b 100644 --- a/bitwarden_license/test/CmmCore.Test/Services/ProviderServiceTests.cs +++ b/bitwarden_license/test/CmmCore.Test/Services/ProviderServiceTests.cs @@ -5,13 +5,13 @@ using System.Threading.Tasks; using Bit.CommCore.Services; using Bit.CommCore.Test.AutoFixture.ProviderUserFixtures; using Bit.Core.Context; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Business.Provider; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; @@ -21,7 +21,7 @@ using Microsoft.AspNetCore.DataProtection; using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; -using ProviderUser = Bit.Core.Models.Table.Provider.ProviderUser; +using ProviderUser = Bit.Core.Entities.Provider.ProviderUser; namespace Bit.CommCore.Test.Services { diff --git a/src/Admin/Admin.csproj b/src/Admin/Admin.csproj index d6a7d849b..fbdd24bd7 100644 --- a/src/Admin/Admin.csproj +++ b/src/Admin/Admin.csproj @@ -5,6 +5,7 @@ + diff --git a/src/Admin/Controllers/OrganizationsController.cs b/src/Admin/Controllers/OrganizationsController.cs index 613807b7d..9ea4cff20 100644 --- a/src/Admin/Controllers/OrganizationsController.cs +++ b/src/Admin/Controllers/OrganizationsController.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Threading.Tasks; using Bit.Admin.Models; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Admin/Controllers/ProvidersController.cs b/src/Admin/Controllers/ProvidersController.cs index e27396aa1..6d6d55ca3 100644 --- a/src/Admin/Controllers/ProvidersController.cs +++ b/src/Admin/Controllers/ProvidersController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Bit.Admin.Models; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Entities.Provider; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Admin/Controllers/ToolsController.cs b/src/Admin/Controllers/ToolsController.cs index 600755011..7b56746b1 100644 --- a/src/Admin/Controllers/ToolsController.cs +++ b/src/Admin/Controllers/ToolsController.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; using Bit.Admin.Models; using Bit.Core; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Admin/Controllers/UsersController.cs b/src/Admin/Controllers/UsersController.cs index f65b1f97e..a7793cda3 100644 --- a/src/Admin/Controllers/UsersController.cs +++ b/src/Admin/Controllers/UsersController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Bit.Admin.Models; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Admin/Models/CreateUpdateTransactionModel.cs b/src/Admin/Models/CreateUpdateTransactionModel.cs index ed2f5116c..ab0dcb27a 100644 --- a/src/Admin/Models/CreateUpdateTransactionModel.cs +++ b/src/Admin/Models/CreateUpdateTransactionModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/OrganizationEditModel.cs b/src/Admin/Models/OrganizationEditModel.cs index 9be51460a..c587d87c4 100644 --- a/src/Admin/Models/OrganizationEditModel.cs +++ b/src/Admin/Models/OrganizationEditModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Admin/Models/OrganizationViewModel.cs b/src/Admin/Models/OrganizationViewModel.cs index 096acb5bf..49309fcd1 100644 --- a/src/Admin/Models/OrganizationViewModel.cs +++ b/src/Admin/Models/OrganizationViewModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/OrganizationsModel.cs b/src/Admin/Models/OrganizationsModel.cs index d8696086b..da2eb20d6 100644 --- a/src/Admin/Models/OrganizationsModel.cs +++ b/src/Admin/Models/OrganizationsModel.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/ProviderEditModel.cs b/src/Admin/Models/ProviderEditModel.cs index 6d4a2ad39..f272a2ad7 100644 --- a/src/Admin/Models/ProviderEditModel.cs +++ b/src/Admin/Models/ProviderEditModel.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/ProviderViewModel.cs b/src/Admin/Models/ProviderViewModel.cs index 2439c7435..db963f935 100644 --- a/src/Admin/Models/ProviderViewModel.cs +++ b/src/Admin/Models/ProviderViewModel.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/ProvidersModel.cs b/src/Admin/Models/ProvidersModel.cs index dc2d1e87b..02509593d 100644 --- a/src/Admin/Models/ProvidersModel.cs +++ b/src/Admin/Models/ProvidersModel.cs @@ -1,5 +1,4 @@ -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Entities.Provider; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/TaxRatesModel.cs b/src/Admin/Models/TaxRatesModel.cs index 54a823a03..92564d82f 100644 --- a/src/Admin/Models/TaxRatesModel.cs +++ b/src/Admin/Models/TaxRatesModel.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/UserEditModel.cs b/src/Admin/Models/UserEditModel.cs index 8e3d07073..c6b07e43a 100644 --- a/src/Admin/Models/UserEditModel.cs +++ b/src/Admin/Models/UserEditModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Admin/Models/UserViewModel.cs b/src/Admin/Models/UserViewModel.cs index 1bf4095ff..d4d900a5d 100644 --- a/src/Admin/Models/UserViewModel.cs +++ b/src/Admin/Models/UserViewModel.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Admin.Models { diff --git a/src/Admin/Models/UsersModel.cs b/src/Admin/Models/UsersModel.cs index 7c0d146df..1215a9555 100644 --- a/src/Admin/Models/UsersModel.cs +++ b/src/Admin/Models/UsersModel.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Admin.Models { diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index a2127675a..8ba71017b 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -4,6 +4,7 @@ using Bit.Core.Context; using Bit.Core.Identity; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; diff --git a/src/Admin/Views/Tools/TaxRate.cshtml b/src/Admin/Views/Tools/TaxRate.cshtml index 0144a9f64..de7d433c2 100644 --- a/src/Admin/Views/Tools/TaxRate.cshtml +++ b/src/Admin/Views/Tools/TaxRate.cshtml @@ -1,5 +1,3 @@ -@using Bit.Core.Models.Table - @model TaxRatesModel @{ ViewData["Title"] = "Tax Rates"; diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj index f02d00718..a0314d2f3 100644 --- a/src/Api/Api.csproj +++ b/src/Api/Api.csproj @@ -16,6 +16,7 @@ + diff --git a/src/Api/Controllers/AccountsController.cs b/src/Api/Controllers/AccountsController.cs index 21cc26f1a..539431601 100644 --- a/src/Api/Controllers/AccountsController.cs +++ b/src/Api/Controllers/AccountsController.cs @@ -7,12 +7,12 @@ using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Response; using Bit.Api.Utilities; using Bit.Core; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Controllers/CiphersController.cs b/src/Api/Controllers/CiphersController.cs index 04045d673..88ca1994e 100644 --- a/src/Api/Controllers/CiphersController.cs +++ b/src/Api/Controllers/CiphersController.cs @@ -10,9 +10,9 @@ using Bit.Api.Models.Response; using Bit.Api.Utilities; using Bit.Core; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Controllers/CollectionsController.cs b/src/Api/Controllers/CollectionsController.cs index 56baacbc2..3a8d819bf 100644 --- a/src/Api/Controllers/CollectionsController.cs +++ b/src/Api/Controllers/CollectionsController.cs @@ -5,8 +5,8 @@ using System.Threading.Tasks; using Bit.Api.Models.Request; using Bit.Api.Models.Response; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Authorization; diff --git a/src/Api/Controllers/DevicesController.cs b/src/Api/Controllers/DevicesController.cs index 013cecc75..58777e90e 100644 --- a/src/Api/Controllers/DevicesController.cs +++ b/src/Api/Controllers/DevicesController.cs @@ -4,8 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Bit.Api.Models.Request; using Bit.Api.Models.Response; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Authorization; diff --git a/src/Api/Controllers/EmergencyAccessController.cs b/src/Api/Controllers/EmergencyAccessController.cs index b88f1131e..eef3f2a5b 100644 --- a/src/Api/Controllers/EmergencyAccessController.cs +++ b/src/Api/Controllers/EmergencyAccessController.cs @@ -4,8 +4,8 @@ using System.Threading.Tasks; using Bit.Api.Models.Request; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Controllers/OrganizationSponsorshipsController.cs b/src/Api/Controllers/OrganizationSponsorshipsController.cs index a9d59adf9..103049385 100644 --- a/src/Api/Controllers/OrganizationSponsorshipsController.cs +++ b/src/Api/Controllers/OrganizationSponsorshipsController.cs @@ -2,8 +2,8 @@ using System.Threading.Tasks; using Bit.Api.Models.Request.Organizations; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/src/Api/Controllers/SendsController.cs b/src/Api/Controllers/SendsController.cs index 3d042f288..9536d8353 100644 --- a/src/Api/Controllers/SendsController.cs +++ b/src/Api/Controllers/SendsController.cs @@ -8,10 +8,10 @@ using Bit.Api.Models.Response; using Bit.Api.Utilities; using Bit.Core; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Controllers/SyncController.cs b/src/Api/Controllers/SyncController.cs index cd3cd27c0..ce64ad65e 100644 --- a/src/Api/Controllers/SyncController.cs +++ b/src/Api/Controllers/SyncController.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Api.Models.Response; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Controllers/TwoFactorController.cs b/src/Api/Controllers/TwoFactorController.cs index c10527e8a..ab00b0be5 100644 --- a/src/Api/Controllers/TwoFactorController.cs +++ b/src/Api/Controllers/TwoFactorController.cs @@ -6,9 +6,9 @@ using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Response; using Bit.Api.Models.Response.TwoFactor; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Api/Models/Public/MemberBaseModel.cs b/src/Api/Models/Public/MemberBaseModel.cs index 916121139..913f751a2 100644 --- a/src/Api/Models/Public/MemberBaseModel.cs +++ b/src/Api/Models/Public/MemberBaseModel.cs @@ -1,8 +1,8 @@ using System; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Public { diff --git a/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs b/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs index 5a7422929..68dcfe6e4 100644 --- a/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request { diff --git a/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs b/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs index dd3e6ebfb..d3e6947d5 100644 --- a/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request { diff --git a/src/Api/Models/Public/Request/MemberCreateRequestModel.cs b/src/Api/Models/Public/Request/MemberCreateRequestModel.cs index 965fe0414..fac89b377 100644 --- a/src/Api/Models/Public/Request/MemberCreateRequestModel.cs +++ b/src/Api/Models/Public/Request/MemberCreateRequestModel.cs @@ -1,6 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Utilities; namespace Bit.Api.Models.Public.Request diff --git a/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs b/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs index c25142228..e842c4752 100644 --- a/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request { diff --git a/src/Api/Models/Public/Request/OrganizationImportRequestModel.cs b/src/Api/Models/Public/Request/OrganizationImportRequestModel.cs index 70f787ffa..285d4475d 100644 --- a/src/Api/Models/Public/Request/OrganizationImportRequestModel.cs +++ b/src/Api/Models/Public/Request/OrganizationImportRequestModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Table = Bit.Core.Models.Table; namespace Bit.Api.Models.Public.Request { @@ -51,7 +51,7 @@ namespace Bit.Api.Models.Public.Request { var importedGroup = new ImportedGroup { - Group = new Table.Group + Group = new Group { OrganizationId = organizationId, Name = Name, diff --git a/src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs b/src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs index 4afc7c6f0..239f89afa 100644 --- a/src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs @@ -1,5 +1,5 @@ using System; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Newtonsoft.Json; namespace Bit.Api.Models.Public.Request diff --git a/src/Api/Models/Public/Response/CollectionResponseModel.cs b/src/Api/Models/Public/Response/CollectionResponseModel.cs index c13dffb66..263b35d92 100644 --- a/src/Api/Models/Public/Response/CollectionResponseModel.cs +++ b/src/Api/Models/Public/Response/CollectionResponseModel.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Public.Response { diff --git a/src/Api/Models/Public/Response/GroupResponseModel.cs b/src/Api/Models/Public/Response/GroupResponseModel.cs index f48ac2c6e..7629280ce 100644 --- a/src/Api/Models/Public/Response/GroupResponseModel.cs +++ b/src/Api/Models/Public/Response/GroupResponseModel.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Public.Response { diff --git a/src/Api/Models/Public/Response/MemberResponseModel.cs b/src/Api/Models/Public/Response/MemberResponseModel.cs index df2c1ef84..011bebd65 100644 --- a/src/Api/Models/Public/Response/MemberResponseModel.cs +++ b/src/Api/Models/Public/Response/MemberResponseModel.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Public.Response { diff --git a/src/Api/Models/Public/Response/PolicyResponseModel.cs b/src/Api/Models/Public/Response/PolicyResponseModel.cs index 6096c03b5..a4d0c2fd6 100644 --- a/src/Api/Models/Public/Response/PolicyResponseModel.cs +++ b/src/Api/Models/Public/Response/PolicyResponseModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Newtonsoft.Json; namespace Bit.Api.Models.Public.Response diff --git a/src/Api/Models/Request/Accounts/KeysRequestModel.cs b/src/Api/Models/Request/Accounts/KeysRequestModel.cs index de61cce39..b6351f3ad 100644 --- a/src/Api/Models/Request/Accounts/KeysRequestModel.cs +++ b/src/Api/Models/Request/Accounts/KeysRequestModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Request.Accounts { diff --git a/src/Api/Models/Request/Accounts/RegisterRequestModel.cs b/src/Api/Models/Request/Accounts/RegisterRequestModel.cs index 82ae79b06..c028de500 100644 --- a/src/Api/Models/Request/Accounts/RegisterRequestModel.cs +++ b/src/Api/Models/Request/Accounts/RegisterRequestModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using Bit.Core.Utilities; using Newtonsoft.Json; diff --git a/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs b/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs index 0ee46f68a..030d1adbc 100644 --- a/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs +++ b/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Request.Accounts { diff --git a/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs b/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs index b71802a1c..ae5368e9b 100644 --- a/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs +++ b/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Request.Accounts { diff --git a/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs b/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs index 7e6073773..e92bad863 100644 --- a/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs +++ b/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Request.Accounts { diff --git a/src/Api/Models/Request/CipherRequestModel.cs b/src/Api/Models/Request/CipherRequestModel.cs index 7485b4ec0..51462ed66 100644 --- a/src/Api/Models/Request/CipherRequestModel.cs +++ b/src/Api/Models/Request/CipherRequestModel.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Utilities; using Core.Models.Data; using Newtonsoft.Json; diff --git a/src/Api/Models/Request/CollectionRequestModel.cs b/src/Api/Models/Request/CollectionRequestModel.cs index bcd7baace..65b2887a2 100644 --- a/src/Api/Models/Request/CollectionRequestModel.cs +++ b/src/Api/Models/Request/CollectionRequestModel.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Utilities; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Request/DeviceRequestModels.cs b/src/Api/Models/Request/DeviceRequestModels.cs index 252847657..371f159eb 100644 --- a/src/Api/Models/Request/DeviceRequestModels.cs +++ b/src/Api/Models/Request/DeviceRequestModels.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Request { diff --git a/src/Api/Models/Request/EmergencyAccessRequstModels.cs b/src/Api/Models/Request/EmergencyAccessRequstModels.cs index c76f41d03..a8e9f07a0 100644 --- a/src/Api/Models/Request/EmergencyAccessRequstModels.cs +++ b/src/Api/Models/Request/EmergencyAccessRequstModels.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Request/FolderRequestModel.cs b/src/Api/Models/Request/FolderRequestModel.cs index ba1eb8f45..e3060bdcc 100644 --- a/src/Api/Models/Request/FolderRequestModel.cs +++ b/src/Api/Models/Request/FolderRequestModel.cs @@ -1,6 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Utilities; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Request/GroupRequestModel.cs b/src/Api/Models/Request/GroupRequestModel.cs index 8ddd4f617..2c6eb5c80 100644 --- a/src/Api/Models/Request/GroupRequestModel.cs +++ b/src/Api/Models/Request/GroupRequestModel.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Api.Models.Request { diff --git a/src/Api/Models/Request/InstallationRequestModel.cs b/src/Api/Models/Request/InstallationRequestModel.cs index 976224f07..9f594f7bb 100644 --- a/src/Api/Models/Request/InstallationRequestModel.cs +++ b/src/Api/Models/Request/InstallationRequestModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Utilities; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Request/Organizations/ImportOrganizationUsersRequestModel.cs b/src/Api/Models/Request/Organizations/ImportOrganizationUsersRequestModel.cs index 5515ea2d3..73fd884dc 100644 --- a/src/Api/Models/Request/Organizations/ImportOrganizationUsersRequestModel.cs +++ b/src/Api/Models/Request/Organizations/ImportOrganizationUsersRequestModel.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Bit.Core.Models.Business; -using Table = Bit.Core.Models.Table; namespace Bit.Api.Models.Request.Organizations { @@ -27,7 +26,7 @@ namespace Bit.Api.Models.Request.Organizations { var importedGroup = new ImportedGroup { - Group = new Table.Group + Group = new Core.Entities.Group { OrganizationId = organizationId, Name = Name, diff --git a/src/Api/Models/Request/Organizations/OrganizationCreateRequestModel.cs b/src/Api/Models/Request/Organizations/OrganizationCreateRequestModel.cs index c1018d277..8cd0c2514 100644 --- a/src/Api/Models/Request/Organizations/OrganizationCreateRequestModel.cs +++ b/src/Api/Models/Request/Organizations/OrganizationCreateRequestModel.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Request.Organizations diff --git a/src/Api/Models/Request/Organizations/OrganizationKeysRequestModel.cs b/src/Api/Models/Request/Organizations/OrganizationKeysRequestModel.cs index 4c4f712be..070b03d19 100644 --- a/src/Api/Models/Request/Organizations/OrganizationKeysRequestModel.cs +++ b/src/Api/Models/Request/Organizations/OrganizationKeysRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Request.Organizations { diff --git a/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs b/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs index d63c1d8d7..77d8b0e34 100644 --- a/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs +++ b/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs @@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text.RegularExpressions; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Sso; using Microsoft.AspNetCore.Authentication.OpenIdConnect; diff --git a/src/Api/Models/Request/Organizations/OrganizationUpdateRequestModel.cs b/src/Api/Models/Request/Organizations/OrganizationUpdateRequestModel.cs index b39bf60d3..24cce9710 100644 --- a/src/Api/Models/Request/Organizations/OrganizationUpdateRequestModel.cs +++ b/src/Api/Models/Request/Organizations/OrganizationUpdateRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Api.Models.Request.Organizations diff --git a/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs b/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs index 24aa5a52c..afa39a120 100644 --- a/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs +++ b/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Request.Organizations diff --git a/src/Api/Models/Request/PolicyRequestModel.cs b/src/Api/Models/Request/PolicyRequestModel.cs index c61ad1aa0..fe3a084bb 100644 --- a/src/Api/Models/Request/PolicyRequestModel.cs +++ b/src/Api/Models/Request/PolicyRequestModel.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text.Json; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Request { diff --git a/src/Api/Models/Request/Providers/ProviderSetupRequestModel.cs b/src/Api/Models/Request/Providers/ProviderSetupRequestModel.cs index e02c90e6a..f0b5fffe9 100644 --- a/src/Api/Models/Request/Providers/ProviderSetupRequestModel.cs +++ b/src/Api/Models/Request/Providers/ProviderSetupRequestModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Entities.Provider; namespace Bit.Api.Models.Request.Providers { diff --git a/src/Api/Models/Request/Providers/ProviderUpdateRequestModel.cs b/src/Api/Models/Request/Providers/ProviderUpdateRequestModel.cs index b2a57a34f..339ac3180 100644 --- a/src/Api/Models/Request/Providers/ProviderUpdateRequestModel.cs +++ b/src/Api/Models/Request/Providers/ProviderUpdateRequestModel.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Entities.Provider; using Bit.Core.Settings; namespace Bit.Api.Models.Request.Providers diff --git a/src/Api/Models/Request/Providers/ProviderUserRequestModels.cs b/src/Api/Models/Request/Providers/ProviderUserRequestModels.cs index 52755330f..923b0680e 100644 --- a/src/Api/Models/Request/Providers/ProviderUserRequestModels.cs +++ b/src/Api/Models/Request/Providers/ProviderUserRequestModels.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; -using Bit.Core.Models.Table.Provider; using Bit.Core.Utilities; namespace Bit.Api.Models.Request.Providers diff --git a/src/Api/Models/Request/SendRequestModel.cs b/src/Api/Models/Request/SendRequestModel.cs index 54ced1bac..924c4b097 100644 --- a/src/Api/Models/Request/SendRequestModel.cs +++ b/src/Api/Models/Request/SendRequestModel.cs @@ -1,9 +1,9 @@ using System; using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Utilities; using Newtonsoft.Json; diff --git a/src/Api/Models/Request/TwoFactorRequestModels.cs b/src/Api/Models/Request/TwoFactorRequestModels.cs index 3dd781601..8bf1c3f3f 100644 --- a/src/Api/Models/Request/TwoFactorRequestModels.cs +++ b/src/Api/Models/Request/TwoFactorRequestModels.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Bit.Api.Models.Request.Accounts; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Fido2NetLib; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Request/UpdateDomainsRequestModel.cs b/src/Api/Models/Request/UpdateDomainsRequestModel.cs index 6cf78b1c3..9ba4334fa 100644 --- a/src/Api/Models/Request/UpdateDomainsRequestModel.cs +++ b/src/Api/Models/Request/UpdateDomainsRequestModel.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Newtonsoft.Json; namespace Bit.Api.Models.Request diff --git a/src/Api/Models/Response/ApiKeyResponseModel.cs b/src/Api/Models/Response/ApiKeyResponseModel.cs index ce500eb49..4bae0882c 100644 --- a/src/Api/Models/Response/ApiKeyResponseModel.cs +++ b/src/Api/Models/Response/ApiKeyResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/AttachmentResponseModel.cs b/src/Api/Models/Response/AttachmentResponseModel.cs index ef601c341..dcb5e041d 100644 --- a/src/Api/Models/Response/AttachmentResponseModel.cs +++ b/src/Api/Models/Response/AttachmentResponseModel.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Api/Models/Response/CipherResponseModel.cs b/src/Api/Models/Response/CipherResponseModel.cs index 8884e091b..0ef56da66 100644 --- a/src/Api/Models/Response/CipherResponseModel.cs +++ b/src/Api/Models/Response/CipherResponseModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Core.Models.Data; using Newtonsoft.Json; diff --git a/src/Api/Models/Response/CollectionResponseModel.cs b/src/Api/Models/Response/CollectionResponseModel.cs index f9e41ad07..c3809cb1d 100644 --- a/src/Api/Models/Response/CollectionResponseModel.cs +++ b/src/Api/Models/Response/CollectionResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/DeviceResponseModel.cs b/src/Api/Models/Response/DeviceResponseModel.cs index c72437012..acf4b846f 100644 --- a/src/Api/Models/Response/DeviceResponseModel.cs +++ b/src/Api/Models/Response/DeviceResponseModel.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/DomainsResponseModel.cs b/src/Api/Models/Response/DomainsResponseModel.cs index 7c1746f4f..73f7c18e3 100644 --- a/src/Api/Models/Response/DomainsResponseModel.cs +++ b/src/Api/Models/Response/DomainsResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using Newtonsoft.Json; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/EmergencyAccessResponseModel.cs b/src/Api/Models/Response/EmergencyAccessResponseModel.cs index d20ed2382..61a7260ad 100644 --- a/src/Api/Models/Response/EmergencyAccessResponseModel.cs +++ b/src/Api/Models/Response/EmergencyAccessResponseModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Core.Models.Data; diff --git a/src/Api/Models/Response/FolderResponseModel.cs b/src/Api/Models/Response/FolderResponseModel.cs index 0c129a338..2f780ec1d 100644 --- a/src/Api/Models/Response/FolderResponseModel.cs +++ b/src/Api/Models/Response/FolderResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/GroupResponseModel.cs b/src/Api/Models/Response/GroupResponseModel.cs index 4db9339d3..9bede72e4 100644 --- a/src/Api/Models/Response/GroupResponseModel.cs +++ b/src/Api/Models/Response/GroupResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/InstallationResponseModel.cs b/src/Api/Models/Response/InstallationResponseModel.cs index 6ffdade3c..68e1524b1 100644 --- a/src/Api/Models/Response/InstallationResponseModel.cs +++ b/src/Api/Models/Response/InstallationResponseModel.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Api; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Models.Api; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/KeysResponseModel.cs b/src/Api/Models/Response/KeysResponseModel.cs index 75277eb23..32c2e2353 100644 --- a/src/Api/Models/Response/KeysResponseModel.cs +++ b/src/Api/Models/Response/KeysResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/OrganizationKeysResponseModel.cs b/src/Api/Models/Response/OrganizationKeysResponseModel.cs index c8c1529e1..e0f8a738e 100644 --- a/src/Api/Models/Response/OrganizationKeysResponseModel.cs +++ b/src/Api/Models/Response/OrganizationKeysResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/OrganizationResponseModel.cs b/src/Api/Models/Response/OrganizationResponseModel.cs index dd3877e55..f2576b806 100644 --- a/src/Api/Models/Response/OrganizationResponseModel.cs +++ b/src/Api/Models/Response/OrganizationResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/OrganizationSsoResponseModel.cs b/src/Api/Models/Response/OrganizationSsoResponseModel.cs index 91f1f3cf6..0c9e8127f 100644 --- a/src/Api/Models/Response/OrganizationSsoResponseModel.cs +++ b/src/Api/Models/Response/OrganizationSsoResponseModel.cs @@ -1,6 +1,6 @@ -using Bit.Core.Models.Api; +using Bit.Core.Entities; +using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/OrganizationUserResponseModel.cs b/src/Api/Models/Response/OrganizationUserResponseModel.cs index a46acc85a..03ad0a817 100644 --- a/src/Api/Models/Response/OrganizationUserResponseModel.cs +++ b/src/Api/Models/Response/OrganizationUserResponseModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/PolicyResponseModel.cs b/src/Api/Models/Response/PolicyResponseModel.cs index 4a840ec5a..f28bef85d 100644 --- a/src/Api/Models/Response/PolicyResponseModel.cs +++ b/src/Api/Models/Response/PolicyResponseModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using Newtonsoft.Json; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/ProfileResponseModel.cs b/src/Api/Models/Response/ProfileResponseModel.cs index 45810d037..96da68789 100644 --- a/src/Api/Models/Response/ProfileResponseModel.cs +++ b/src/Api/Models/Response/ProfileResponseModel.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using Bit.Api.Models.Response.Providers; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/Providers/ProviderOrganizationResponseModel.cs b/src/Api/Models/Response/Providers/ProviderOrganizationResponseModel.cs index acfd7a3a0..29412186c 100644 --- a/src/Api/Models/Response/Providers/ProviderOrganizationResponseModel.cs +++ b/src/Api/Models/Response/Providers/ProviderOrganizationResponseModel.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Api.Models.Response.Providers { diff --git a/src/Api/Models/Response/Providers/ProviderResponseModel.cs b/src/Api/Models/Response/Providers/ProviderResponseModel.cs index 73ebafc5a..f4fabd214 100644 --- a/src/Api/Models/Response/Providers/ProviderResponseModel.cs +++ b/src/Api/Models/Response/Providers/ProviderResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Api; -using Bit.Core.Models.Table.Provider; namespace Bit.Api.Models.Response.Providers { diff --git a/src/Api/Models/Response/Providers/ProviderUserResponseModel.cs b/src/Api/Models/Response/Providers/ProviderUserResponseModel.cs index 775f1587b..b50196678 100644 --- a/src/Api/Models/Response/Providers/ProviderUserResponseModel.cs +++ b/src/Api/Models/Response/Providers/ProviderUserResponseModel.cs @@ -1,8 +1,8 @@ using System; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; using Bit.Core.Utilities; namespace Bit.Api.Models.Response.Providers diff --git a/src/Api/Models/Response/SendAccessResponseModel.cs b/src/Api/Models/Response/SendAccessResponseModel.cs index 7c39abde3..569029800 100644 --- a/src/Api/Models/Response/SendAccessResponseModel.cs +++ b/src/Api/Models/Response/SendAccessResponseModel.cs @@ -1,8 +1,8 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; using Newtonsoft.Json; diff --git a/src/Api/Models/Response/SendResponseModel.cs b/src/Api/Models/Response/SendResponseModel.cs index cdfcaf6db..f11e3dd34 100644 --- a/src/Api/Models/Response/SendResponseModel.cs +++ b/src/Api/Models/Response/SendResponseModel.cs @@ -1,8 +1,8 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; using Newtonsoft.Json; diff --git a/src/Api/Models/Response/SubscriptionResponseModel.cs b/src/Api/Models/Response/SubscriptionResponseModel.cs index 054e929a0..c1e8810d7 100644 --- a/src/Api/Models/Response/SubscriptionResponseModel.cs +++ b/src/Api/Models/Response/SubscriptionResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Api.Models.Response diff --git a/src/Api/Models/Response/SyncResponseModel.cs b/src/Api/Models/Response/SyncResponseModel.cs index 616fbe2c3..a30736f35 100644 --- a/src/Api/Models/Response/SyncResponseModel.cs +++ b/src/Api/Models/Response/SyncResponseModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Core.Models.Data; diff --git a/src/Api/Models/Response/TaxRateResponseModel.cs b/src/Api/Models/Response/TaxRateResponseModel.cs index 9270b66b8..5d4dfdb16 100644 --- a/src/Api/Models/Response/TaxRateResponseModel.cs +++ b/src/Api/Models/Response/TaxRateResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs index 1243a1c17..13006c432 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using OtpNet; namespace Bit.Api.Models.Response.TwoFactor diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs index 1a5938afd..98c366a71 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs @@ -1,8 +1,8 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs index 52fa90be4..93bbe9e62 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs index fb509b370..4213fb9b2 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs @@ -1,8 +1,8 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs index 3fc75450f..6bff37b12 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs index 67bc354bf..f214955d3 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs b/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs index 620574be3..25b5d55c7 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs +++ b/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; namespace Bit.Api.Models.Response.TwoFactor { diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index a050b76e6..195306407 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -17,6 +17,7 @@ using Microsoft.IdentityModel.Logging; using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using System.Collections.Generic; +using Bit.SharedWeb.Utilities; #if !OSS using Bit.CommCore.Utilities; diff --git a/src/Billing/Billing.csproj b/src/Billing/Billing.csproj index 7dd230548..d5b7022fa 100644 --- a/src/Billing/Billing.csproj +++ b/src/Billing/Billing.csproj @@ -6,6 +6,7 @@ + diff --git a/src/Billing/Controllers/BitPayController.cs b/src/Billing/Controllers/BitPayController.cs index 7bf56d019..08d086735 100644 --- a/src/Billing/Controllers/BitPayController.cs +++ b/src/Billing/Controllers/BitPayController.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; using Bit.Billing.Models; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.Services; @@ -109,7 +110,7 @@ namespace Bit.Billing.Controllers try { - var tx = new Core.Models.Table.Transaction + var tx = new Transaction { Amount = Convert.ToDecimal(invoice.Price), CreationDate = GetTransactionDate(invoice), diff --git a/src/Billing/Controllers/PayPalController.cs b/src/Billing/Controllers/PayPalController.cs index 861e4db99..a8f8a694e 100644 --- a/src/Billing/Controllers/PayPalController.cs +++ b/src/Billing/Controllers/PayPalController.cs @@ -3,8 +3,8 @@ using System.IO; using System.Text; using System.Threading.Tasks; using Bit.Billing.Utilities; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/src/Billing/Controllers/StripeController.cs b/src/Billing/Controllers/StripeController.cs index 7f77d7f6b..07a11f716 100644 --- a/src/Billing/Controllers/StripeController.cs +++ b/src/Billing/Controllers/StripeController.cs @@ -4,9 +4,9 @@ using System.Data.SqlClient; using System.IO; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; @@ -17,6 +17,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Stripe; +using TaxRate = Bit.Core.Entities.TaxRate; namespace Bit.Billing.Controllers { @@ -773,7 +774,7 @@ namespace Bit.Billing.Controllers if (!string.IsNullOrWhiteSpace(invoice?.CustomerAddress?.Country) && !string.IsNullOrWhiteSpace(invoice?.CustomerAddress?.PostalCode)) { var localBitwardenTaxRates = await _taxRateRepository.GetByLocationAsync( - new Bit.Core.Models.Table.TaxRate() + new TaxRate() { Country = invoice.CustomerAddress.Country, PostalCode = invoice.CustomerAddress.PostalCode diff --git a/src/Billing/Startup.cs b/src/Billing/Startup.cs index 87c54e52d..28f17ef8c 100644 --- a/src/Billing/Startup.cs +++ b/src/Billing/Startup.cs @@ -3,6 +3,7 @@ using System.Globalization; using Bit.Core.Context; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; diff --git a/src/Core/Context/CurrentContentOrganization.cs b/src/Core/Context/CurrentContentOrganization.cs index 425a0a524..b915408ff 100644 --- a/src/Core/Context/CurrentContentOrganization.cs +++ b/src/Core/Context/CurrentContentOrganization.cs @@ -1,7 +1,7 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Utilities; namespace Bit.Core.Context diff --git a/src/Core/Context/CurrentContentProvider.cs b/src/Core/Context/CurrentContentProvider.cs index 20f9bb898..2b4998ed7 100644 --- a/src/Core/Context/CurrentContentProvider.cs +++ b/src/Core/Context/CurrentContentProvider.cs @@ -1,9 +1,8 @@ using System; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Utilities; namespace Bit.Core.Context diff --git a/src/Core/Context/CurrentContext.cs b/src/Core/Context/CurrentContext.cs index 4aa75a4f3..0eac65f9e 100644 --- a/src/Core/Context/CurrentContext.cs +++ b/src/Core/Context/CurrentContext.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Context/ICurrentContext.cs b/src/Core/Context/ICurrentContext.cs index 1e18128ab..ff06ced15 100644 --- a/src/Core/Context/ICurrentContext.cs +++ b/src/Core/Context/ICurrentContext.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index 2d5817788..b70d79092 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -19,7 +19,6 @@ - @@ -29,25 +28,21 @@ - - + - - - @@ -58,7 +53,6 @@ - diff --git a/src/Core/Models/Table/Cipher.cs b/src/Core/Entities/Cipher.cs similarity index 92% rename from src/Core/Models/Table/Cipher.cs rename to src/Core/Entities/Cipher.cs index 34efec508..ac0d96e89 100644 --- a/src/Core/Models/Table/Cipher.cs +++ b/src/Core/Entities/Cipher.cs @@ -4,7 +4,7 @@ using Bit.Core.Models.Data; using Bit.Core.Utilities; using Newtonsoft.Json; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Cipher : ITableObject, ICloneable { @@ -18,9 +18,9 @@ namespace Bit.Core.Models.Table public string Favorites { get; set; } public string Folders { get; set; } public string Attachments { get; set; } - public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; - public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; - public DateTime? DeletedDate { get; internal set; } + public DateTime CreationDate { get; set; } = DateTime.UtcNow; + public DateTime RevisionDate { get; set; } = DateTime.UtcNow; + public DateTime? DeletedDate { get; set; } public Enums.CipherRepromptType? Reprompt { get; set; } public void SetNewId() diff --git a/src/Core/Models/Table/Collection.cs b/src/Core/Entities/Collection.cs similarity index 70% rename from src/Core/Models/Table/Collection.cs rename to src/Core/Entities/Collection.cs index 85cb28738..e955468d3 100644 --- a/src/Core/Models/Table/Collection.cs +++ b/src/Core/Entities/Collection.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Collection : ITableObject { @@ -11,8 +11,8 @@ namespace Bit.Core.Models.Table public string Name { get; set; } [MaxLength(300)] public string ExternalId { get; set; } - public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; - public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; + public DateTime CreationDate { get; set; } = DateTime.UtcNow; + public DateTime RevisionDate { get; set; } = DateTime.UtcNow; public void SetNewId() { diff --git a/src/Core/Models/Table/CollectionCipher.cs b/src/Core/Entities/CollectionCipher.cs similarity index 83% rename from src/Core/Models/Table/CollectionCipher.cs rename to src/Core/Entities/CollectionCipher.cs index 7109bdeac..16ba2297e 100644 --- a/src/Core/Models/Table/CollectionCipher.cs +++ b/src/Core/Entities/CollectionCipher.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class CollectionCipher { diff --git a/src/Core/Models/Table/CollectionGroup.cs b/src/Core/Entities/CollectionGroup.cs similarity index 80% rename from src/Core/Models/Table/CollectionGroup.cs rename to src/Core/Entities/CollectionGroup.cs index 4a34e39a4..fa3427f82 100644 --- a/src/Core/Models/Table/CollectionGroup.cs +++ b/src/Core/Entities/CollectionGroup.cs @@ -1,7 +1,6 @@ using System; -using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class CollectionGroup { diff --git a/src/Core/Models/Table/CollectionUser.cs b/src/Core/Entities/CollectionUser.cs similarity index 81% rename from src/Core/Models/Table/CollectionUser.cs rename to src/Core/Entities/CollectionUser.cs index 153b130f7..195fd5228 100644 --- a/src/Core/Models/Table/CollectionUser.cs +++ b/src/Core/Entities/CollectionUser.cs @@ -1,7 +1,6 @@ using System; -using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class CollectionUser { diff --git a/src/Core/Models/Table/Device.cs b/src/Core/Entities/Device.cs similarity index 95% rename from src/Core/Models/Table/Device.cs rename to src/Core/Entities/Device.cs index b4e740e5b..b5c48a131 100644 --- a/src/Core/Models/Table/Device.cs +++ b/src/Core/Entities/Device.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Device : ITableObject { diff --git a/src/Core/Models/Table/EmergencyAccess.cs b/src/Core/Entities/EmergencyAccess.cs similarity index 80% rename from src/Core/Models/Table/EmergencyAccess.cs rename to src/Core/Entities/EmergencyAccess.cs index b14729184..7d6f650dc 100644 --- a/src/Core/Models/Table/EmergencyAccess.cs +++ b/src/Core/Entities/EmergencyAccess.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class EmergencyAccess : ITableObject { @@ -16,10 +16,10 @@ namespace Bit.Core.Models.Table public EmergencyAccessType Type { get; set; } public EmergencyAccessStatusType Status { get; set; } public int WaitTimeDays { get; set; } - public DateTime? RecoveryInitiatedDate { get; internal set; } - public DateTime? LastNotificationDate { get; internal set; } - public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; - public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; + public DateTime? RecoveryInitiatedDate { get; set; } + public DateTime? LastNotificationDate { get; set; } + public DateTime CreationDate { get; set; } = DateTime.UtcNow; + public DateTime RevisionDate { get; set; } = DateTime.UtcNow; public void SetNewId() { diff --git a/src/Core/Models/Table/Event.cs b/src/Core/Entities/Event.cs similarity index 98% rename from src/Core/Models/Table/Event.cs rename to src/Core/Entities/Event.cs index ba02dbfcc..8c0dc02a4 100644 --- a/src/Core/Models/Table/Event.cs +++ b/src/Core/Entities/Event.cs @@ -4,7 +4,7 @@ using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Event : ITableObject, IEvent { diff --git a/src/Core/Models/Table/Folder.cs b/src/Core/Entities/Folder.cs similarity index 93% rename from src/Core/Models/Table/Folder.cs rename to src/Core/Entities/Folder.cs index ec20cc3ec..3fcce1aab 100644 --- a/src/Core/Models/Table/Folder.cs +++ b/src/Core/Entities/Folder.cs @@ -1,7 +1,7 @@ using System; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Folder : ITableObject { diff --git a/src/Core/Models/Table/Grant.cs b/src/Core/Entities/Grant.cs similarity index 95% rename from src/Core/Models/Table/Grant.cs rename to src/Core/Entities/Grant.cs index e8b052d11..ed20b336f 100644 --- a/src/Core/Models/Table/Grant.cs +++ b/src/Core/Entities/Grant.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Grant { diff --git a/src/Core/Models/Table/Group.cs b/src/Core/Entities/Group.cs similarity index 93% rename from src/Core/Models/Table/Group.cs rename to src/Core/Entities/Group.cs index d73274688..5f8eb3bad 100644 --- a/src/Core/Models/Table/Group.cs +++ b/src/Core/Entities/Group.cs @@ -1,8 +1,9 @@ using System; using System.ComponentModel.DataAnnotations; +using Bit.Core.Models; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Group : ITableObject, IExternal { diff --git a/src/Core/Models/Table/GroupUser.cs b/src/Core/Entities/GroupUser.cs similarity index 72% rename from src/Core/Models/Table/GroupUser.cs rename to src/Core/Entities/GroupUser.cs index 524fedd36..07e3fbde2 100644 --- a/src/Core/Models/Table/GroupUser.cs +++ b/src/Core/Entities/GroupUser.cs @@ -1,7 +1,6 @@ using System; -using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class GroupUser { diff --git a/src/Core/Models/Table/IReferenceable.cs b/src/Core/Entities/IReferenceable.cs similarity index 85% rename from src/Core/Models/Table/IReferenceable.cs rename to src/Core/Entities/IReferenceable.cs index d207a7a7b..562f686ef 100644 --- a/src/Core/Models/Table/IReferenceable.cs +++ b/src/Core/Entities/IReferenceable.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.Core.Models +namespace Bit.Core.Entities { public interface IReferenceable { diff --git a/src/Core/Models/Table/IRevisable.cs b/src/Core/Entities/IRevisable.cs similarity index 81% rename from src/Core/Models/Table/IRevisable.cs rename to src/Core/Entities/IRevisable.cs index 5d2b811d6..ca29146f0 100644 --- a/src/Core/Models/Table/IRevisable.cs +++ b/src/Core/Entities/IRevisable.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public interface IRevisable { diff --git a/src/Core/Models/Table/IStorable.cs b/src/Core/Entities/IStorable.cs similarity index 86% rename from src/Core/Models/Table/IStorable.cs rename to src/Core/Entities/IStorable.cs index a65e1ef01..67c16098f 100644 --- a/src/Core/Models/Table/IStorable.cs +++ b/src/Core/Entities/IStorable.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public interface IStorable { diff --git a/src/Core/Models/Table/IStorableSubscriber.cs b/src/Core/Entities/IStorableSubscriber.cs similarity index 69% rename from src/Core/Models/Table/IStorableSubscriber.cs rename to src/Core/Entities/IStorableSubscriber.cs index 87f4267a3..e37966dea 100644 --- a/src/Core/Models/Table/IStorableSubscriber.cs +++ b/src/Core/Entities/IStorableSubscriber.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public interface IStorableSubscriber : IStorable, ISubscriber { } diff --git a/src/Core/Models/Table/ISubscriber.cs b/src/Core/Entities/ISubscriber.cs similarity index 88% rename from src/Core/Models/Table/ISubscriber.cs rename to src/Core/Entities/ISubscriber.cs index cd611a348..232b7978f 100644 --- a/src/Core/Models/Table/ISubscriber.cs +++ b/src/Core/Entities/ISubscriber.cs @@ -1,8 +1,7 @@ using System; using Bit.Core.Enums; -using Bit.Core.Services; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public interface ISubscriber { diff --git a/src/Core/Models/Table/ITableObject.cs b/src/Core/Entities/ITableObject.cs similarity index 82% rename from src/Core/Models/Table/ITableObject.cs rename to src/Core/Entities/ITableObject.cs index 8fb6a4194..7c86e4abe 100644 --- a/src/Core/Models/Table/ITableObject.cs +++ b/src/Core/Entities/ITableObject.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public interface ITableObject where T : IEquatable { diff --git a/src/Core/Models/Table/Installation.cs b/src/Core/Entities/Installation.cs similarity index 94% rename from src/Core/Models/Table/Installation.cs rename to src/Core/Entities/Installation.cs index 8d8140438..c0f056e50 100644 --- a/src/Core/Models/Table/Installation.cs +++ b/src/Core/Entities/Installation.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Installation : ITableObject { diff --git a/src/Core/Models/Table/Organization.cs b/src/Core/Entities/Organization.cs similarity index 97% rename from src/Core/Models/Table/Organization.cs rename to src/Core/Entities/Organization.cs index fb5870236..7366fb91c 100644 --- a/src/Core/Models/Table/Organization.cs +++ b/src/Core/Entities/Organization.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using Bit.Core.Enums; +using Bit.Core.Models; using Bit.Core.Utilities; using Newtonsoft.Json; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Organization : ITableObject, ISubscriber, IStorable, IStorableSubscriber, IRevisable, IReferenceable { @@ -65,8 +66,8 @@ namespace Bit.Core.Models.Table public string PrivateKey { get; set; } public string TwoFactorProviders { get; set; } public DateTime? ExpirationDate { get; set; } - public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; - public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; + public DateTime CreationDate { get; set; } = DateTime.UtcNow; + public DateTime RevisionDate { get; set; } = DateTime.UtcNow; public int? MaxAutoscaleSeats { get; set; } = null; public DateTime? OwnersNotifiedOfAutoscaling { get; set; } = null; diff --git a/src/Core/Models/Table/OrganizationSponsorship.cs b/src/Core/Entities/OrganizationSponsorship.cs similarity index 96% rename from src/Core/Models/Table/OrganizationSponsorship.cs rename to src/Core/Entities/OrganizationSponsorship.cs index 4acb7eb88..2dc67fba7 100644 --- a/src/Core/Models/Table/OrganizationSponsorship.cs +++ b/src/Core/Entities/OrganizationSponsorship.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class OrganizationSponsorship : ITableObject { diff --git a/src/Core/Models/Table/OrganizationUser.cs b/src/Core/Entities/OrganizationUser.cs similarity index 95% rename from src/Core/Models/Table/OrganizationUser.cs rename to src/Core/Entities/OrganizationUser.cs index 9019adeb3..4034ca5a7 100644 --- a/src/Core/Models/Table/OrganizationUser.cs +++ b/src/Core/Entities/OrganizationUser.cs @@ -1,9 +1,10 @@ using System; using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; +using Bit.Core.Models; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class OrganizationUser : ITableObject, IExternal { diff --git a/src/Core/Models/Table/Policy.cs b/src/Core/Entities/Policy.cs similarity index 94% rename from src/Core/Models/Table/Policy.cs rename to src/Core/Entities/Policy.cs index 07c44b6aa..fbd65c634 100644 --- a/src/Core/Models/Table/Policy.cs +++ b/src/Core/Entities/Policy.cs @@ -2,7 +2,7 @@ using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Policy : ITableObject { diff --git a/src/Core/Models/Table/Provider/Provider.cs b/src/Core/Entities/Provider/Provider.cs similarity index 96% rename from src/Core/Models/Table/Provider/Provider.cs rename to src/Core/Entities/Provider/Provider.cs index 439156ca0..a9848bfd5 100644 --- a/src/Core/Models/Table/Provider/Provider.cs +++ b/src/Core/Entities/Provider/Provider.cs @@ -2,7 +2,7 @@ using Bit.Core.Enums.Provider; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table.Provider +namespace Bit.Core.Entities.Provider { public class Provider : ITableObject { diff --git a/src/Core/Models/Table/Provider/ProviderOrganization.cs b/src/Core/Entities/Provider/ProviderOrganization.cs similarity index 94% rename from src/Core/Models/Table/Provider/ProviderOrganization.cs rename to src/Core/Entities/Provider/ProviderOrganization.cs index 7e0a15afd..5d93df221 100644 --- a/src/Core/Models/Table/Provider/ProviderOrganization.cs +++ b/src/Core/Entities/Provider/ProviderOrganization.cs @@ -1,7 +1,7 @@ using System; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table.Provider +namespace Bit.Core.Entities.Provider { public class ProviderOrganization : ITableObject { diff --git a/src/Core/Models/Table/Provider/ProviderUser.cs b/src/Core/Entities/Provider/ProviderUser.cs similarity index 95% rename from src/Core/Models/Table/Provider/ProviderUser.cs rename to src/Core/Entities/Provider/ProviderUser.cs index 58b95146c..61002f000 100644 --- a/src/Core/Models/Table/Provider/ProviderUser.cs +++ b/src/Core/Entities/Provider/ProviderUser.cs @@ -2,7 +2,7 @@ using Bit.Core.Enums.Provider; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table.Provider +namespace Bit.Core.Entities.Provider { public class ProviderUser : ITableObject { diff --git a/src/Core/Models/Table/Role.cs b/src/Core/Entities/Role.cs similarity index 85% rename from src/Core/Models/Table/Role.cs rename to src/Core/Entities/Role.cs index cfbde2e38..2acdb1c65 100644 --- a/src/Core/Models/Table/Role.cs +++ b/src/Core/Entities/Role.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { /// /// This class is not used. It is implemented to make the Identity provider happy. diff --git a/src/Core/Models/Table/Send.cs b/src/Core/Entities/Send.cs similarity index 97% rename from src/Core/Models/Table/Send.cs rename to src/Core/Entities/Send.cs index 36607d965..c921eb486 100644 --- a/src/Core/Models/Table/Send.cs +++ b/src/Core/Entities/Send.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Send : ITableObject { diff --git a/src/Core/Models/Table/SsoConfig.cs b/src/Core/Entities/SsoConfig.cs similarity index 96% rename from src/Core/Models/Table/SsoConfig.cs rename to src/Core/Entities/SsoConfig.cs index 4cd1d7155..4b3bf7d7e 100644 --- a/src/Core/Models/Table/SsoConfig.cs +++ b/src/Core/Entities/SsoConfig.cs @@ -1,7 +1,7 @@ using System; using Bit.Core.Models.Data; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class SsoConfig : ITableObject { diff --git a/src/Core/Models/Table/SsoUser.cs b/src/Core/Entities/SsoUser.cs similarity index 94% rename from src/Core/Models/Table/SsoUser.cs rename to src/Core/Entities/SsoUser.cs index 6c7cd6257..f02d02727 100644 --- a/src/Core/Models/Table/SsoUser.cs +++ b/src/Core/Entities/SsoUser.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class SsoUser : ITableObject { diff --git a/src/Core/Models/Table/TaxRate.cs b/src/Core/Entities/TaxRate.cs similarity index 95% rename from src/Core/Models/Table/TaxRate.cs rename to src/Core/Entities/TaxRate.cs index bed82d0df..bf53c8cf0 100644 --- a/src/Core/Models/Table/TaxRate.cs +++ b/src/Core/Entities/TaxRate.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class TaxRate : ITableObject { diff --git a/src/Core/Models/Table/Transaction.cs b/src/Core/Entities/Transaction.cs similarity index 96% rename from src/Core/Models/Table/Transaction.cs rename to src/Core/Entities/Transaction.cs index 0f5e80e45..68d416c52 100644 --- a/src/Core/Models/Table/Transaction.cs +++ b/src/Core/Entities/Transaction.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class Transaction : ITableObject { diff --git a/src/Core/Models/Table/U2f.cs b/src/Core/Entities/U2f.cs similarity index 95% rename from src/Core/Models/Table/U2f.cs rename to src/Core/Entities/U2f.cs index 5d089daca..3e8a187e6 100644 --- a/src/Core/Models/Table/U2f.cs +++ b/src/Core/Entities/U2f.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class U2f : ITableObject { diff --git a/src/Core/Models/Table/User.cs b/src/Core/Entities/User.cs similarity index 95% rename from src/Core/Models/Table/User.cs rename to src/Core/Entities/User.cs index beb290dec..f80948909 100644 --- a/src/Core/Models/Table/User.cs +++ b/src/Core/Entities/User.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Bit.Core.Enums; +using Bit.Core.Models; using Bit.Core.Utilities; using Microsoft.AspNetCore.Identity; using Newtonsoft.Json; -namespace Bit.Core.Models.Table +namespace Bit.Core.Entities { public class User : ITableObject, ISubscriber, IStorable, IStorableSubscriber, IRevisable, ITwoFactorProvidersUser, IReferenceable { @@ -33,7 +34,7 @@ namespace Bit.Core.Models.Table public string TwoFactorRecoveryCode { get; set; } public string EquivalentDomains { get; set; } public string ExcludedGlobalEquivalentDomains { get; set; } - public DateTime AccountRevisionDate { get; internal set; } = DateTime.UtcNow; + public DateTime AccountRevisionDate { get; set; } = DateTime.UtcNow; public string Key { get; set; } public string PublicKey { get; set; } public string PrivateKey { get; set; } @@ -55,8 +56,8 @@ namespace Bit.Core.Models.Table public string ApiKey { get; set; } public KdfType Kdf { get; set; } = KdfType.PBKDF2_SHA256; public int KdfIterations { get; set; } = 5000; - public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; - public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; + public DateTime CreationDate { get; set; } = DateTime.UtcNow; + public DateTime RevisionDate { get; set; } = DateTime.UtcNow; public bool ForcePasswordReset { get; set; } public bool UsesKeyConnector { get; set; } diff --git a/src/Core/Identity/AuthenticatorTokenProvider.cs b/src/Core/Identity/AuthenticatorTokenProvider.cs index bfb6e117b..cd5e75d95 100644 --- a/src/Core/Identity/AuthenticatorTokenProvider.cs +++ b/src/Core/Identity/AuthenticatorTokenProvider.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Services; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Core/Identity/DuoWebTokenProvider.cs b/src/Core/Identity/DuoWebTokenProvider.cs index 2ff6cfe1c..6f2a1d849 100644 --- a/src/Core/Identity/DuoWebTokenProvider.cs +++ b/src/Core/Identity/DuoWebTokenProvider.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities.Duo; diff --git a/src/Core/Identity/EmailTokenProvider.cs b/src/Core/Identity/EmailTokenProvider.cs index 47d19e36f..c0a2270b3 100644 --- a/src/Core/Identity/EmailTokenProvider.cs +++ b/src/Core/Identity/EmailTokenProvider.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Services; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs b/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs index cda8c2ede..57e366bc4 100644 --- a/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs +++ b/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Identity { diff --git a/src/Core/Identity/OrganizationDuoWebTokenProvider.cs b/src/Core/Identity/OrganizationDuoWebTokenProvider.cs index 537fd62a5..2c18a959f 100644 --- a/src/Core/Identity/OrganizationDuoWebTokenProvider.cs +++ b/src/Core/Identity/OrganizationDuoWebTokenProvider.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities.Duo; diff --git a/src/Core/Identity/RoleStore.cs b/src/Core/Identity/RoleStore.cs index 28b0b5825..62ae46203 100644 --- a/src/Core/Identity/RoleStore.cs +++ b/src/Core/Identity/RoleStore.cs @@ -1,7 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Microsoft.AspNetCore.Identity; namespace Bit.Core.Identity diff --git a/src/Core/Identity/TwoFactorRememberTokenProvider.cs b/src/Core/Identity/TwoFactorRememberTokenProvider.cs index 4be07ab92..2902280ff 100644 --- a/src/Core/Identity/TwoFactorRememberTokenProvider.cs +++ b/src/Core/Identity/TwoFactorRememberTokenProvider.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/src/Core/Identity/U2fTokenProvider.cs b/src/Core/Identity/U2fTokenProvider.cs index 7fc97455e..613ab7a43 100644 --- a/src/Core/Identity/U2fTokenProvider.cs +++ b/src/Core/Identity/U2fTokenProvider.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Core/Identity/UserStore.cs b/src/Core/Identity/UserStore.cs index 45ddeec45..7a11ef95e 100644 --- a/src/Core/Identity/UserStore.cs +++ b/src/Core/Identity/UserStore.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; using Bit.Core.Context; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Core/Identity/WebAuthnTokenProvider.cs b/src/Core/Identity/WebAuthnTokenProvider.cs index 18e44a0f7..15b463a5c 100644 --- a/src/Core/Identity/WebAuthnTokenProvider.cs +++ b/src/Core/Identity/WebAuthnTokenProvider.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Identity/YubicoOtpTokenProvider.cs b/src/Core/Identity/YubicoOtpTokenProvider.cs index 009f9f942..f0ab573c4 100644 --- a/src/Core/Identity/YubicoOtpTokenProvider.cs +++ b/src/Core/Identity/YubicoOtpTokenProvider.cs @@ -1,8 +1,8 @@ using System; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Settings; using Microsoft.AspNetCore.Identity; diff --git a/src/Core/IdentityServer/BaseRequestValidator.cs b/src/Core/IdentityServer/BaseRequestValidator.cs index a48301958..e47df16b4 100644 --- a/src/Core/IdentityServer/BaseRequestValidator.cs +++ b/src/Core/IdentityServer/BaseRequestValidator.cs @@ -7,12 +7,12 @@ using System.Security.Claims; using System.Text.Json; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Identity; using Bit.Core.Models; using Bit.Core.Models.Api; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Core/IdentityServer/CustomTokenRequestValidator.cs b/src/Core/IdentityServer/CustomTokenRequestValidator.cs index ae7a74ff3..2fa6c71d9 100644 --- a/src/Core/IdentityServer/CustomTokenRequestValidator.cs +++ b/src/Core/IdentityServer/CustomTokenRequestValidator.cs @@ -5,9 +5,9 @@ using System.Security.Claims; using System.Text.Json; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Identity; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Core/IdentityServer/PersistedGrantStore.cs b/src/Core/IdentityServer/PersistedGrantStore.cs index 8365a995e..67a38f717 100644 --- a/src/Core/IdentityServer/PersistedGrantStore.cs +++ b/src/Core/IdentityServer/PersistedGrantStore.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Bit.Core.Repositories; using IdentityServer4.Models; using IdentityServer4.Stores; +using Grant = Bit.Core.Entities.Grant; namespace Bit.Core.IdentityServer { @@ -53,9 +54,9 @@ namespace Bit.Core.IdentityServer await _grantRepository.SaveAsync(grant); } - private Models.Table.Grant ToGrant(PersistedGrant pGrant) + private Grant ToGrant(PersistedGrant pGrant) { - return new Models.Table.Grant + return new Grant { Key = pGrant.Key, Type = pGrant.Type, @@ -70,7 +71,7 @@ namespace Bit.Core.IdentityServer }; } - private PersistedGrant ToPersistedGrant(Models.Table.Grant grant) + private PersistedGrant ToPersistedGrant(Grant grant) { return new PersistedGrant { diff --git a/src/Core/IdentityServer/ResourceOwnerPasswordValidator.cs b/src/Core/IdentityServer/ResourceOwnerPasswordValidator.cs index c28d353e1..7b30227a5 100644 --- a/src/Core/IdentityServer/ResourceOwnerPasswordValidator.cs +++ b/src/Core/IdentityServer/ResourceOwnerPasswordValidator.cs @@ -2,8 +2,8 @@ using System.Security.Claims; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Identity; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Core/Models/Business/AppleReceiptStatus.cs b/src/Core/Models/Business/AppleReceiptStatus.cs index 80a049d1c..df8be4a9b 100644 --- a/src/Core/Models/Business/AppleReceiptStatus.cs +++ b/src/Core/Models/Business/AppleReceiptStatus.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/src/Core/Models/Business/BillingInfo.cs b/src/Core/Models/Business/BillingInfo.cs index fbe0de475..5266558ee 100644 --- a/src/Core/Models/Business/BillingInfo.cs +++ b/src/Core/Models/Business/BillingInfo.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Stripe; namespace Bit.Core.Models.Business diff --git a/src/Core/Models/Business/ImportedGroup.cs b/src/Core/Models/Business/ImportedGroup.cs index f85e03284..38bf1ff81 100644 --- a/src/Core/Models/Business/ImportedGroup.cs +++ b/src/Core/Models/Business/ImportedGroup.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Business { diff --git a/src/Core/Models/Business/OrganizationLicense.cs b/src/Core/Models/Business/OrganizationLicense.cs index 3f09ce9d1..30449d119 100644 --- a/src/Core/Models/Business/OrganizationLicense.cs +++ b/src/Core/Models/Business/OrganizationLicense.cs @@ -4,8 +4,8 @@ using System.Reflection; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Settings; using Newtonsoft.Json; diff --git a/src/Core/Models/Business/OrganizationSignup.cs b/src/Core/Models/Business/OrganizationSignup.cs index 1e09fc323..a257410fd 100644 --- a/src/Core/Models/Business/OrganizationSignup.cs +++ b/src/Core/Models/Business/OrganizationSignup.cs @@ -1,5 +1,5 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Enums; namespace Bit.Core.Models.Business { diff --git a/src/Core/Models/Business/ReferenceEvent.cs b/src/Core/Models/Business/ReferenceEvent.cs index cd87441ac..f0fe81e7f 100644 --- a/src/Core/Models/Business/ReferenceEvent.cs +++ b/src/Core/Models/Business/ReferenceEvent.cs @@ -1,4 +1,5 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/src/Core/Models/Business/SubscriptionCreateOptions.cs b/src/Core/Models/Business/SubscriptionCreateOptions.cs index fd964dc25..63bbdfbb7 100644 --- a/src/Core/Models/Business/SubscriptionCreateOptions.cs +++ b/src/Core/Models/Business/SubscriptionCreateOptions.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Stripe; namespace Bit.Core.Models.Business diff --git a/src/Core/Models/Business/SubscriptionUpdate.cs b/src/Core/Models/Business/SubscriptionUpdate.cs index aa131b0fe..24315c723 100644 --- a/src/Core/Models/Business/SubscriptionUpdate.cs +++ b/src/Core/Models/Business/SubscriptionUpdate.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Stripe; namespace Bit.Core.Models.Business diff --git a/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs b/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs index ed79d3b43..b8cf0be04 100644 --- a/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs +++ b/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs @@ -1,6 +1,6 @@ using System; using System.Text.Json.Serialization; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Business.Tokenables { diff --git a/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs b/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs index 804705b1c..4a7322ed0 100644 --- a/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs +++ b/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs @@ -1,6 +1,6 @@ using System; using System.Text.Json.Serialization; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Tokens; namespace Bit.Core.Models.Business.Tokenables diff --git a/src/Core/Models/Business/UserLicense.cs b/src/Core/Models/Business/UserLicense.cs index 64ec47b0d..86c685960 100644 --- a/src/Core/Models/Business/UserLicense.cs +++ b/src/Core/Models/Business/UserLicense.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Services; using Newtonsoft.Json; diff --git a/src/Core/Models/Data/AttachmentResponseData.cs b/src/Core/Models/Data/AttachmentResponseData.cs index a5eb2dc5c..1a5c0de43 100644 --- a/src/Core/Models/Data/AttachmentResponseData.cs +++ b/src/Core/Models/Data/AttachmentResponseData.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/CipherOrganizationDetails.cs b/src/Core/Models/Data/CipherOrganizationDetails.cs index e1a32a532..522ebdd2f 100644 --- a/src/Core/Models/Data/CipherOrganizationDetails.cs +++ b/src/Core/Models/Data/CipherOrganizationDetails.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Core.Models.Data { diff --git a/src/Core/Models/Data/CollectionDetails.cs b/src/Core/Models/Data/CollectionDetails.cs index 62f3c46fd..110acc3e5 100644 --- a/src/Core/Models/Data/CollectionDetails.cs +++ b/src/Core/Models/Data/CollectionDetails.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/EmergencyAccessDetails.cs b/src/Core/Models/Data/EmergencyAccessDetails.cs index bd2518955..54e5069a0 100644 --- a/src/Core/Models/Data/EmergencyAccessDetails.cs +++ b/src/Core/Models/Data/EmergencyAccessDetails.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/EmergencyAccessNotify.cs b/src/Core/Models/Data/EmergencyAccessNotify.cs index 6bfb13795..b71e7102a 100644 --- a/src/Core/Models/Data/EmergencyAccessNotify.cs +++ b/src/Core/Models/Data/EmergencyAccessNotify.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Newtonsoft.Json; namespace Bit.Core.Models.Data diff --git a/src/Core/Models/Data/EmergencyAccessViewData.cs b/src/Core/Models/Data/EmergencyAccessViewData.cs index ee65cc60e..b5bcf0a95 100644 --- a/src/Core/Models/Data/EmergencyAccessViewData.cs +++ b/src/Core/Models/Data/EmergencyAccessViewData.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Core.Models.Data; namespace Bit.Core.Models.Data diff --git a/src/Core/Models/Data/GroupWithCollections.cs b/src/Core/Models/Data/GroupWithCollections.cs index dedd4f1e6..958f70feb 100644 --- a/src/Core/Models/Data/GroupWithCollections.cs +++ b/src/Core/Models/Data/GroupWithCollections.cs @@ -1,5 +1,5 @@ using System.Data; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/OrganizationAbility.cs b/src/Core/Models/Data/OrganizationAbility.cs index e02ab6a18..d7423fdc7 100644 --- a/src/Core/Models/Data/OrganizationAbility.cs +++ b/src/Core/Models/Data/OrganizationAbility.cs @@ -1,5 +1,5 @@ using System; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/OrganizationUserResetPasswordDetails.cs b/src/Core/Models/Data/OrganizationUserResetPasswordDetails.cs index e8edf5436..ea17ad8bc 100644 --- a/src/Core/Models/Data/OrganizationUserResetPasswordDetails.cs +++ b/src/Core/Models/Data/OrganizationUserResetPasswordDetails.cs @@ -1,6 +1,6 @@ using System; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/OrganizationUserWithCollections.cs b/src/Core/Models/Data/OrganizationUserWithCollections.cs index 7070e009c..b655953e8 100644 --- a/src/Core/Models/Data/OrganizationUserWithCollections.cs +++ b/src/Core/Models/Data/OrganizationUserWithCollections.cs @@ -1,5 +1,5 @@ using System.Data; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/Provider/ProviderAbility.cs b/src/Core/Models/Data/Provider/ProviderAbility.cs index f4f1e9802..bb21cb563 100644 --- a/src/Core/Models/Data/Provider/ProviderAbility.cs +++ b/src/Core/Models/Data/Provider/ProviderAbility.cs @@ -1,6 +1,5 @@ using System; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Entities.Provider; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/EntityFramework/Device.cs b/src/Core/Models/EntityFramework/Device.cs deleted file mode 100644 index b6032c416..000000000 --- a/src/Core/Models/EntityFramework/Device.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Device : Table.Device - { - public virtual User User { get; set; } - } - - public class DeviceMapperProfile : Profile - { - public DeviceMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/EmergencyAccess.cs b/src/Core/Models/EntityFramework/EmergencyAccess.cs deleted file mode 100644 index 3211a8dd2..000000000 --- a/src/Core/Models/EntityFramework/EmergencyAccess.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class EmergencyAccess : Table.EmergencyAccess - { - public virtual User Grantee { get; set; } - public virtual User Grantor { get; set; } - } - - public class EmergencyAccessMapperProfile : Profile - { - public EmergencyAccessMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Event.cs b/src/Core/Models/EntityFramework/Event.cs deleted file mode 100644 index f7300d313..000000000 --- a/src/Core/Models/EntityFramework/Event.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Event : Table.Event - { - } - - public class EventMapperProfile : Profile - { - public EventMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Folder.cs b/src/Core/Models/EntityFramework/Folder.cs deleted file mode 100644 index 8e8da6874..000000000 --- a/src/Core/Models/EntityFramework/Folder.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Folder : Table.Folder - { - public virtual User User { get; set; } - } - - public class FolderMapperProfile : Profile - { - public FolderMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Grant.cs b/src/Core/Models/EntityFramework/Grant.cs deleted file mode 100644 index 7c349b26b..000000000 --- a/src/Core/Models/EntityFramework/Grant.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Grant : Table.Grant - { - } - - public class GrantMapperProfile : Profile - { - public GrantMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Installation.cs b/src/Core/Models/EntityFramework/Installation.cs deleted file mode 100644 index b50f045c2..000000000 --- a/src/Core/Models/EntityFramework/Installation.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Installation : Table.Installation - { - } - - public class InstallationMapperProfile : Profile - { - public InstallationMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Policy.cs b/src/Core/Models/EntityFramework/Policy.cs deleted file mode 100644 index d9f2f1db3..000000000 --- a/src/Core/Models/EntityFramework/Policy.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Policy : Table.Policy - { - public virtual Organization Organization { get; set; } - } - - public class PolicyMapperProfile : Profile - { - public PolicyMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Provider/Provider.cs b/src/Core/Models/EntityFramework/Provider/Provider.cs deleted file mode 100644 index 8f96192e2..000000000 --- a/src/Core/Models/EntityFramework/Provider/Provider.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework.Provider -{ - public class Provider : Table.Provider.Provider - { - } - - public class ProviderMapperProfile : Profile - { - public ProviderMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/Role.cs b/src/Core/Models/EntityFramework/Role.cs deleted file mode 100644 index b55a1ddc7..000000000 --- a/src/Core/Models/EntityFramework/Role.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class Role : Table.Role - { - } - - public class RoleMapperProfile : Profile - { - public RoleMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/SsoConfig.cs b/src/Core/Models/EntityFramework/SsoConfig.cs deleted file mode 100644 index be86fa522..000000000 --- a/src/Core/Models/EntityFramework/SsoConfig.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class SsoConfig : Table.SsoConfig - { - public virtual Organization Organization { get; set; } - } - - public class SsoConfigMapperProfile : Profile - { - public SsoConfigMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/TaxRate.cs b/src/Core/Models/EntityFramework/TaxRate.cs deleted file mode 100644 index bf3605d21..000000000 --- a/src/Core/Models/EntityFramework/TaxRate.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class TaxRate : Table.TaxRate - { - } - - public class TaxRateMapperProfile : Profile - { - public TaxRateMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Models/EntityFramework/U2f.cs b/src/Core/Models/EntityFramework/U2f.cs deleted file mode 100644 index 9fee7f35c..000000000 --- a/src/Core/Models/EntityFramework/U2f.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; - -namespace Bit.Core.Models.EntityFramework -{ - public class U2f : Table.U2f - { - public virtual User User { get; set; } - } - - public class U2fMapperProfile : Profile - { - public U2fMapperProfile() - { - CreateMap().ReverseMap(); - } - } -} diff --git a/src/Core/Repositories/EntityFramework/InstallationRepository.cs b/src/Core/Repositories/EntityFramework/InstallationRepository.cs deleted file mode 100644 index d42ad3289..000000000 --- a/src/Core/Repositories/EntityFramework/InstallationRepository.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; - -namespace Bit.Core.Repositories.EntityFramework -{ - public class InstallationRepository : Repository, IInstallationRepository - { - public InstallationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) - : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Installations) - { } - } -} diff --git a/src/Core/Repositories/ICipherRepository.cs b/src/Core/Repositories/ICipherRepository.cs index e1b423dad..51a0bab40 100644 --- a/src/Core/Repositories/ICipherRepository.cs +++ b/src/Core/Repositories/ICipherRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Core.Models.Data; namespace Bit.Core.Repositories diff --git a/src/Core/Repositories/ICollectionCipherRepository.cs b/src/Core/Repositories/ICollectionCipherRepository.cs index f518603d3..e9e686a97 100644 --- a/src/Core/Repositories/ICollectionCipherRepository.cs +++ b/src/Core/Repositories/ICollectionCipherRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ICollectionRepository.cs b/src/Core/Repositories/ICollectionRepository.cs index f0cd4cd4b..0a0eaf973 100644 --- a/src/Core/Repositories/ICollectionRepository.cs +++ b/src/Core/Repositories/ICollectionRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IDeviceRepository.cs b/src/Core/Repositories/IDeviceRepository.cs index b1718c63b..94ded9f40 100644 --- a/src/Core/Repositories/IDeviceRepository.cs +++ b/src/Core/Repositories/IDeviceRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IEmergencyAccessRepository.cs b/src/Core/Repositories/IEmergencyAccessRepository.cs index e07444db1..364e5cddd 100644 --- a/src/Core/Repositories/IEmergencyAccessRepository.cs +++ b/src/Core/Repositories/IEmergencyAccessRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IEventRepository.cs b/src/Core/Repositories/IEventRepository.cs index aedd05cd0..341355ee6 100644 --- a/src/Core/Repositories/IEventRepository.cs +++ b/src/Core/Repositories/IEventRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IFolderRepository.cs b/src/Core/Repositories/IFolderRepository.cs index 2760d8556..ef39ab415 100644 --- a/src/Core/Repositories/IFolderRepository.cs +++ b/src/Core/Repositories/IFolderRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IGrantRepository.cs b/src/Core/Repositories/IGrantRepository.cs index 5f4f3d723..a182020cf 100644 --- a/src/Core/Repositories/IGrantRepository.cs +++ b/src/Core/Repositories/IGrantRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IGroupRepository.cs b/src/Core/Repositories/IGroupRepository.cs index 2e11b4cc4..b03f8960e 100644 --- a/src/Core/Repositories/IGroupRepository.cs +++ b/src/Core/Repositories/IGroupRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IInstallationRepository.cs b/src/Core/Repositories/IInstallationRepository.cs index 7c424521b..2ff2f01cc 100644 --- a/src/Core/Repositories/IInstallationRepository.cs +++ b/src/Core/Repositories/IInstallationRepository.cs @@ -1,5 +1,5 @@ using System; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IOrganizationRepository.cs b/src/Core/Repositories/IOrganizationRepository.cs index bebfc51a7..3535b39f4 100644 --- a/src/Core/Repositories/IOrganizationRepository.cs +++ b/src/Core/Repositories/IOrganizationRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IOrganizationSponsorshipRepository.cs b/src/Core/Repositories/IOrganizationSponsorshipRepository.cs index 3c9f57d26..f6b17a6e3 100644 --- a/src/Core/Repositories/IOrganizationSponsorshipRepository.cs +++ b/src/Core/Repositories/IOrganizationSponsorshipRepository.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IOrganizationUserRepository.cs b/src/Core/Repositories/IOrganizationUserRepository.cs index e4085480e..12dbc4e96 100644 --- a/src/Core/Repositories/IOrganizationUserRepository.cs +++ b/src/Core/Repositories/IOrganizationUserRepository.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IPolicyRepository.cs b/src/Core/Repositories/IPolicyRepository.cs index 54ceed605..9466bc3db 100644 --- a/src/Core/Repositories/IPolicyRepository.cs +++ b/src/Core/Repositories/IPolicyRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IProviderOrganizationRepository.cs b/src/Core/Repositories/IProviderOrganizationRepository.cs index 66f1b231d..e42eb098b 100644 --- a/src/Core/Repositories/IProviderOrganizationRepository.cs +++ b/src/Core/Repositories/IProviderOrganizationRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IProviderRepository.cs b/src/Core/Repositories/IProviderRepository.cs index 169cfd7ec..df226aec0 100644 --- a/src/Core/Repositories/IProviderRepository.cs +++ b/src/Core/Repositories/IProviderRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IProviderUserRepository.cs b/src/Core/Repositories/IProviderUserRepository.cs index 754c2433e..7a32188c7 100644 --- a/src/Core/Repositories/IProviderUserRepository.cs +++ b/src/Core/Repositories/IProviderUserRepository.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IRepository.cs b/src/Core/Repositories/IRepository.cs index 6cb1a7951..5bf38159f 100644 --- a/src/Core/Repositories/IRepository.cs +++ b/src/Core/Repositories/IRepository.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ISendRepository.cs b/src/Core/Repositories/ISendRepository.cs index a7179ea21..ea12a9e96 100644 --- a/src/Core/Repositories/ISendRepository.cs +++ b/src/Core/Repositories/ISendRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ISsoConfigRepository.cs b/src/Core/Repositories/ISsoConfigRepository.cs index 763cb2f0b..4d3c5090d 100644 --- a/src/Core/Repositories/ISsoConfigRepository.cs +++ b/src/Core/Repositories/ISsoConfigRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ISsoUserRepository.cs b/src/Core/Repositories/ISsoUserRepository.cs index 7d466ed00..a5e5dd305 100644 --- a/src/Core/Repositories/ISsoUserRepository.cs +++ b/src/Core/Repositories/ISsoUserRepository.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ITaxRateRepository.cs b/src/Core/Repositories/ITaxRateRepository.cs index 7916a3137..51e86f340 100644 --- a/src/Core/Repositories/ITaxRateRepository.cs +++ b/src/Core/Repositories/ITaxRateRepository.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/ITransactionRepository.cs b/src/Core/Repositories/ITransactionRepository.cs index e47c68b8c..8bd0f952e 100644 --- a/src/Core/Repositories/ITransactionRepository.cs +++ b/src/Core/Repositories/ITransactionRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IU2fRepository.cs b/src/Core/Repositories/IU2fRepository.cs index d655f1761..7246b112c 100644 --- a/src/Core/Repositories/IU2fRepository.cs +++ b/src/Core/Repositories/IU2fRepository.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/IUserRepository.cs b/src/Core/Repositories/IUserRepository.cs index 3e655622c..0c047f857 100644 --- a/src/Core/Repositories/IUserRepository.cs +++ b/src/Core/Repositories/IUserRepository.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Repositories { diff --git a/src/Core/Repositories/SqlServer/DateTimeHandler.cs b/src/Core/Repositories/SqlServer/DateTimeHandler.cs deleted file mode 100644 index 36eabca61..000000000 --- a/src/Core/Repositories/SqlServer/DateTimeHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Data; -using Dapper; - -public class DateTimeHandler : SqlMapper.TypeHandler -{ - public override void SetValue(IDbDataParameter parameter, DateTime value) - { - parameter.Value = value; - } - - public override DateTime Parse(object value) - { - return DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc); - } -} diff --git a/src/Core/Repositories/TableStorage/EventRepository.cs b/src/Core/Repositories/TableStorage/EventRepository.cs index a2df9d9b1..c2cd4b4a0 100644 --- a/src/Core/Repositories/TableStorage/EventRepository.cs +++ b/src/Core/Repositories/TableStorage/EventRepository.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Utilities; using Microsoft.Azure.Cosmos.Table; diff --git a/src/Core/Services/IApplicationCacheService.cs b/src/Core/Services/IApplicationCacheService.cs index a00185e12..72e913e2f 100644 --- a/src/Core/Services/IApplicationCacheService.cs +++ b/src/Core/Services/IApplicationCacheService.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/IAttachmentStorageService.cs b/src/Core/Services/IAttachmentStorageService.cs index 66775e601..31b74f2f1 100644 --- a/src/Core/Services/IAttachmentStorageService.cs +++ b/src/Core/Services/IAttachmentStorageService.cs @@ -1,9 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/ICaptchaValidationService.cs b/src/Core/Services/ICaptchaValidationService.cs index 08a18b0c8..e4e80edb9 100644 --- a/src/Core/Services/ICaptchaValidationService.cs +++ b/src/Core/Services/ICaptchaValidationService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Bit.Core.Context; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Services { diff --git a/src/Core/Services/ICipherService.cs b/src/Core/Services/ICipherService.cs index e0b69a63b..3684aab6b 100644 --- a/src/Core/Services/ICipherService.cs +++ b/src/Core/Services/ICipherService.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Core.Models.Data; namespace Bit.Core.Services diff --git a/src/Core/Services/ICollectionService.cs b/src/Core/Services/ICollectionService.cs index e5f22287d..9bcc4b859 100644 --- a/src/Core/Services/ICollectionService.cs +++ b/src/Core/Services/ICollectionService.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IDeviceService.cs b/src/Core/Services/IDeviceService.cs index ea5a1b7df..0fbd2f045 100644 --- a/src/Core/Services/IDeviceService.cs +++ b/src/Core/Services/IDeviceService.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Services { diff --git a/src/Core/Services/IEmergencyAccessService.cs b/src/Core/Services/IEmergencyAccessService.cs index 6d66ed4c8..fe37f4277 100644 --- a/src/Core/Services/IEmergencyAccessService.cs +++ b/src/Core/Services/IEmergencyAccessService.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IEventService.cs b/src/Core/Services/IEventService.cs index 740876517..444df18c7 100644 --- a/src/Core/Services/IEventService.cs +++ b/src/Core/Services/IEventService.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/IGroupService.cs b/src/Core/Services/IGroupService.cs index 3dbe953d1..6fc6cea70 100644 --- a/src/Core/Services/IGroupService.cs +++ b/src/Core/Services/IGroupService.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/ILicensingService.cs b/src/Core/Services/ILicensingService.cs index 84e7978f0..15d6a2fe9 100644 --- a/src/Core/Services/ILicensingService.cs +++ b/src/Core/Services/ILicensingService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IMailService.cs b/src/Core/Services/IMailService.cs index 3615da1de..09e71dae5 100644 --- a/src/Core/Services/IMailService.cs +++ b/src/Core/Services/IMailService.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; using Bit.Core.Models.Mail; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/IOrganizationService.cs b/src/Core/Services/IOrganizationService.cs index a6f35537f..e41b1d011 100644 --- a/src/Core/Services/IOrganizationService.cs +++ b/src/Core/Services/IOrganizationService.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IOrganizationSponsorshipService.cs b/src/Core/Services/IOrganizationSponsorshipService.cs index a72e4e592..81be9cb4a 100644 --- a/src/Core/Services/IOrganizationSponsorshipService.cs +++ b/src/Core/Services/IOrganizationSponsorshipService.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IPaymentService.cs b/src/Core/Services/IPaymentService.cs index 36b4889f6..3d0982cdb 100644 --- a/src/Core/Services/IPaymentService.cs +++ b/src/Core/Services/IPaymentService.cs @@ -1,9 +1,9 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; using Bit.Core.Models.StaticStore; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/IPolicyService.cs b/src/Core/Services/IPolicyService.cs index 1b9591106..838a1beb7 100644 --- a/src/Core/Services/IPolicyService.cs +++ b/src/Core/Services/IPolicyService.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Services { diff --git a/src/Core/Services/IProviderService.cs b/src/Core/Services/IProviderService.cs index 7214e6cf8..c0078c2b0 100644 --- a/src/Core/Services/IProviderService.cs +++ b/src/Core/Services/IProviderService.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; using Bit.Core.Models.Business.Provider; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/IPushNotificationService.cs b/src/Core/Services/IPushNotificationService.cs index 1bfd16018..c64e696ee 100644 --- a/src/Core/Services/IPushNotificationService.cs +++ b/src/Core/Services/IPushNotificationService.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/ISendService.cs b/src/Core/Services/ISendService.cs index ae4162a7b..5c15ae05b 100644 --- a/src/Core/Services/ISendService.cs +++ b/src/Core/Services/ISendService.cs @@ -1,8 +1,8 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/ISendStorageService.cs b/src/Core/Services/ISendStorageService.cs index 03b601675..cd1ade094 100644 --- a/src/Core/Services/ISendStorageService.cs +++ b/src/Core/Services/ISendStorageService.cs @@ -1,8 +1,8 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/ISsoConfigService.cs b/src/Core/Services/ISsoConfigService.cs index 3c1d06d75..d9a7eb20e 100644 --- a/src/Core/Services/ISsoConfigService.cs +++ b/src/Core/Services/ISsoConfigService.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Services { diff --git a/src/Core/Services/IUserService.cs b/src/Core/Services/IUserService.cs index 52b0bfc92..c4b562411 100644 --- a/src/Core/Services/IUserService.cs +++ b/src/Core/Services/IUserService.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Fido2NetLib; using Microsoft.AspNetCore.Identity; diff --git a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs b/src/Core/Services/Implementations/AzureAttachmentStorageService.cs index 82b4e5729..53999d488 100644 --- a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs +++ b/src/Core/Services/Implementations/AzureAttachmentStorageService.cs @@ -5,9 +5,9 @@ using System.Threading.Tasks; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using Azure.Storage.Sas; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs index 989136b73..619ebe03b 100644 --- a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs +++ b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Threading.Tasks; using Azure.Storage.Queues; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; using Newtonsoft.Json; diff --git a/src/Core/Services/Implementations/AzureQueueService.cs b/src/Core/Services/Implementations/AzureQueueService.cs index 844f8d700..2c3b1234d 100644 --- a/src/Core/Services/Implementations/AzureQueueService.cs +++ b/src/Core/Services/Implementations/AzureQueueService.cs @@ -4,7 +4,6 @@ using System.Text; using System.Threading.Tasks; using Azure.Storage.Queues; using Bit.Core.Utilities; -using Microsoft.EntityFrameworkCore.Internal; using Newtonsoft.Json; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/AzureSendFileStorageService.cs b/src/Core/Services/Implementations/AzureSendFileStorageService.cs index dab251070..934c3ac20 100644 --- a/src/Core/Services/Implementations/AzureSendFileStorageService.cs +++ b/src/Core/Services/Implementations/AzureSendFileStorageService.cs @@ -2,12 +2,11 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using Azure; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using Azure.Storage.Sas; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/CipherService.cs b/src/Core/Services/Implementations/CipherService.cs index f1a5a8e38..9482a1585 100644 --- a/src/Core/Services/Implementations/CipherService.cs +++ b/src/Core/Services/Implementations/CipherService.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/CollectionService.cs b/src/Core/Services/Implementations/CollectionService.cs index d0105908a..af6fd3385 100644 --- a/src/Core/Services/Implementations/CollectionService.cs +++ b/src/Core/Services/Implementations/CollectionService.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/DeviceService.cs b/src/Core/Services/Implementations/DeviceService.cs index 4bf177b4e..951abfac3 100644 --- a/src/Core/Services/Implementations/DeviceService.cs +++ b/src/Core/Services/Implementations/DeviceService.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/EmergencyAccessService.cs b/src/Core/Services/Implementations/EmergencyAccessService.cs index 2bd1fc9ef..2b9aa2ff1 100644 --- a/src/Core/Services/Implementations/EmergencyAccessService.cs +++ b/src/Core/Services/Implementations/EmergencyAccessService.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models; using Bit.Core.Models.Business.Tokenables; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Tokens; diff --git a/src/Core/Services/Implementations/EventService.cs b/src/Core/Services/Implementations/EventService.cs index 1a1d016ec..50ff0b692 100644 --- a/src/Core/Services/Implementations/EventService.cs +++ b/src/Core/Services/Implementations/EventService.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Repositories; using Bit.Core.Settings; diff --git a/src/Core/Services/Implementations/GroupService.cs b/src/Core/Services/Implementations/GroupService.cs index 96f242fa1..c7b5bcb61 100644 --- a/src/Core/Services/Implementations/GroupService.cs +++ b/src/Core/Services/Implementations/GroupService.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/HCaptchaValidationService.cs b/src/Core/Services/Implementations/HCaptchaValidationService.cs index a2f92b4df..b93238cfd 100644 --- a/src/Core/Services/Implementations/HCaptchaValidationService.cs +++ b/src/Core/Services/Implementations/HCaptchaValidationService.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Bit.Core.Tokens; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/HandlebarsMailService.cs b/src/Core/Services/Implementations/HandlebarsMailService.cs index c8e5dd121..f953d7070 100644 --- a/src/Core/Services/Implementations/HandlebarsMailService.cs +++ b/src/Core/Services/Implementations/HandlebarsMailService.cs @@ -5,12 +5,12 @@ using System.Linq; using System.Net; using System.Reflection; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; using Bit.Core.Models.Mail; using Bit.Core.Models.Mail.FamiliesForEnterprise; using Bit.Core.Models.Mail.Provider; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Settings; using Bit.Core.Utilities; using HandlebarsDotNet; diff --git a/src/Core/Services/Implementations/InMemoryApplicationCacheService.cs b/src/Core/Services/Implementations/InMemoryApplicationCacheService.cs index fc9ba2aec..fc9320e85 100644 --- a/src/Core/Services/Implementations/InMemoryApplicationCacheService.cs +++ b/src/Core/Services/Implementations/InMemoryApplicationCacheService.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/InMemoryServiceBusApplicationCacheService.cs b/src/Core/Services/Implementations/InMemoryServiceBusApplicationCacheService.cs index f08cccae3..fd0d9b339 100644 --- a/src/Core/Services/Implementations/InMemoryServiceBusApplicationCacheService.cs +++ b/src/Core/Services/Implementations/InMemoryServiceBusApplicationCacheService.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/LicensingService.cs b/src/Core/Services/Implementations/LicensingService.cs index ad7ec0988..1b2c70415 100644 --- a/src/Core/Services/Implementations/LicensingService.cs +++ b/src/Core/Services/Implementations/LicensingService.cs @@ -5,8 +5,8 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/LocalAttachmentStorageService.cs b/src/Core/Services/Implementations/LocalAttachmentStorageService.cs index e226284f2..72f55280b 100644 --- a/src/Core/Services/Implementations/LocalAttachmentStorageService.cs +++ b/src/Core/Services/Implementations/LocalAttachmentStorageService.cs @@ -1,9 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/LocalSendStorageService.cs b/src/Core/Services/Implementations/LocalSendStorageService.cs index c9d65f67c..5ab7fca35 100644 --- a/src/Core/Services/Implementations/LocalSendStorageService.cs +++ b/src/Core/Services/Implementations/LocalSendStorageService.cs @@ -2,8 +2,8 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Settings; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs index d55092732..8320e516c 100644 --- a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs +++ b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs index 2504125c6..95c8673d6 100644 --- a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; diff --git a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs index f0c10e11a..7cf41cbad 100644 --- a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 058a60424..28a026e75 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/OrganizationSponsorshipService.cs b/src/Core/Services/Implementations/OrganizationSponsorshipService.cs index eb704d77a..19101f072 100644 --- a/src/Core/Services/Implementations/OrganizationSponsorshipService.cs +++ b/src/Core/Services/Implementations/OrganizationSponsorshipService.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Utilities; using Microsoft.AspNetCore.DataProtection; diff --git a/src/Core/Services/Implementations/PolicyService.cs b/src/Core/Services/Implementations/PolicyService.cs index 19831a991..14e107e80 100644 --- a/src/Core/Services/Implementations/PolicyService.cs +++ b/src/Core/Services/Implementations/PolicyService.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/RelayPushNotificationService.cs b/src/Core/Services/Implementations/RelayPushNotificationService.cs index dcdd921ad..6b930a60f 100644 --- a/src/Core/Services/Implementations/RelayPushNotificationService.cs +++ b/src/Core/Services/Implementations/RelayPushNotificationService.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; diff --git a/src/Core/Services/Implementations/SendService.cs b/src/Core/Services/Implementations/SendService.cs index 327c73259..36cf82ad6 100644 --- a/src/Core/Services/Implementations/SendService.cs +++ b/src/Core/Services/Implementations/SendService.cs @@ -3,11 +3,11 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/Implementations/SsoConfigService.cs b/src/Core/Services/Implementations/SsoConfigService.cs index dd6f9b305..51425c4e9 100644 --- a/src/Core/Services/Implementations/SsoConfigService.cs +++ b/src/Core/Services/Implementations/SsoConfigService.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; namespace Bit.Core.Services diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index 1a5d91dc9..96e4500e3 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -3,14 +3,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Billing.Models; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Microsoft.Extensions.Logging; using StaticStore = Bit.Core.Models.StaticStore; -using TaxRate = Bit.Core.Models.Table.TaxRate; +using TaxRate = Bit.Core.Entities.TaxRate; namespace Bit.Core.Services { @@ -466,7 +466,7 @@ namespace Bit.Core.Services && !string.IsNullOrWhiteSpace(taxInfo?.BillingAddressPostalCode)) { var taxRates = await _taxRateRepository.GetByLocationAsync( - new Bit.Core.Models.Table.TaxRate() + new TaxRate() { Country = taxInfo.BillingAddressCountry, PostalCode = taxInfo.BillingAddressPostalCode @@ -742,7 +742,7 @@ namespace Bit.Core.Services && !string.IsNullOrWhiteSpace(customer?.Address?.PostalCode)) { var taxRates = await _taxRateRepository.GetByLocationAsync( - new Bit.Core.Models.Table.TaxRate() + new TaxRate() { Country = customer.Address.Country, PostalCode = customer.Address.PostalCode diff --git a/src/Core/Services/Implementations/UserService.cs b/src/Core/Services/Implementations/UserService.cs index 293166b28..ffeb436e9 100644 --- a/src/Core/Services/Implementations/UserService.cs +++ b/src/Core/Services/Implementations/UserService.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs b/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs index e47f45f96..f0dba5744 100644 --- a/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs +++ b/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs @@ -1,9 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs b/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs index 6e16000da..6173e76ba 100644 --- a/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs +++ b/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Bit.Core.Context; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopEventService.cs b/src/Core/Services/NoopImplementations/NoopEventService.cs index 466f2be98..c42334785 100644 --- a/src/Core/Services/NoopImplementations/NoopEventService.cs +++ b/src/Core/Services/NoopImplementations/NoopEventService.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopLicensingService.cs b/src/Core/Services/NoopImplementations/NoopLicensingService.cs index 52f8d1edd..84c2599e9 100644 --- a/src/Core/Services/NoopImplementations/NoopLicensingService.cs +++ b/src/Core/Services/NoopImplementations/NoopLicensingService.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Settings; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; diff --git a/src/Core/Services/NoopImplementations/NoopMailService.cs b/src/Core/Services/NoopImplementations/NoopMailService.cs index 55ff400b5..3fb02a5a9 100644 --- a/src/Core/Services/NoopImplementations/NoopMailService.cs +++ b/src/Core/Services/NoopImplementations/NoopMailService.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; using Bit.Core.Models.Mail; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopProviderService.cs b/src/Core/Services/NoopImplementations/NoopProviderService.cs index 5d29c93bf..d52f0b640 100644 --- a/src/Core/Services/NoopImplementations/NoopProviderService.cs +++ b/src/Core/Services/NoopImplementations/NoopProviderService.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; using Bit.Core.Models.Business.Provider; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs index d49239d33..d21a3dd62 100644 --- a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs +++ b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Services/NoopImplementations/NoopSendFileStorageService.cs b/src/Core/Services/NoopImplementations/NoopSendFileStorageService.cs index bc4b63142..acbae1fb5 100644 --- a/src/Core/Services/NoopImplementations/NoopSendFileStorageService.cs +++ b/src/Core/Services/NoopImplementations/NoopSendFileStorageService.cs @@ -1,8 +1,8 @@ using System; using System.IO; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; namespace Bit.Core.Services { diff --git a/src/Core/Utilities/BillingHelpers.cs b/src/Core/Utilities/BillingHelpers.cs index 25505b7ff..662415a04 100644 --- a/src/Core/Utilities/BillingHelpers.cs +++ b/src/Core/Utilities/BillingHelpers.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Services; namespace Bit.Core.Utilities diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs index 92e237d74..315fecf11 100644 --- a/src/Core/Utilities/CoreHelpers.cs +++ b/src/Core/Utilities/CoreHelpers.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Data; using System.Globalization; using System.IO; using System.Linq; @@ -17,12 +16,10 @@ using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using Azure.Storage.Queues.Models; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; -using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Settings; -using Dapper; using IdentityModel; using Microsoft.AspNetCore.DataProtection; using MimeKit; @@ -103,104 +100,6 @@ namespace Bit.Core.Utilities } } - public static DataTable ToGuidIdArrayTVP(this IEnumerable ids) - { - return ids.ToArrayTVP("GuidId"); - } - - public static DataTable ToArrayTVP(this IEnumerable values, string columnName) - { - var table = new DataTable(); - table.SetTypeName($"[dbo].[{columnName}Array]"); - table.Columns.Add(columnName, typeof(T)); - - if (values != null) - { - foreach (var value in values) - { - table.Rows.Add(value); - } - } - - return table; - } - - public static DataTable ToArrayTVP(this IEnumerable values) - { - var table = new DataTable(); - table.SetTypeName("[dbo].[SelectionReadOnlyArray]"); - - var idColumn = new DataColumn("Id", typeof(Guid)); - table.Columns.Add(idColumn); - var readOnlyColumn = new DataColumn("ReadOnly", typeof(bool)); - table.Columns.Add(readOnlyColumn); - var hidePasswordsColumn = new DataColumn("HidePasswords", typeof(bool)); - table.Columns.Add(hidePasswordsColumn); - - if (values != null) - { - foreach (var value in values) - { - var row = table.NewRow(); - row[idColumn] = value.Id; - row[readOnlyColumn] = value.ReadOnly; - row[hidePasswordsColumn] = value.HidePasswords; - table.Rows.Add(row); - } - } - - return table; - } - - public static DataTable ToTvp(this IEnumerable orgUsers) - { - var table = new DataTable(); - table.SetTypeName("[dbo].[OrganizationUserType]"); - - var columnData = new List<(string name, Type type, Func getter)> - { - (nameof(OrganizationUser.Id), typeof(Guid), ou => ou.Id), - (nameof(OrganizationUser.OrganizationId), typeof(Guid), ou => ou.OrganizationId), - (nameof(OrganizationUser.UserId), typeof(Guid), ou => ou.UserId), - (nameof(OrganizationUser.Email), typeof(string), ou => ou.Email), - (nameof(OrganizationUser.Key), typeof(string), ou => ou.Key), - (nameof(OrganizationUser.Status), typeof(byte), ou => ou.Status), - (nameof(OrganizationUser.Type), typeof(byte), ou => ou.Type), - (nameof(OrganizationUser.AccessAll), typeof(bool), ou => ou.AccessAll), - (nameof(OrganizationUser.ExternalId), typeof(string), ou => ou.ExternalId), - (nameof(OrganizationUser.CreationDate), typeof(DateTime), ou => ou.CreationDate), - (nameof(OrganizationUser.RevisionDate), typeof(DateTime), ou => ou.RevisionDate), - (nameof(OrganizationUser.Permissions), typeof(string), ou => ou.Permissions), - (nameof(OrganizationUser.ResetPasswordKey), typeof(string), ou => ou.ResetPasswordKey), - }; - - foreach (var (name, type, getter) in columnData) - { - var column = new DataColumn(name, type); - table.Columns.Add(column); - } - - foreach (var orgUser in orgUsers ?? new OrganizationUser[] { }) - { - var row = table.NewRow(); - foreach (var (name, type, getter) in columnData) - { - var val = getter(orgUser); - if (val == null) - { - row[name] = DBNull.Value; - } - else - { - row[name] = val; - } - } - table.Rows.Add(row); - } - - return table; - } - public static string CleanCertificateThumbprint(string thumbprint) { // Clean possible garbage characters from thumbprint copy/paste diff --git a/src/Events/Controllers/CollectController.cs b/src/Events/Controllers/CollectController.cs index bed3030ec..73cda0695 100644 --- a/src/Events/Controllers/CollectController.cs +++ b/src/Events/Controllers/CollectController.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/src/Events/Events.csproj b/src/Events/Events.csproj index cb65ff97c..5b6491d2e 100644 --- a/src/Events/Events.csproj +++ b/src/Events/Events.csproj @@ -6,6 +6,7 @@ + diff --git a/src/Events/Startup.cs b/src/Events/Startup.cs index 94d2d83d4..6cf103df6 100644 --- a/src/Events/Startup.cs +++ b/src/Events/Startup.cs @@ -3,6 +3,7 @@ using Bit.Core.Context; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using IdentityModel; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; diff --git a/src/EventsProcessor/EventsProcessor.csproj b/src/EventsProcessor/EventsProcessor.csproj index 3e8876489..050f96bac 100644 --- a/src/EventsProcessor/EventsProcessor.csproj +++ b/src/EventsProcessor/EventsProcessor.csproj @@ -5,6 +5,7 @@ + diff --git a/src/EventsProcessor/Startup.cs b/src/EventsProcessor/Startup.cs index fd437b96f..32feb9de7 100644 --- a/src/EventsProcessor/Startup.cs +++ b/src/EventsProcessor/Startup.cs @@ -1,6 +1,7 @@ using System.Globalization; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; diff --git a/src/Icons/Icons.csproj b/src/Icons/Icons.csproj index 31fa723a0..4e7f8a849 100644 --- a/src/Icons/Icons.csproj +++ b/src/Icons/Icons.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Icons/Startup.cs b/src/Icons/Startup.cs index 1d53d34c2..5e5bb2782 100644 --- a/src/Icons/Startup.cs +++ b/src/Icons/Startup.cs @@ -3,6 +3,7 @@ using System.Globalization; using Bit.Core.Settings; using Bit.Core.Utilities; using Bit.Icons.Services; +using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; diff --git a/src/Identity/Controllers/AccountController.cs b/src/Identity/Controllers/AccountController.cs index b01ca2c07..f0b7bcec3 100644 --- a/src/Identity/Controllers/AccountController.cs +++ b/src/Identity/Controllers/AccountController.cs @@ -4,8 +4,8 @@ using System.Linq; using System.Net.Http; using System.Security.Claims; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Identity.Models; using IdentityModel; diff --git a/src/Identity/Identity.csproj b/src/Identity/Identity.csproj index 483452f51..63dc3c347 100644 --- a/src/Identity/Identity.csproj +++ b/src/Identity/Identity.csproj @@ -6,6 +6,7 @@ + diff --git a/src/Identity/Startup.cs b/src/Identity/Startup.cs index 10761df29..7584bf99f 100644 --- a/src/Identity/Startup.cs +++ b/src/Identity/Startup.cs @@ -8,6 +8,7 @@ using Bit.Core.Context; using Bit.Core.Settings; using Bit.Core.Utilities; using Bit.Identity.Utilities; +using Bit.SharedWeb.Utilities; using IdentityServer4.Extensions; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; diff --git a/src/Identity/Utilities/ServiceCollectionExtensions.cs b/src/Identity/Utilities/ServiceCollectionExtensions.cs index 0746bd699..ec8534781 100644 --- a/src/Identity/Utilities/ServiceCollectionExtensions.cs +++ b/src/Identity/Utilities/ServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ using Bit.Core.IdentityServer; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using IdentityServer4.ResponseHandling; using IdentityServer4.Services; using IdentityServer4.Stores; diff --git a/src/Infrastructure.Dapper/DapperHelpers.cs b/src/Infrastructure.Dapper/DapperHelpers.cs new file mode 100644 index 000000000..8316375f1 --- /dev/null +++ b/src/Infrastructure.Dapper/DapperHelpers.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Data; +using Bit.Core.Entities; +using Bit.Core.Models.Data; +using Dapper; + +namespace Bit.Infrastructure.Dapper +{ + public static class DapperHelpers + { + public static DataTable ToGuidIdArrayTVP(this IEnumerable ids) + { + return ids.ToArrayTVP("GuidId"); + } + + public static DataTable ToArrayTVP(this IEnumerable values, string columnName) + { + var table = new DataTable(); + table.SetTypeName($"[dbo].[{columnName}Array]"); + table.Columns.Add(columnName, typeof(T)); + + if (values != null) + { + foreach (var value in values) + { + table.Rows.Add(value); + } + } + + return table; + } + + public static DataTable ToArrayTVP(this IEnumerable values) + { + var table = new DataTable(); + table.SetTypeName("[dbo].[SelectionReadOnlyArray]"); + + var idColumn = new DataColumn("Id", typeof(Guid)); + table.Columns.Add(idColumn); + var readOnlyColumn = new DataColumn("ReadOnly", typeof(bool)); + table.Columns.Add(readOnlyColumn); + var hidePasswordsColumn = new DataColumn("HidePasswords", typeof(bool)); + table.Columns.Add(hidePasswordsColumn); + + if (values != null) + { + foreach (var value in values) + { + var row = table.NewRow(); + row[idColumn] = value.Id; + row[readOnlyColumn] = value.ReadOnly; + row[hidePasswordsColumn] = value.HidePasswords; + table.Rows.Add(row); + } + } + + return table; + } + + public static DataTable ToTvp(this IEnumerable orgUsers) + { + var table = new DataTable(); + table.SetTypeName("[dbo].[OrganizationUserType]"); + + var columnData = new List<(string name, Type type, Func getter)> + { + (nameof(OrganizationUser.Id), typeof(Guid), ou => ou.Id), + (nameof(OrganizationUser.OrganizationId), typeof(Guid), ou => ou.OrganizationId), + (nameof(OrganizationUser.UserId), typeof(Guid), ou => ou.UserId), + (nameof(OrganizationUser.Email), typeof(string), ou => ou.Email), + (nameof(OrganizationUser.Key), typeof(string), ou => ou.Key), + (nameof(OrganizationUser.Status), typeof(byte), ou => ou.Status), + (nameof(OrganizationUser.Type), typeof(byte), ou => ou.Type), + (nameof(OrganizationUser.AccessAll), typeof(bool), ou => ou.AccessAll), + (nameof(OrganizationUser.ExternalId), typeof(string), ou => ou.ExternalId), + (nameof(OrganizationUser.CreationDate), typeof(DateTime), ou => ou.CreationDate), + (nameof(OrganizationUser.RevisionDate), typeof(DateTime), ou => ou.RevisionDate), + (nameof(OrganizationUser.Permissions), typeof(string), ou => ou.Permissions), + (nameof(OrganizationUser.ResetPasswordKey), typeof(string), ou => ou.ResetPasswordKey), + }; + + foreach (var (name, type, getter) in columnData) + { + var column = new DataColumn(name, type); + table.Columns.Add(column); + } + + foreach (var orgUser in orgUsers ?? new OrganizationUser[] { }) + { + var row = table.NewRow(); + foreach (var (name, type, getter) in columnData) + { + var val = getter(orgUser); + if (val == null) + { + row[name] = DBNull.Value; + } + else + { + row[name] = val; + } + } + table.Rows.Add(row); + } + + return table; + } + } +} diff --git a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs new file mode 100644 index 000000000..1dedc3c48 --- /dev/null +++ b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs @@ -0,0 +1,43 @@ +using Bit.Core.Repositories; +using Bit.Infrastructure.Dapper.Repositories; +using Microsoft.Extensions.DependencyInjection; + +namespace Bit.Infrastructure.Dapper +{ + public static class DapperServiceCollectionExtensions + { + public static void AddDapperRepositories(this IServiceCollection services, bool selfHosted) + { + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + + if (selfHosted) + { + services.AddSingleton(); + } + } + } +} diff --git a/src/Infrastructure.Dapper/Infrastructure.Dapper.csproj b/src/Infrastructure.Dapper/Infrastructure.Dapper.csproj new file mode 100644 index 000000000..295110cc2 --- /dev/null +++ b/src/Infrastructure.Dapper/Infrastructure.Dapper.csproj @@ -0,0 +1,16 @@ + + + + net5.0 + + + + + + + + + + + + diff --git a/src/Core/Repositories/BaseRepository.cs b/src/Infrastructure.Dapper/Repositories/BaseRepository.cs similarity index 94% rename from src/Core/Repositories/BaseRepository.cs rename to src/Infrastructure.Dapper/Repositories/BaseRepository.cs index ab996ae71..3c7701d3f 100644 --- a/src/Core/Repositories/BaseRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/BaseRepository.cs @@ -1,7 +1,7 @@ using System; using Dapper; -namespace Bit.Core.Repositories +namespace Bit.Infrastructure.Dapper.Repositories { public abstract class BaseRepository { diff --git a/src/Core/Repositories/SqlServer/CipherRepository.cs b/src/Infrastructure.Dapper/Repositories/CipherRepository.cs similarity index 99% rename from src/Core/Repositories/SqlServer/CipherRepository.cs rename to src/Infrastructure.Dapper/Repositories/CipherRepository.cs index 0b37e2dca..b3915b878 100644 --- a/src/Core/Repositories/SqlServer/CipherRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/CipherRepository.cs @@ -4,15 +4,16 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Core.Models.Data; using Dapper; using Newtonsoft.Json; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class CipherRepository : Repository, ICipherRepository { diff --git a/src/Core/Repositories/SqlServer/CollectionCipherRepository.cs b/src/Infrastructure.Dapper/Repositories/CollectionCipherRepository.cs similarity index 97% rename from src/Core/Repositories/SqlServer/CollectionCipherRepository.cs rename to src/Infrastructure.Dapper/Repositories/CollectionCipherRepository.cs index 8d3f5e03e..62732ca6c 100644 --- a/src/Core/Repositories/SqlServer/CollectionCipherRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/CollectionCipherRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class CollectionCipherRepository : BaseRepository, ICollectionCipherRepository { diff --git a/src/Core/Repositories/SqlServer/CollectionRepository.cs b/src/Infrastructure.Dapper/Repositories/CollectionRepository.cs similarity index 98% rename from src/Core/Repositories/SqlServer/CollectionRepository.cs rename to src/Infrastructure.Dapper/Repositories/CollectionRepository.cs index b41706e28..2f8e87a5b 100644 --- a/src/Core/Repositories/SqlServer/CollectionRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/CollectionRepository.cs @@ -4,14 +4,15 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; using Newtonsoft.Json; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class CollectionRepository : Repository, ICollectionRepository { diff --git a/src/Infrastructure.Dapper/Repositories/DateTimeHandler.cs b/src/Infrastructure.Dapper/Repositories/DateTimeHandler.cs new file mode 100644 index 000000000..91211d537 --- /dev/null +++ b/src/Infrastructure.Dapper/Repositories/DateTimeHandler.cs @@ -0,0 +1,19 @@ +using System; +using System.Data; +using Dapper; + +namespace Bit.Infrastructure.Dapper.Repositories +{ + public class DateTimeHandler : SqlMapper.TypeHandler + { + public override void SetValue(IDbDataParameter parameter, DateTime value) + { + parameter.Value = value; + } + + public override DateTime Parse(object value) + { + return DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc); + } + } +} diff --git a/src/Core/Repositories/SqlServer/DeviceRepository.cs b/src/Infrastructure.Dapper/Repositories/DeviceRepository.cs similarity index 96% rename from src/Core/Repositories/SqlServer/DeviceRepository.cs rename to src/Infrastructure.Dapper/Repositories/DeviceRepository.cs index 961edc247..e674cddd7 100644 --- a/src/Core/Repositories/SqlServer/DeviceRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/DeviceRepository.cs @@ -4,11 +4,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class DeviceRepository : Repository, IDeviceRepository { diff --git a/src/Core/Repositories/SqlServer/EmergencyAccessRepository.cs b/src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs similarity index 97% rename from src/Core/Repositories/SqlServer/EmergencyAccessRepository.cs rename to src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs index 38d4c0125..0f987372b 100644 --- a/src/Core/Repositories/SqlServer/EmergencyAccessRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository { diff --git a/src/Core/Repositories/SqlServer/EventRepository.cs b/src/Infrastructure.Dapper/Repositories/EventRepository.cs similarity index 99% rename from src/Core/Repositories/SqlServer/EventRepository.cs rename to src/Infrastructure.Dapper/Repositories/EventRepository.cs index 8ce19f64b..5279d0df2 100644 --- a/src/Core/Repositories/SqlServer/EventRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/EventRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class EventRepository : Repository, IEventRepository { diff --git a/src/Core/Repositories/SqlServer/FolderRepository.cs b/src/Infrastructure.Dapper/Repositories/FolderRepository.cs similarity index 93% rename from src/Core/Repositories/SqlServer/FolderRepository.cs rename to src/Infrastructure.Dapper/Repositories/FolderRepository.cs index 7a91b13c8..ea4bc78f7 100644 --- a/src/Core/Repositories/SqlServer/FolderRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/FolderRepository.cs @@ -4,11 +4,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class FolderRepository : Repository, IFolderRepository { diff --git a/src/Core/Repositories/SqlServer/GrantRepository.cs b/src/Infrastructure.Dapper/Repositories/GrantRepository.cs similarity index 96% rename from src/Core/Repositories/SqlServer/GrantRepository.cs rename to src/Infrastructure.Dapper/Repositories/GrantRepository.cs index b725b1a02..8a7b07980 100644 --- a/src/Core/Repositories/SqlServer/GrantRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/GrantRepository.cs @@ -3,11 +3,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class GrantRepository : BaseRepository, IGrantRepository { diff --git a/src/Core/Repositories/SqlServer/GroupRepository.cs b/src/Infrastructure.Dapper/Repositories/GroupRepository.cs similarity index 98% rename from src/Core/Repositories/SqlServer/GroupRepository.cs rename to src/Infrastructure.Dapper/Repositories/GroupRepository.cs index 7c7f8e5fe..d7ea1fec0 100644 --- a/src/Core/Repositories/SqlServer/GroupRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/GroupRepository.cs @@ -4,14 +4,15 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; using Newtonsoft.Json; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class GroupRepository : Repository, IGroupRepository { diff --git a/src/Core/Repositories/SqlServer/InstallationRepository.cs b/src/Infrastructure.Dapper/Repositories/InstallationRepository.cs similarity index 83% rename from src/Core/Repositories/SqlServer/InstallationRepository.cs rename to src/Infrastructure.Dapper/Repositories/InstallationRepository.cs index 2cd8ad83f..b32012bb2 100644 --- a/src/Core/Repositories/SqlServer/InstallationRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/InstallationRepository.cs @@ -1,8 +1,9 @@ using System; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class InstallationRepository : Repository, IInstallationRepository { diff --git a/src/Core/Repositories/SqlServer/MaintenanceRepository.cs b/src/Infrastructure.Dapper/Repositories/MaintenanceRepository.cs similarity index 96% rename from src/Core/Repositories/SqlServer/MaintenanceRepository.cs rename to src/Infrastructure.Dapper/Repositories/MaintenanceRepository.cs index 060038170..12d942248 100644 --- a/src/Core/Repositories/SqlServer/MaintenanceRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/MaintenanceRepository.cs @@ -1,10 +1,11 @@ using System.Data; using System.Data.SqlClient; using System.Threading.Tasks; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class MaintenanceRepository : BaseRepository, IMaintenanceRepository { diff --git a/src/Core/Repositories/SqlServer/OrganizationRepository.cs b/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs similarity index 97% rename from src/Core/Repositories/SqlServer/OrganizationRepository.cs rename to src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs index a545741b6..1e8283fad 100644 --- a/src/Core/Repositories/SqlServer/OrganizationRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class OrganizationRepository : Repository, IOrganizationRepository { diff --git a/src/Core/Repositories/SqlServer/OrganizationSponsorshipRepository.cs b/src/Infrastructure.Dapper/Repositories/OrganizationSponsorshipRepository.cs similarity index 96% rename from src/Core/Repositories/SqlServer/OrganizationSponsorshipRepository.cs rename to src/Infrastructure.Dapper/Repositories/OrganizationSponsorshipRepository.cs index 70b55d0d8..f80d3cf7d 100644 --- a/src/Core/Repositories/SqlServer/OrganizationSponsorshipRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/OrganizationSponsorshipRepository.cs @@ -3,11 +3,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class OrganizationSponsorshipRepository : Repository, IOrganizationSponsorshipRepository { diff --git a/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs b/src/Infrastructure.Dapper/Repositories/OrganizationUserRepository.cs similarity index 99% rename from src/Core/Repositories/SqlServer/OrganizationUserRepository.cs rename to src/Infrastructure.Dapper/Repositories/OrganizationUserRepository.cs index 84f247f5f..a129d4b75 100644 --- a/src/Core/Repositories/SqlServer/OrganizationUserRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/OrganizationUserRepository.cs @@ -4,15 +4,16 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; using Newtonsoft.Json; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class OrganizationUserRepository : Repository, IOrganizationUserRepository { diff --git a/src/Core/Repositories/SqlServer/PolicyRepository.cs b/src/Infrastructure.Dapper/Repositories/PolicyRepository.cs similarity index 97% rename from src/Core/Repositories/SqlServer/PolicyRepository.cs rename to src/Infrastructure.Dapper/Repositories/PolicyRepository.cs index 4d5a9fe28..9989cf200 100644 --- a/src/Core/Repositories/SqlServer/PolicyRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/PolicyRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class PolicyRepository : Repository, IPolicyRepository { diff --git a/src/Core/Repositories/SqlServer/ProviderOrganizationRepository.cs b/src/Infrastructure.Dapper/Repositories/ProviderOrganizationRepository.cs similarity index 94% rename from src/Core/Repositories/SqlServer/ProviderOrganizationRepository.cs rename to src/Infrastructure.Dapper/Repositories/ProviderOrganizationRepository.cs index c7060bf83..2b4d2f22d 100644 --- a/src/Core/Repositories/SqlServer/ProviderOrganizationRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/ProviderOrganizationRepository.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; using Microsoft.Data.SqlClient; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class ProviderOrganizationRepository : Repository, IProviderOrganizationRepository { diff --git a/src/Core/Repositories/SqlServer/ProviderRepository.cs b/src/Infrastructure.Dapper/Repositories/ProviderRepository.cs similarity index 93% rename from src/Core/Repositories/SqlServer/ProviderRepository.cs rename to src/Infrastructure.Dapper/Repositories/ProviderRepository.cs index 1740e8efd..6f56f58ca 100644 --- a/src/Core/Repositories/SqlServer/ProviderRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/ProviderRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class ProviderRepository : Repository, IProviderRepository { diff --git a/src/Core/Repositories/SqlServer/ProviderUserRepository.cs b/src/Infrastructure.Dapper/Repositories/ProviderUserRepository.cs similarity index 98% rename from src/Core/Repositories/SqlServer/ProviderUserRepository.cs rename to src/Infrastructure.Dapper/Repositories/ProviderUserRepository.cs index 0ba023396..4f59ce14a 100644 --- a/src/Core/Repositories/SqlServer/ProviderUserRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/ProviderUserRepository.cs @@ -3,15 +3,16 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; using Microsoft.Data.SqlClient; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class ProviderUserRepository : Repository, IProviderUserRepository { diff --git a/src/Core/Repositories/SqlServer/Repository.cs b/src/Infrastructure.Dapper/Repositories/Repository.cs similarity index 96% rename from src/Core/Repositories/SqlServer/Repository.cs rename to src/Infrastructure.Dapper/Repositories/Repository.cs index ba3cb3e04..e1c524430 100644 --- a/src/Core/Repositories/SqlServer/Repository.cs +++ b/src/Infrastructure.Dapper/Repositories/Repository.cs @@ -3,10 +3,11 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public abstract class Repository : BaseRepository, IRepository where TId : IEquatable diff --git a/src/Core/Repositories/SqlServer/SendRepository.cs b/src/Infrastructure.Dapper/Repositories/SendRepository.cs similarity index 94% rename from src/Core/Repositories/SqlServer/SendRepository.cs rename to src/Infrastructure.Dapper/Repositories/SendRepository.cs index f9aeee828..fa74f2603 100644 --- a/src/Core/Repositories/SqlServer/SendRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/SendRepository.cs @@ -4,11 +4,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class SendRepository : Repository, ISendRepository { diff --git a/src/Core/Repositories/SqlServer/SsoConfigRepository.cs b/src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs similarity index 95% rename from src/Core/Repositories/SqlServer/SsoConfigRepository.cs rename to src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs index 940c48aa1..26aef4081 100644 --- a/src/Core/Repositories/SqlServer/SsoConfigRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs @@ -4,11 +4,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class SsoConfigRepository : Repository, ISsoConfigRepository { diff --git a/src/Core/Repositories/SqlServer/SsoUserRepository.cs b/src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs similarity index 93% rename from src/Core/Repositories/SqlServer/SsoUserRepository.cs rename to src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs index 38ce2c95d..2249204e3 100644 --- a/src/Core/Repositories/SqlServer/SsoUserRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs @@ -3,11 +3,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class SsoUserRepository : Repository, ISsoUserRepository { diff --git a/src/Core/Repositories/SqlServer/TaxRateRepository.cs b/src/Infrastructure.Dapper/Repositories/TaxRateRepository.cs similarity index 95% rename from src/Core/Repositories/SqlServer/TaxRateRepository.cs rename to src/Infrastructure.Dapper/Repositories/TaxRateRepository.cs index 288cc94d7..8914b8835 100644 --- a/src/Core/Repositories/SqlServer/TaxRateRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/TaxRateRepository.cs @@ -3,11 +3,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class TaxRateRepository : Repository, ITaxRateRepository { diff --git a/src/Core/Repositories/SqlServer/TransactionRepository.cs b/src/Infrastructure.Dapper/Repositories/TransactionRepository.cs similarity index 95% rename from src/Core/Repositories/SqlServer/TransactionRepository.cs rename to src/Infrastructure.Dapper/Repositories/TransactionRepository.cs index a5be77de2..a4c1b7b53 100644 --- a/src/Core/Repositories/SqlServer/TransactionRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/TransactionRepository.cs @@ -4,12 +4,13 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class TransactionRepository : Repository, ITransactionRepository { diff --git a/src/Core/Repositories/SqlServer/U2fRepository.cs b/src/Infrastructure.Dapper/Repositories/U2fRepository.cs similarity index 94% rename from src/Core/Repositories/SqlServer/U2fRepository.cs rename to src/Infrastructure.Dapper/Repositories/U2fRepository.cs index 6f997c050..4b0c72a10 100644 --- a/src/Core/Repositories/SqlServer/U2fRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/U2fRepository.cs @@ -4,11 +4,12 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; -using Bit.Core.Models.Table; +using Bit.Core.Entities; +using Bit.Core.Repositories; using Bit.Core.Settings; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class U2fRepository : Repository, IU2fRepository { diff --git a/src/Core/Repositories/SqlServer/UserRepository.cs b/src/Infrastructure.Dapper/Repositories/UserRepository.cs similarity index 98% rename from src/Core/Repositories/SqlServer/UserRepository.cs rename to src/Infrastructure.Dapper/Repositories/UserRepository.cs index a558bed3c..58176d3f7 100644 --- a/src/Core/Repositories/SqlServer/UserRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/UserRepository.cs @@ -4,13 +4,14 @@ using System.Data; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Dapper; -namespace Bit.Core.Repositories.SqlServer +namespace Bit.Infrastructure.Dapper.Repositories { public class UserRepository : Repository, IUserRepository { diff --git a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs new file mode 100644 index 000000000..f8552ad2c --- /dev/null +++ b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs @@ -0,0 +1,65 @@ +using System; +using AutoMapper; +using Bit.Core.Enums; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories; +using LinqToDB.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; + +namespace Bit.Infrastructure.EntityFramework +{ + public static class EntityFrameworkServiceCollectionExtensions + { + public static void AddEFRepositories(this IServiceCollection services, bool selfHosted, string connectionString, + SupportedDatabaseProviders provider) + { + if (string.IsNullOrWhiteSpace(connectionString)) + { + throw new Exception($"Database provider type {provider} was selected but no connection string was found."); + } + LinqToDBForEFTools.Initialize(); + services.AddAutoMapper(typeof(UserRepository)); + services.AddDbContext(options => + { + if (provider == SupportedDatabaseProviders.Postgres) + { + options.UseNpgsql(connectionString); + } + else if (provider == SupportedDatabaseProviders.MySql) + { + options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); + } + }); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + + if (selfHosted) + { + services.AddSingleton(); + } + } + } +} diff --git a/src/Infrastructure.EntityFramework/Infrastructure.EntityFramework.csproj b/src/Infrastructure.EntityFramework/Infrastructure.EntityFramework.csproj new file mode 100644 index 000000000..671d5c3d0 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Infrastructure.EntityFramework.csproj @@ -0,0 +1,19 @@ + + + + net5.0 + + + + + + + + + + + + + + + diff --git a/src/Core/Models/EntityFramework/Cipher.cs b/src/Infrastructure.EntityFramework/Models/Cipher.cs similarity index 69% rename from src/Core/Models/EntityFramework/Cipher.cs rename to src/Infrastructure.EntityFramework/Models/Cipher.cs index 59b21cc14..06cbcb04a 100644 --- a/src/Core/Models/EntityFramework/Cipher.cs +++ b/src/Infrastructure.EntityFramework/Models/Cipher.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -using System.Text.Json; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Cipher : Table.Cipher + public class Cipher : Core.Entities.Cipher { public virtual User User { get; set; } public virtual Organization Organization { get; set; } @@ -15,7 +14,7 @@ namespace Bit.Core.Models.EntityFramework { public CipherMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/Collection.cs b/src/Infrastructure.EntityFramework/Models/Collection.cs similarity index 73% rename from src/Core/Models/EntityFramework/Collection.cs rename to src/Infrastructure.EntityFramework/Models/Collection.cs index 4b4688cef..07ffd8d58 100644 --- a/src/Core/Models/EntityFramework/Collection.cs +++ b/src/Infrastructure.EntityFramework/Models/Collection.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -using System.Text.Json; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Collection : Table.Collection + public class Collection : Core.Entities.Collection { public virtual Organization Organization { get; set; } public virtual ICollection CollectionUsers { get; set; } @@ -16,7 +15,7 @@ namespace Bit.Core.Models.EntityFramework { public CollectionMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/CollectionCipher.cs b/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs similarity index 50% rename from src/Core/Models/EntityFramework/CollectionCipher.cs rename to src/Infrastructure.EntityFramework/Models/CollectionCipher.cs index fcff668a7..8a7de5a78 100644 --- a/src/Core/Models/EntityFramework/CollectionCipher.cs +++ b/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class CollectionCipher : Table.CollectionCipher + public class CollectionCipher : Core.Entities.CollectionCipher { public virtual Cipher Cipher { get; set; } public virtual Collection Collection { get; set; } @@ -14,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public CollectionCipherMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/CollectionGroup.cs b/src/Infrastructure.EntityFramework/Models/CollectionGroup.cs similarity index 58% rename from src/Core/Models/EntityFramework/CollectionGroup.cs rename to src/Infrastructure.EntityFramework/Models/CollectionGroup.cs index ba97c366f..fdded3521 100644 --- a/src/Core/Models/EntityFramework/CollectionGroup.cs +++ b/src/Infrastructure.EntityFramework/Models/CollectionGroup.cs @@ -1,8 +1,8 @@ using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class CollectionGroup : Table.CollectionGroup + public class CollectionGroup : Core.Entities.CollectionGroup { public virtual Collection Collection { get; set; } public virtual Group Group { get; set; } @@ -12,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public CollectionGroupMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/CollectionUser.cs b/src/Infrastructure.EntityFramework/Models/CollectionUser.cs similarity index 60% rename from src/Core/Models/EntityFramework/CollectionUser.cs rename to src/Infrastructure.EntityFramework/Models/CollectionUser.cs index f959728df..24d10c2a7 100644 --- a/src/Core/Models/EntityFramework/CollectionUser.cs +++ b/src/Infrastructure.EntityFramework/Models/CollectionUser.cs @@ -1,8 +1,8 @@ using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class CollectionUser : Table.CollectionUser + public class CollectionUser : Core.Entities.CollectionUser { public virtual Collection Collection { get; set; } public virtual OrganizationUser OrganizationUser { get; set; } @@ -12,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public CollectionUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/Device.cs b/src/Infrastructure.EntityFramework/Models/Device.cs new file mode 100644 index 000000000..675ed917a --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Device.cs @@ -0,0 +1,17 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Device : Core.Entities.Device + { + public virtual User User { get; set; } + } + + public class DeviceMapperProfile : Profile + { + public DeviceMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs b/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs new file mode 100644 index 000000000..e92eba8ee --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs @@ -0,0 +1,18 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class EmergencyAccess : Core.Entities.EmergencyAccess + { + public virtual User Grantee { get; set; } + public virtual User Grantor { get; set; } + } + + public class EmergencyAccessMapperProfile : Profile + { + public EmergencyAccessMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Infrastructure.EntityFramework/Models/Event.cs b/src/Infrastructure.EntityFramework/Models/Event.cs new file mode 100644 index 000000000..558f2a285 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Event.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Event : Core.Entities.Event + { + } + + public class EventMapperProfile : Profile + { + public EventMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Infrastructure.EntityFramework/Models/Folder.cs b/src/Infrastructure.EntityFramework/Models/Folder.cs new file mode 100644 index 000000000..1918dfe73 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Folder.cs @@ -0,0 +1,17 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Folder : Core.Entities.Folder + { + public virtual User User { get; set; } + } + + public class FolderMapperProfile : Profile + { + public FolderMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Infrastructure.EntityFramework/Models/Grant.cs b/src/Infrastructure.EntityFramework/Models/Grant.cs new file mode 100644 index 000000000..251d16437 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Grant.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Grant : Core.Entities.Grant + { + } + + public class GrantMapperProfile : Profile + { + public GrantMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/Group.cs b/src/Infrastructure.EntityFramework/Models/Group.cs similarity index 66% rename from src/Core/Models/EntityFramework/Group.cs rename to src/Infrastructure.EntityFramework/Models/Group.cs index b40a0f0f6..3ae89f9d5 100644 --- a/src/Core/Models/EntityFramework/Group.cs +++ b/src/Infrastructure.EntityFramework/Models/Group.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -using System.Text.Json; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Group : Table.Group + public class Group : Core.Entities.Group { public virtual Organization Organization { get; set; } public virtual ICollection GroupUsers { get; set; } @@ -14,7 +13,7 @@ namespace Bit.Core.Models.EntityFramework { public GroupMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/GroupUser.cs b/src/Infrastructure.EntityFramework/Models/GroupUser.cs similarity index 52% rename from src/Core/Models/EntityFramework/GroupUser.cs rename to src/Infrastructure.EntityFramework/Models/GroupUser.cs index f1635aed2..5a81ed884 100644 --- a/src/Core/Models/EntityFramework/GroupUser.cs +++ b/src/Infrastructure.EntityFramework/Models/GroupUser.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class GroupUser : Table.GroupUser + public class GroupUser : Core.Entities.GroupUser { public virtual Group Group { get; set; } public virtual OrganizationUser OrganizationUser { get; set; } @@ -14,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public GroupUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/Installation.cs b/src/Infrastructure.EntityFramework/Models/Installation.cs new file mode 100644 index 000000000..92bbd2abb --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Installation.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Installation : Core.Entities.Installation + { + } + + public class InstallationMapperProfile : Profile + { + public InstallationMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/Organization.cs b/src/Infrastructure.EntityFramework/Models/Organization.cs similarity index 78% rename from src/Core/Models/EntityFramework/Organization.cs rename to src/Infrastructure.EntityFramework/Models/Organization.cs index ff3d29b9a..40c7d19ae 100644 --- a/src/Core/Models/EntityFramework/Organization.cs +++ b/src/Infrastructure.EntityFramework/Models/Organization.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Organization : Table.Organization + public class Organization : Core.Entities.Organization { public virtual ICollection Ciphers { get; set; } public virtual ICollection OrganizationUsers { get; set; } @@ -18,7 +18,7 @@ namespace Bit.Core.Models.EntityFramework { public OrganizationMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/OrganizationSponsorship.cs b/src/Infrastructure.EntityFramework/Models/OrganizationSponsorship.cs similarity index 58% rename from src/Core/Models/EntityFramework/OrganizationSponsorship.cs rename to src/Infrastructure.EntityFramework/Models/OrganizationSponsorship.cs index 53dcd3e9e..a80e950e2 100644 --- a/src/Core/Models/EntityFramework/OrganizationSponsorship.cs +++ b/src/Infrastructure.EntityFramework/Models/OrganizationSponsorship.cs @@ -1,9 +1,8 @@ -using System.Collections.Generic; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class OrganizationSponsorship : Table.OrganizationSponsorship + public class OrganizationSponsorship : Core.Entities.OrganizationSponsorship { public virtual Installation Installation { get; set; } public virtual Organization SponsoringOrganization { get; set; } @@ -14,7 +13,7 @@ namespace Bit.Core.Models.EntityFramework { public OrganizationSponsorshipMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/OrganizationUser.cs b/src/Infrastructure.EntityFramework/Models/OrganizationUser.cs similarity index 65% rename from src/Core/Models/EntityFramework/OrganizationUser.cs rename to src/Infrastructure.EntityFramework/Models/OrganizationUser.cs index 74dd98fae..255e35c5d 100644 --- a/src/Core/Models/EntityFramework/OrganizationUser.cs +++ b/src/Infrastructure.EntityFramework/Models/OrganizationUser.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -using System.Text.Json; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class OrganizationUser : Table.OrganizationUser + public class OrganizationUser : Core.Entities.OrganizationUser { public virtual Organization Organization { get; set; } public virtual User User { get; set; } @@ -15,7 +14,7 @@ namespace Bit.Core.Models.EntityFramework { public OrganizationUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/Policy.cs b/src/Infrastructure.EntityFramework/Models/Policy.cs new file mode 100644 index 000000000..953556cdd --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Policy.cs @@ -0,0 +1,17 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Policy : Core.Entities.Policy + { + public virtual Organization Organization { get; set; } + } + + public class PolicyMapperProfile : Profile + { + public PolicyMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Infrastructure.EntityFramework/Models/Provider/Provider.cs b/src/Infrastructure.EntityFramework/Models/Provider/Provider.cs new file mode 100644 index 000000000..8efa1558d --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Provider/Provider.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Provider : Core.Entities.Provider.Provider + { + } + + public class ProviderMapperProfile : Profile + { + public ProviderMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/Provider/ProviderOrganization.cs b/src/Infrastructure.EntityFramework/Models/Provider/ProviderOrganization.cs similarity index 55% rename from src/Core/Models/EntityFramework/Provider/ProviderOrganization.cs rename to src/Infrastructure.EntityFramework/Models/Provider/ProviderOrganization.cs index f05216946..13aa52110 100644 --- a/src/Core/Models/EntityFramework/Provider/ProviderOrganization.cs +++ b/src/Infrastructure.EntityFramework/Models/Provider/ProviderOrganization.cs @@ -1,8 +1,8 @@ using AutoMapper; -namespace Bit.Core.Models.EntityFramework.Provider +namespace Bit.Infrastructure.EntityFramework.Models { - public class ProviderOrganization : Table.Provider.ProviderOrganization + public class ProviderOrganization : Core.Entities.Provider.ProviderOrganization { public virtual Provider Provider { get; set; } public virtual Organization Organization { get; set; } @@ -12,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework.Provider { public ProviderOrganizationMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Models/EntityFramework/Provider/ProviderUser.cs b/src/Infrastructure.EntityFramework/Models/Provider/ProviderUser.cs similarity index 56% rename from src/Core/Models/EntityFramework/Provider/ProviderUser.cs rename to src/Infrastructure.EntityFramework/Models/Provider/ProviderUser.cs index 7b4480073..9aac138be 100644 --- a/src/Core/Models/EntityFramework/Provider/ProviderUser.cs +++ b/src/Infrastructure.EntityFramework/Models/Provider/ProviderUser.cs @@ -1,8 +1,8 @@ using AutoMapper; -namespace Bit.Core.Models.EntityFramework.Provider +namespace Bit.Infrastructure.EntityFramework.Models { - public class ProviderUser : Table.Provider.ProviderUser + public class ProviderUser : Core.Entities.Provider.ProviderUser { public virtual User User { get; set; } public virtual Provider Provider { get; set; } @@ -12,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework.Provider { public ProviderUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/Role.cs b/src/Infrastructure.EntityFramework/Models/Role.cs new file mode 100644 index 000000000..a92682e2e --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/Role.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class Role : Core.Entities.Role + { + } + + public class RoleMapperProfile : Profile + { + public RoleMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/Send.cs b/src/Infrastructure.EntityFramework/Models/Send.cs similarity index 53% rename from src/Core/Models/EntityFramework/Send.cs rename to src/Infrastructure.EntityFramework/Models/Send.cs index 7343b3216..5732ac2a1 100644 --- a/src/Core/Models/EntityFramework/Send.cs +++ b/src/Infrastructure.EntityFramework/Models/Send.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Send : Table.Send + public class Send : Core.Entities.Send { public virtual Organization Organization { get; set; } public virtual User User { get; set; } @@ -14,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public SendMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/SsoConfig.cs b/src/Infrastructure.EntityFramework/Models/SsoConfig.cs new file mode 100644 index 000000000..d748934f2 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/SsoConfig.cs @@ -0,0 +1,17 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class SsoConfig : Core.Entities.SsoConfig + { + public virtual Organization Organization { get; set; } + } + + public class SsoConfigMapperProfile : Profile + { + public SsoConfigMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/SsoUser.cs b/src/Infrastructure.EntityFramework/Models/SsoUser.cs similarity index 52% rename from src/Core/Models/EntityFramework/SsoUser.cs rename to src/Infrastructure.EntityFramework/Models/SsoUser.cs index c3aef552f..eb0298442 100644 --- a/src/Core/Models/EntityFramework/SsoUser.cs +++ b/src/Infrastructure.EntityFramework/Models/SsoUser.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class SsoUser : Table.SsoUser + public class SsoUser : Core.Entities.SsoUser { public virtual Organization Organization { get; set; } public virtual User User { get; set; } @@ -14,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public SsoUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/TaxRate.cs b/src/Infrastructure.EntityFramework/Models/TaxRate.cs new file mode 100644 index 000000000..f464724ae --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/TaxRate.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class TaxRate : Core.Entities.TaxRate + { + } + + public class TaxRateMapperProfile : Profile + { + public TaxRateMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/Transaction.cs b/src/Infrastructure.EntityFramework/Models/Transaction.cs similarity index 51% rename from src/Core/Models/EntityFramework/Transaction.cs rename to src/Infrastructure.EntityFramework/Models/Transaction.cs index 820f8091b..b9d4bc954 100644 --- a/src/Core/Models/EntityFramework/Transaction.cs +++ b/src/Infrastructure.EntityFramework/Models/Transaction.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; -using System.Text.Json; -using AutoMapper; +using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class Transaction : Table.Transaction + public class Transaction : Core.Entities.Transaction { public virtual Organization Organization { get; set; } public virtual User User { get; set; } @@ -14,7 +12,7 @@ namespace Bit.Core.Models.EntityFramework { public TransactionMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Infrastructure.EntityFramework/Models/U2f.cs b/src/Infrastructure.EntityFramework/Models/U2f.cs new file mode 100644 index 000000000..fea13b3b9 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Models/U2f.cs @@ -0,0 +1,17 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.Models +{ + public class U2f : Core.Entities.U2f + { + public virtual User User { get; set; } + } + + public class U2fMapperProfile : Profile + { + public U2fMapperProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/src/Core/Models/EntityFramework/User.cs b/src/Infrastructure.EntityFramework/Models/User.cs similarity index 82% rename from src/Core/Models/EntityFramework/User.cs rename to src/Infrastructure.EntityFramework/Models/User.cs index 1836bec44..cf9834260 100644 --- a/src/Core/Models/EntityFramework/User.cs +++ b/src/Infrastructure.EntityFramework/Models/User.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -using System.Text.Json; using AutoMapper; -namespace Bit.Core.Models.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Models { - public class User : Table.User + public class User : Core.Entities.User { public virtual ICollection Ciphers { get; set; } public virtual ICollection Folders { get; set; } @@ -20,7 +19,7 @@ namespace Bit.Core.Models.EntityFramework { public UserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } diff --git a/src/Core/Repositories/EntityFramework/BaseEntityFrameworkRepository.cs b/src/Infrastructure.EntityFramework/Repositories/BaseEntityFrameworkRepository.cs similarity index 96% rename from src/Core/Repositories/EntityFramework/BaseEntityFrameworkRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/BaseEntityFrameworkRepository.cs index 2e842fbc9..8ab5bac61 100644 --- a/src/Core/Repositories/EntityFramework/BaseEntityFrameworkRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/BaseEntityFrameworkRepository.cs @@ -6,14 +6,15 @@ using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; using Bit.Core.Enums.Provider; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using LinqToDB.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; +using Cipher = Bit.Core.Entities.Cipher; +using User = Bit.Core.Entities.User; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public abstract class BaseEntityFrameworkRepository { @@ -129,7 +130,7 @@ namespace Bit.Core.Repositories.EntityFramework .ToListAsync(); var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateArray() .Sum(p => p.GetProperty("Size").GetInt64()) ?? 0); - var organization = new EfModel.Organization + var organization = new Organization { Id = organizationId, RevisionDate = DateTime.UtcNow, @@ -157,7 +158,7 @@ namespace Bit.Core.Repositories.EntityFramework .ToListAsync(); var storage = attachments.Sum(e => JsonDocument.Parse(e)?.RootElement.EnumerateArray() .Sum(p => p.GetProperty("Size").GetInt64()) ?? 0); - var user = new EfModel.User + var user = new Models.User { Id = userId, RevisionDate = DateTime.UtcNow, diff --git a/src/Core/Repositories/EntityFramework/CipherRepository.cs b/src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/CipherRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs index 279637d45..f92d8abbc 100644 --- a/src/Core/Repositories/EntityFramework/CipherRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs @@ -5,28 +5,27 @@ using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; using Bit.Core.Utilities; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Core.Models.Data; -using LinqToDB.Data; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; +using User = Bit.Core.Entities.User; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class CipherRepository : Repository, ICipherRepository + public class CipherRepository : Repository, ICipherRepository { public CipherRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Ciphers) { } - public override async Task CreateAsync(Cipher cipher) + public override async Task CreateAsync(Core.Entities.Cipher cipher) { cipher = await base.CreateAsync(cipher); using (var scope = ServiceScopeFactory.CreateScope()) @@ -44,7 +43,7 @@ namespace Bit.Core.Repositories.EntityFramework return cipher; } - public IQueryable GetBumpedAccountsByCipherId(Cipher cipher) + public IQueryable GetBumpedAccountsByCipherId(Core.Entities.Cipher cipher) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -54,13 +53,13 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task CreateAsync(Cipher cipher, IEnumerable collectionIds) + public async Task CreateAsync(Core.Entities.Cipher cipher, IEnumerable collectionIds) { cipher = await base.CreateAsync(cipher); await UpdateCollections(cipher, collectionIds); } - private async Task UpdateCollections(Cipher cipher, IEnumerable collectionIds) + private async Task UpdateCollections(Core.Entities.Cipher cipher, IEnumerable collectionIds) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -91,7 +90,7 @@ namespace Bit.Core.Repositories.EntityFramework cipher.Folders = cipher.FolderId.HasValue ? $"{{{userIdKey}:\"{cipher.FolderId}\"}}" : null; - var entity = Mapper.Map((TableModel.Cipher)cipher); + var entity = Mapper.Map((Core.Entities.Cipher)cipher); await dbContext.AddAsync(entity); await dbContext.SaveChangesAsync(); } @@ -105,7 +104,7 @@ namespace Bit.Core.Repositories.EntityFramework await UpdateCollections(cipher, collectionIds); } - public async Task CreateAsync(IEnumerable ciphers, IEnumerable folders) + public async Task CreateAsync(IEnumerable ciphers, IEnumerable folders) { if (!ciphers.Any()) { @@ -115,15 +114,15 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var folderEntities = Mapper.Map>(folders); + var folderEntities = Mapper.Map>(folders); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, folderEntities); - var cipherEntities = Mapper.Map>(ciphers); + var cipherEntities = Mapper.Map>(ciphers); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, cipherEntities); await UserBumpAccountRevisionDateByCipherId(ciphers); } } - public async Task CreateAsync(IEnumerable ciphers, IEnumerable collections, IEnumerable collectionCiphers) + public async Task CreateAsync(IEnumerable ciphers, IEnumerable collections, IEnumerable collectionCiphers) { if (!ciphers.Any()) { @@ -132,16 +131,16 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var cipherEntities = Mapper.Map>(ciphers); + var cipherEntities = Mapper.Map>(ciphers); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, cipherEntities); if (collections.Any()) { - var collectionEntities = Mapper.Map>(collections); + var collectionEntities = Mapper.Map>(collections); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, collectionEntities); if (collectionCiphers.Any()) { - var collectionCipherEntities = Mapper.Map>(collectionCiphers); + var collectionCipherEntities = Mapper.Map>(collectionCiphers); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, collectionCipherEntities); } } @@ -271,14 +270,14 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = dbContext.Ciphers.Where(x => !x.UserId.HasValue && x.OrganizationId == organizationId); var data = await query.ToListAsync(); - return Mapper.Map>(data); + return Mapper.Map>(data); } } @@ -419,7 +418,7 @@ namespace Bit.Core.Repositories.EntityFramework cipher.Favorites = JsonConvert.SerializeObject(folders); } } - var mappedEntity = Mapper.Map((TableModel.Cipher)cipher); + var mappedEntity = Mapper.Map((Core.Entities.Cipher)cipher); dbContext.Entry(entity).CurrentValues.SetValues(mappedEntity); await UserBumpAccountRevisionDateByCipherId(cipher); await dbContext.SaveChangesAsync(); @@ -427,7 +426,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task ReplaceAsync(Cipher obj, IEnumerable collectionIds) + public async Task ReplaceAsync(Core.Entities.Cipher obj, IEnumerable collectionIds) { await UpdateCollections(obj, collectionIds); using (var scope = ServiceScopeFactory.CreateScope()) @@ -551,7 +550,7 @@ namespace Bit.Core.Repositories.EntityFramework if (attachment.OrganizationId.HasValue) { await OrganizationUpdateStorage(cipher.OrganizationId.Value); - await UserBumpAccountRevisionDateByCipherId(new List { cipher }); + await UserBumpAccountRevisionDateByCipherId(new List { cipher }); } else if (attachment.UserId.HasValue) { @@ -561,7 +560,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task UpdateCiphersAsync(Guid userId, IEnumerable ciphers) + public async Task UpdateCiphersAsync(Guid userId, IEnumerable ciphers) { if (!ciphers.Any()) { @@ -570,7 +569,7 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var entities = Mapper.Map>(ciphers); + var entities = Mapper.Map>(ciphers); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, entities); await UserBumpAccountRevisionDate(userId); } @@ -612,17 +611,17 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable ciphers, IEnumerable folders, IEnumerable sends) + public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable ciphers, IEnumerable folders, IEnumerable sends) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); await UserUpdateKeys(user); - var cipherEntities = Mapper.Map>(ciphers); + var cipherEntities = Mapper.Map>(ciphers); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, cipherEntities); - var folderEntities = Mapper.Map>(folders); + var folderEntities = Mapper.Map>(folders); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, folderEntities); - var sendEntities = Mapper.Map>(sends); + var sendEntities = Mapper.Map>(sends); await dbContext.BulkCopyAsync(base.DefaultBulkCopyOptions, sendEntities); await dbContext.SaveChangesAsync(); } diff --git a/src/Core/Repositories/EntityFramework/CollectionCipherRepository.cs b/src/Infrastructure.EntityFramework/Repositories/CollectionCipherRepository.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/CollectionCipherRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/CollectionCipherRepository.cs index e7f958008..93f7180e7 100644 --- a/src/Core/Repositories/EntityFramework/CollectionCipherRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/CollectionCipherRepository.cs @@ -4,13 +4,13 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; +using CollectionCipher = Bit.Core.Entities.CollectionCipher; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class CollectionCipherRepository : BaseEntityFrameworkRepository, ICollectionCipherRepository { @@ -23,7 +23,7 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var entity = Mapper.Map(obj); + var entity = Mapper.Map(obj); dbContext.Add(entity); await dbContext.SaveChangesAsync(); var organizationId = (await dbContext.Ciphers.FirstOrDefaultAsync(c => c.Id.Equals(obj.CipherId))).OrganizationId; @@ -122,14 +122,14 @@ namespace Bit.Core.Repositories.EntityFramework var union = merge1.Union(merge2).Distinct(); var insert = union .Where(x => x.t == null && collectionIds.Contains(x.s.CollectionId)) - .Select(x => new EfModel.CollectionCipher + .Select(x => new Models.CollectionCipher { CollectionId = x.s.CollectionId, CipherId = x.s.CipherId, }); var delete = union .Where(x => x.s == null && x.t.CipherId == cipherId && collectionIds.Contains(x.t.CollectionId)) - .Select(x => new EfModel.CollectionCipher + .Select(x => new Models.CollectionCipher { CollectionId = x.t.CollectionId, CipherId = x.t.CipherId, @@ -172,14 +172,14 @@ namespace Bit.Core.Repositories.EntityFramework var union = merge1.Union(merge2).Distinct(); var insert = union .Where(x => x.t == null && collectionIds.Contains(x.s.CollectionId)) - .Select(x => new EfModel.CollectionCipher + .Select(x => new Models.CollectionCipher { CollectionId = x.s.CollectionId, CipherId = x.s.CipherId, }); var delete = union .Where(x => x.s == null && x.t.CipherId == cipherId) - .Select(x => new EfModel.CollectionCipher + .Select(x => new Models.CollectionCipher { CollectionId = x.t.CollectionId, CipherId = x.t.CipherId, @@ -229,7 +229,7 @@ namespace Bit.Core.Repositories.EntityFramework var insertData = from collectionId in collectionIds from cipherId in cipherIds where availibleCollections.Select(x => x.c.Id).Contains(collectionId) - select new EfModel.CollectionCipher + select new Models.CollectionCipher { CollectionId = collectionId, CipherId = cipherId, diff --git a/src/Core/Repositories/EntityFramework/CollectionRepository.cs b/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs similarity index 89% rename from src/Core/Repositories/EntityFramework/CollectionRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs index 7be9c5fec..c0109cec8 100644 --- a/src/Core/Repositories/EntityFramework/CollectionRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs @@ -4,29 +4,28 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class CollectionRepository : Repository, ICollectionRepository + public class CollectionRepository : Repository, ICollectionRepository { public CollectionRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Collections) { } - public override async Task CreateAsync(Collection obj) + public override async Task CreateAsync(Core.Entities.Collection obj) { await base.CreateAsync(obj); await UserBumpAccountRevisionDateByCollectionId(obj.Id, obj.OrganizationId); return obj; } - public async Task CreateAsync(Collection obj, IEnumerable groups) + public async Task CreateAsync(Core.Entities.Collection obj, IEnumerable groups) { await base.CreateAsync(obj); using (var scope = ServiceScopeFactory.CreateScope()) @@ -37,7 +36,7 @@ namespace Bit.Core.Repositories.EntityFramework select g.Id).ToListAsync(); var collectionGroups = groups .Where(g => availibleGroups.Contains(g.Id)) - .Select(g => new EfModel.CollectionGroup + .Select(g => new CollectionGroup { CollectionId = obj.Id, GroupId = g.Id, @@ -74,7 +73,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task>> GetByIdWithGroupsAsync(Guid id) + public async Task>> GetByIdWithGroupsAsync(Guid id) { var collection = await base.GetByIdAsync(id); using (var scope = ServiceScopeFactory.CreateScope()) @@ -89,7 +88,7 @@ namespace Bit.Core.Repositories.EntityFramework ReadOnly = cg.ReadOnly, HidePasswords = cg.HidePasswords, }).ToList(); - return new Tuple>(collection, selectionReadOnlys); + return new Tuple>(collection, selectionReadOnlys); } } @@ -118,7 +117,7 @@ namespace Bit.Core.Repositories.EntityFramework return await GetCountFromQuery(query); } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -170,7 +169,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task ReplaceAsync(Collection collection, IEnumerable groups) + public async Task ReplaceAsync(Core.Entities.Collection collection, IEnumerable groups) { await base.ReplaceAsync(collection); using (var scope = ServiceScopeFactory.CreateScope()) @@ -197,7 +196,7 @@ namespace Bit.Core.Repositories.EntityFramework .AsNoTracking() .ToListAsync(); var insert = union.Where(x => x.cg == null && groupsInOrg.Any(c => x.g.Id == c.Id)) - .Select(x => new EfModel.CollectionGroup + .Select(x => new CollectionGroup { CollectionId = collection.Id, GroupId = x.g.Id, @@ -211,7 +210,7 @@ namespace Bit.Core.Repositories.EntityFramework (x.cg.ReadOnly != groups.FirstOrDefault(g => g.Id == x.g.Id).ReadOnly || x.cg.HidePasswords != groups.FirstOrDefault(g => g.Id == x.g.Id).HidePasswords) ) - .Select(x => new EfModel.CollectionGroup + .Select(x => new CollectionGroup { CollectionId = collection.Id, GroupId = x.g.Id, @@ -223,7 +222,7 @@ namespace Bit.Core.Repositories.EntityFramework x => x.g == null && x.cg.CollectionId == collection.Id ) - .Select(x => new EfModel.CollectionGroup + .Select(x => new CollectionGroup { CollectionId = collection.Id, GroupId = x.cg.GroupId, diff --git a/src/Core/Repositories/EntityFramework/DatabaseContext.cs b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs similarity index 98% rename from src/Core/Repositories/EntityFramework/DatabaseContext.cs rename to src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs index 1ba7053ab..f0ee73d6e 100644 --- a/src/Core/Repositories/EntityFramework/DatabaseContext.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs @@ -1,8 +1,7 @@ -using Bit.Core.Models.EntityFramework; -using Bit.Core.Models.EntityFramework.Provider; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class DatabaseContext : DbContext { diff --git a/src/Core/Repositories/EntityFramework/DeviceRepository.cs b/src/Infrastructure.EntityFramework/Repositories/DeviceRepository.cs similarity index 70% rename from src/Core/Repositories/EntityFramework/DeviceRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/DeviceRepository.cs index 0cb17acba..62e84ce92 100644 --- a/src/Core/Repositories/EntityFramework/DeviceRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DeviceRepository.cs @@ -3,15 +3,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class DeviceRepository : Repository, IDeviceRepository + public class DeviceRepository : Repository, IDeviceRepository { public DeviceRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Devices) @@ -29,7 +28,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetByIdAsync(Guid id, Guid userId) + public async Task GetByIdAsync(Guid id, Guid userId) { var device = await base.GetByIdAsync(id); if (device == null || device.UserId != userId) @@ -37,39 +36,39 @@ namespace Bit.Core.Repositories.EntityFramework return null; } - return Mapper.Map(device); + return Mapper.Map(device); } - public async Task GetByIdentifierAsync(string identifier) + public async Task GetByIdentifierAsync(string identifier) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = dbContext.Devices.Where(d => d.Identifier == identifier); var device = await query.FirstOrDefaultAsync(); - return Mapper.Map(device); + return Mapper.Map(device); } } - public async Task GetByIdentifierAsync(string identifier, Guid userId) + public async Task GetByIdentifierAsync(string identifier, Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = dbContext.Devices.Where(d => d.Identifier == identifier && d.UserId == userId); var device = await query.FirstOrDefaultAsync(); - return Mapper.Map(device); + return Mapper.Map(device); } } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = dbContext.Devices.Where(d => d.UserId == userId); var devices = await query.ToListAsync(); - return Mapper.Map>(devices); + return Mapper.Map>(devices); } } } diff --git a/src/Core/Repositories/EntityFramework/EmergencyAccessRepository.cs b/src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs similarity index 92% rename from src/Core/Repositories/EntityFramework/EmergencyAccessRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs index e226f09c0..ecddaa23d 100644 --- a/src/Core/Repositories/EntityFramework/EmergencyAccessRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs @@ -5,15 +5,15 @@ using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository + public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository { public EmergencyAccessRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.EmergencyAccesses) diff --git a/src/Core/Repositories/EntityFramework/EventRepository.cs b/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs similarity index 93% rename from src/Core/Repositories/EntityFramework/EventRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/EventRepository.cs index bea5ed067..890f6761b 100644 --- a/src/Core/Repositories/EntityFramework/EventRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs @@ -4,18 +4,17 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; +using Cipher = Bit.Core.Entities.Cipher; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class EventRepository : Repository, IEventRepository + public class EventRepository : Repository, IEventRepository { public EventRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Events) @@ -23,9 +22,9 @@ namespace Bit.Core.Repositories.EntityFramework public async Task CreateAsync(IEvent e) { - if (e is not Event ev) + if (e is not Core.Entities.Event ev) { - ev = new Event(e); + ev = new Core.Entities.Event(e); } await base.CreateAsync(ev); @@ -47,8 +46,8 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var tableEvents = entities.Select(e => e as Event ?? new Event(e)); - var entityEvents = Mapper.Map>(tableEvents); + var tableEvents = entities.Select(e => e as Core.Entities.Event ?? new Core.Entities.Event(e)); + var entityEvents = Mapper.Map>(tableEvents); entityEvents.ForEach(e => e.SetNewId()); await dbContext.BulkCopyAsync(entityEvents); } diff --git a/src/Core/Repositories/EntityFramework/FolderRepository.cs b/src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs similarity index 65% rename from src/Core/Repositories/EntityFramework/FolderRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs index 48d7b29f4..937bdd7d5 100644 --- a/src/Core/Repositories/EntityFramework/FolderRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs @@ -3,22 +3,20 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class FolderRepository : Repository, IFolderRepository + public class FolderRepository : Repository, IFolderRepository { public FolderRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Folders) { } - public async Task GetByIdAsync(Guid id, Guid userId) + public async Task GetByIdAsync(Guid id, Guid userId) { var folder = await base.GetByIdAsync(id); if (folder == null || folder.UserId != userId) @@ -29,7 +27,7 @@ namespace Bit.Core.Repositories.EntityFramework return folder; } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -38,7 +36,7 @@ namespace Bit.Core.Repositories.EntityFramework where f.UserId == userId select f; var folders = await query.ToListAsync(); - return Mapper.Map>(folders); + return Mapper.Map>(folders); } } } diff --git a/src/Core/Repositories/EntityFramework/GrantRepository.cs b/src/Infrastructure.EntityFramework/Repositories/GrantRepository.cs similarity index 84% rename from src/Core/Repositories/EntityFramework/GrantRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/GrantRepository.cs index 033ce64f0..707b4bd24 100644 --- a/src/Core/Repositories/EntityFramework/GrantRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/GrantRepository.cs @@ -1,16 +1,13 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class GrantRepository : BaseEntityFrameworkRepository, IGrantRepository { @@ -47,7 +44,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetByKeyAsync(string key) + public async Task GetByKeyAsync(string key) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -60,7 +57,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> GetManyAsync(string subjectId, string sessionId, string clientId, string type) + public async Task> GetManyAsync(string subjectId, string sessionId, string clientId, string type) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -72,11 +69,11 @@ namespace Bit.Core.Repositories.EntityFramework g.Type == type select g; var grants = await query.ToListAsync(); - return (ICollection)grants; + return (ICollection)grants; } } - public async Task SaveAsync(Grant obj) + public async Task SaveAsync(Core.Entities.Grant obj) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -90,7 +87,7 @@ namespace Bit.Core.Repositories.EntityFramework } else { - var entity = Mapper.Map(obj); + var entity = Mapper.Map(obj); await dbContext.AddAsync(entity); await dbContext.SaveChangesAsync(); } diff --git a/src/Core/Repositories/EntityFramework/GroupRepository.cs b/src/Infrastructure.EntityFramework/Repositories/GroupRepository.cs similarity index 84% rename from src/Core/Repositories/EntityFramework/GroupRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/GroupRepository.cs index 416b8e4a8..1d127854e 100644 --- a/src/Core/Repositories/EntityFramework/GroupRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/GroupRepository.cs @@ -4,22 +4,20 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class GroupRepository : Repository, IGroupRepository + public class GroupRepository : Repository, IGroupRepository { public GroupRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Groups) { } - public async Task CreateAsync(Group obj, IEnumerable collections) + public async Task CreateAsync(Core.Entities.Group obj, IEnumerable collections) { var grp = await base.CreateAsync(obj); using (var scope = ServiceScopeFactory.CreateScope()) @@ -30,7 +28,7 @@ namespace Bit.Core.Repositories.EntityFramework where c.OrganizationId == grp.OrganizationId select c).ToListAsync(); var filteredCollections = collections.Where(c => availibleCollections.Any(a => c.Id == a.Id)); - var collectionGroups = filteredCollections.Select(y => new EfModel.CollectionGroup + var collectionGroups = filteredCollections.Select(y => new CollectionGroup { CollectionId = y.Id, GroupId = grp.Id, @@ -56,7 +54,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task>> GetByIdWithCollectionsAsync(Guid id) + public async Task>> GetByIdWithCollectionsAsync(Guid id) { var grp = await base.GetByIdAsync(id); using (var scope = ServiceScopeFactory.CreateScope()) @@ -72,12 +70,12 @@ namespace Bit.Core.Repositories.EntityFramework ReadOnly = c.ReadOnly, HidePasswords = c.HidePasswords, }).ToList(); - return new Tuple>( + return new Tuple>( grp, collections); } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -86,11 +84,11 @@ namespace Bit.Core.Repositories.EntityFramework from g in dbContext.Groups where g.OrganizationId == organizationId select g).ToListAsync(); - return Mapper.Map>(data); + return Mapper.Map>(data); } } - public async Task> GetManyGroupUsersByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyGroupUsersByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -102,7 +100,7 @@ namespace Bit.Core.Repositories.EntityFramework where g.OrganizationId == organizationId select gu; var groupUsers = await query.ToListAsync(); - return Mapper.Map>(groupUsers); + return Mapper.Map>(groupUsers); } } @@ -134,7 +132,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task ReplaceAsync(Group obj, IEnumerable collections) + public async Task ReplaceAsync(Core.Entities.Group obj, IEnumerable collections) { await base.ReplaceAsync(obj); using (var scope = ServiceScopeFactory.CreateScope()) @@ -154,7 +152,7 @@ namespace Bit.Core.Repositories.EntityFramework where organizationUserIds.Contains(ou.Id) && ou.OrganizationId == orgId && !dbContext.GroupUsers.Any(gu => gu.GroupId == groupId && ou.Id == gu.OrganizationUserId) - select new EfModel.GroupUser + select new GroupUser { GroupId = groupId, OrganizationUserId = ou.Id, diff --git a/src/Infrastructure.EntityFramework/Repositories/InstallationRepository.cs b/src/Infrastructure.EntityFramework/Repositories/InstallationRepository.cs new file mode 100644 index 000000000..7e0f76db7 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Repositories/InstallationRepository.cs @@ -0,0 +1,15 @@ +using System; +using AutoMapper; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Microsoft.Extensions.DependencyInjection; + +namespace Bit.Infrastructure.EntityFramework.Repositories +{ + public class InstallationRepository : Repository, IInstallationRepository + { + public InstallationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) + : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Installations) + { } + } +} diff --git a/src/Core/Repositories/EntityFramework/MaintenanceRepository.cs b/src/Infrastructure.EntityFramework/Repositories/MaintenanceRepository.cs similarity index 93% rename from src/Core/Repositories/EntityFramework/MaintenanceRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/MaintenanceRepository.cs index 988f272de..01d3ab1b4 100644 --- a/src/Core/Repositories/EntityFramework/MaintenanceRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/MaintenanceRepository.cs @@ -2,9 +2,10 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Repositories; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class MaintenanceRepository : BaseEntityFrameworkRepository, IMaintenanceRepository { diff --git a/src/Core/Repositories/EntityFramework/OrganizationRepository.cs b/src/Infrastructure.EntityFramework/Repositories/OrganizationRepository.cs similarity index 79% rename from src/Core/Repositories/EntityFramework/OrganizationRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/OrganizationRepository.cs index 9994c643b..9aa839b23 100644 --- a/src/Core/Repositories/EntityFramework/OrganizationRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/OrganizationRepository.cs @@ -3,22 +3,21 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using DataModel = Bit.Core.Models.Data; -using EFModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class OrganizationRepository : Repository, IOrganizationRepository + public class OrganizationRepository : Repository, IOrganizationRepository { public OrganizationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Organizations) { } - public async Task GetByIdentifierAsync(string identifier) + public async Task GetByIdentifierAsync(string identifier) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -29,17 +28,17 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> GetManyByEnabledAsync() + public async Task> GetManyByEnabledAsync() { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var organizations = await GetDbSet(dbContext).Where(e => e.Enabled).ToListAsync(); - return Mapper.Map>(organizations); + return Mapper.Map>(organizations); } } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -49,11 +48,11 @@ namespace Bit.Core.Repositories.EntityFramework .Where(ou => ou.UserId == userId) .Select(ou => ou.Organization)) .ToListAsync(); - return Mapper.Map>(organizations); + return Mapper.Map>(organizations); } } - public async Task> SearchAsync(string name, string userEmail, + public async Task> SearchAsync(string name, string userEmail, bool? paid, int skip, int take) { using (var scope = ServiceScopeFactory.CreateScope()) @@ -68,7 +67,7 @@ namespace Bit.Core.Repositories.EntityFramework .OrderBy(e => e.CreationDate) .Skip(skip).Take(take) .ToListAsync(); - return Mapper.Map>(organizations); + return Mapper.Map>(organizations); } } @@ -97,12 +96,12 @@ namespace Bit.Core.Repositories.EntityFramework await OrganizationUpdateStorage(id); } - public override async Task DeleteAsync(Organization organization) + public override async Task DeleteAsync(Core.Entities.Organization organization) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var orgEntity = await dbContext.FindAsync(organization.Id); + var orgEntity = await dbContext.FindAsync(organization.Id); var sponsorships = dbContext.OrganizationSponsorships .Where(os => os.SponsoringOrganizationId == organization.Id || diff --git a/src/Core/Repositories/EntityFramework/OrganizationSponsorshipRepository.cs b/src/Infrastructure.EntityFramework/Repositories/OrganizationSponsorshipRepository.cs similarity index 71% rename from src/Core/Repositories/EntityFramework/OrganizationSponsorshipRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/OrganizationSponsorshipRepository.cs index 522dae1ea..583101982 100644 --- a/src/Core/Repositories/EntityFramework/OrganizationSponsorshipRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/OrganizationSponsorshipRepository.cs @@ -1,22 +1,21 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EFModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class OrganizationSponsorshipRepository : Repository, IOrganizationSponsorshipRepository + public class OrganizationSponsorshipRepository : Repository, IOrganizationSponsorshipRepository { public OrganizationSponsorshipRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.OrganizationSponsorships) { } - public async Task GetByOfferedToEmailAsync(string email) + public async Task GetByOfferedToEmailAsync(string email) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -27,7 +26,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetBySponsoredOrganizationIdAsync(Guid sponsoredOrganizationId) + public async Task GetBySponsoredOrganizationIdAsync(Guid sponsoredOrganizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -38,7 +37,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetBySponsoringOrganizationUserIdAsync(Guid sponsoringOrganizationUserId) + public async Task GetBySponsoringOrganizationUserIdAsync(Guid sponsoringOrganizationUserId) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs b/src/Infrastructure.EntityFramework/Repositories/OrganizationUserRepository.cs similarity index 86% rename from src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/OrganizationUserRepository.cs index 11a92ad7f..b6d716caa 100644 --- a/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/OrganizationUserRepository.cs @@ -5,22 +5,21 @@ using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class OrganizationUserRepository : Repository, IOrganizationUserRepository + public class OrganizationUserRepository : Repository, IOrganizationUserRepository { public OrganizationUserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.OrganizationUsers) { } - public async Task CreateAsync(OrganizationUser obj, IEnumerable collections) + public async Task CreateAsync(Core.Entities.OrganizationUser obj, IEnumerable collections) { var organizationUser = await base.CreateAsync(obj); using (var scope = ServiceScopeFactory.CreateScope()) @@ -31,7 +30,7 @@ namespace Bit.Core.Repositories.EntityFramework where c.OrganizationId == organizationUser.OrganizationId select c).ToListAsync(); var filteredCollections = collections.Where(c => availibleCollections.Any(a => c.Id == a.Id)); - var collectionUsers = filteredCollections.Select(y => new EfModel.CollectionUser + var collectionUsers = filteredCollections.Select(y => new CollectionUser { CollectionId = y.Id, OrganizationUserId = organizationUser.Id, @@ -45,7 +44,7 @@ namespace Bit.Core.Repositories.EntityFramework return organizationUser.Id; } - public async Task> CreateManyAsync(IEnumerable organizationUsers) + public async Task> CreateManyAsync(IEnumerable organizationUsers) { if (!organizationUsers.Any()) { @@ -60,20 +59,20 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var entities = Mapper.Map>(organizationUsers); + var entities = Mapper.Map>(organizationUsers); await dbContext.AddRangeAsync(entities); } return organizationUsers.Select(u => u.Id).ToList(); } - public override async Task DeleteAsync(OrganizationUser organizationUser) => await DeleteAsync(organizationUser.Id); + public override async Task DeleteAsync(Core.Entities.OrganizationUser organizationUser) => await DeleteAsync(organizationUser.Id); public async Task DeleteAsync(Guid organizationUserId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var orgUser = await dbContext.FindAsync(organizationUserId); + var orgUser = await dbContext.FindAsync(organizationUserId); var sponsorships = dbContext.OrganizationSponsorships .Where(os => os.SponsoringOrganizationUserId != default && os.SponsoringOrganizationUserId.Value == organizationUserId); @@ -93,7 +92,7 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var entities = dbContext.FindAsync(organizationUserIds); + var entities = dbContext.FindAsync(organizationUserIds); var sponsorships = dbContext.OrganizationSponsorships .Where(os => os.SponsoringOrganizationUserId != default && organizationUserIds.Contains(os.SponsoringOrganizationUserId ?? default)); @@ -108,7 +107,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task>> GetByIdWithCollectionsAsync(Guid id) + public async Task>> GetByIdWithCollectionsAsync(Guid id) { var organizationUser = await base.GetByIdAsync(id); using (var scope = ServiceScopeFactory.CreateScope()) @@ -127,12 +126,12 @@ namespace Bit.Core.Repositories.EntityFramework ReadOnly = cu.ReadOnly, HidePasswords = cu.HidePasswords, }); - return new Tuple>( + return new Tuple>( organizationUser, collections.ToList()); } } - public async Task GetByOrganizationAsync(Guid organizationId, Guid userId) + public async Task GetByOrganizationAsync(Guid organizationId, Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -143,7 +142,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetByOrganizationEmailAsync(Guid organizationId, string email) + public async Task GetByOrganizationEmailAsync(Guid organizationId, string email) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -226,7 +225,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> GetManyAsync(IEnumerable Ids) + public async Task> GetManyAsync(IEnumerable Ids) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -239,7 +238,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> GetManyByManyUsersAsync(IEnumerable userIds) + public async Task> GetManyByManyUsersAsync(IEnumerable userIds) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -247,11 +246,11 @@ namespace Bit.Core.Repositories.EntityFramework var query = from ou in dbContext.OrganizationUsers where userIds.Contains(ou.Id) select ou; - return Mapper.Map>(await query.ToListAsync()); + return Mapper.Map>(await query.ToListAsync()); } } - public async Task> GetManyByOrganizationAsync(Guid organizationId, OrganizationUserType? type) + public async Task> GetManyByOrganizationAsync(Guid organizationId, OrganizationUserType? type) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -260,11 +259,11 @@ namespace Bit.Core.Repositories.EntityFramework where ou.OrganizationId == organizationId && (type == null || ou.Type == type) select ou; - return Mapper.Map>(await query.ToListAsync()); + return Mapper.Map>(await query.ToListAsync()); } } - public async Task> GetManyByUserAsync(Guid userId) + public async Task> GetManyByUserAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -272,7 +271,7 @@ namespace Bit.Core.Repositories.EntityFramework var query = from ou in dbContext.OrganizationUsers where ou.UserId == userId select ou; - return Mapper.Map>(await query.ToListAsync()); + return Mapper.Map>(await query.ToListAsync()); } } @@ -326,7 +325,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task ReplaceAsync(OrganizationUser obj, IEnumerable collections) + public async Task ReplaceAsync(Core.Entities.OrganizationUser obj, IEnumerable collections) { await base.ReplaceAsync(obj); using (var scope = ServiceScopeFactory.CreateScope()) @@ -346,7 +345,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task ReplaceManyAsync(IEnumerable organizationUsers) + public async Task ReplaceManyAsync(IEnumerable organizationUsers) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -402,10 +401,10 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task UpsertManyAsync(IEnumerable organizationUsers) + public async Task UpsertManyAsync(IEnumerable organizationUsers) { - var createUsers = new List(); - var replaceUsers = new List(); + var createUsers = new List(); + var replaceUsers = new List(); foreach (var organizationUser in organizationUsers) { if (organizationUser.Id.Equals(default)) diff --git a/src/Core/Repositories/EntityFramework/PolicyRepository.cs b/src/Infrastructure.EntityFramework/Repositories/PolicyRepository.cs similarity index 69% rename from src/Core/Repositories/EntityFramework/PolicyRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/PolicyRepository.cs index 39fdb7a70..c0f1527de 100644 --- a/src/Core/Repositories/EntityFramework/PolicyRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/PolicyRepository.cs @@ -4,34 +4,32 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class PolicyRepository : Repository, IPolicyRepository + public class PolicyRepository : Repository, IPolicyRepository { public PolicyRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Policies) { } - public async Task GetByOrganizationIdTypeAsync(Guid organizationId, PolicyType type) + public async Task GetByOrganizationIdTypeAsync(Guid organizationId, PolicyType type) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var results = await dbContext.Policies .FirstOrDefaultAsync(p => p.OrganizationId == organizationId && p.Type == type); - return Mapper.Map(results); + return Mapper.Map(results); } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -39,11 +37,11 @@ namespace Bit.Core.Repositories.EntityFramework var results = await dbContext.Policies .Where(p => p.OrganizationId == organizationId) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -51,11 +49,11 @@ namespace Bit.Core.Repositories.EntityFramework var query = new PolicyReadByUserIdQuery(userId); var results = await query.Run(dbContext).ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> GetManyByTypeApplicableToUserIdAsync(Guid userId, PolicyType policyType, + public async Task> GetManyByTypeApplicableToUserIdAsync(Guid userId, PolicyType policyType, OrganizationUserStatusType minStatus) { using (var scope = ServiceScopeFactory.CreateScope()) @@ -64,7 +62,7 @@ namespace Bit.Core.Repositories.EntityFramework var query = new PolicyReadByTypeApplicableToUserQuery(userId, policyType, minStatus); var results = await query.Run(dbContext).ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } diff --git a/src/Core/Repositories/EntityFramework/ProviderOrganizationRepository.cs b/src/Infrastructure.EntityFramework/Repositories/ProviderOrganizationRepository.cs similarity index 78% rename from src/Core/Repositories/EntityFramework/ProviderOrganizationRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/ProviderOrganizationRepository.cs index 77d15b4ad..7b1a01c25 100644 --- a/src/Core/Repositories/EntityFramework/ProviderOrganizationRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/ProviderOrganizationRepository.cs @@ -3,18 +3,17 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class ProviderOrganizationRepository : - Repository, IProviderOrganizationRepository + Repository, IProviderOrganizationRepository { public ProviderOrganizationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, context => context.ProviderOrganizations) diff --git a/src/Core/Repositories/EntityFramework/ProviderRepository.cs b/src/Infrastructure.EntityFramework/Repositories/ProviderRepository.cs similarity index 88% rename from src/Core/Repositories/EntityFramework/ProviderRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/ProviderRepository.cs index 8ff09a5a9..de5431840 100644 --- a/src/Core/Repositories/EntityFramework/ProviderRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/ProviderRepository.cs @@ -3,16 +3,15 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; +using Bit.Core.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class ProviderRepository : Repository, IProviderRepository + public class ProviderRepository : Repository, IProviderRepository { public ProviderRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) diff --git a/src/Core/Repositories/EntityFramework/ProviderUserRepository.cs b/src/Infrastructure.EntityFramework/Repositories/ProviderUserRepository.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/ProviderUserRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/ProviderUserRepository.cs index 48ba10753..6f9121518 100644 --- a/src/Core/Repositories/EntityFramework/ProviderUserRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/ProviderUserRepository.cs @@ -3,19 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Entities.Provider; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Models.Table.Provider; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public class ProviderUserRepository : - Repository, IProviderUserRepository + Repository, IProviderUserRepository { public ProviderUserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.ProviderUsers) diff --git a/src/Core/Repositories/EntityFramework/Queries/CipherDetailsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs similarity index 96% rename from src/Core/Repositories/EntityFramework/Queries/CipherDetailsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs index a2105e018..d7b135ef5 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CipherDetailsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs @@ -4,7 +4,7 @@ using System.Linq; using Bit.Core.Utilities; using Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CipherDetailsQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CipherOrganizationDetailsReadByIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/CipherOrganizationDetailsReadByIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs index e29a8f695..b10b1bab2 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CipherOrganizationDetailsReadByIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs @@ -2,7 +2,7 @@ using System.Linq; using Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CipherOrganizationDetailsReadByIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CipherReadCanEditByIdUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/CipherReadCanEditByIdUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs index b742e7e6f..9814a40cd 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CipherReadCanEditByIdUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CipherReadCanEditByIdUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CipherUpdateCollectionsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherUpdateCollectionsQuery.cs similarity index 88% rename from src/Core/Repositories/EntityFramework/Queries/CipherUpdateCollectionsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CipherUpdateCollectionsQuery.cs index 9ac993203..012676f22 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CipherUpdateCollectionsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CipherUpdateCollectionsQuery.cs @@ -1,18 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; -using Table = Bit.Core.Models.Table; +using CollectionCipher = Bit.Infrastructure.EntityFramework.Models.CollectionCipher; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CipherUpdateCollectionsQuery : IQuery { - private readonly Table.Cipher _cipher; + private readonly Cipher _cipher; private readonly IEnumerable _collectionIds; - public CipherUpdateCollectionsQuery(Table.Cipher cipher, IEnumerable collectionIds) + public CipherUpdateCollectionsQuery(Cipher cipher, IEnumerable collectionIds) { _cipher = cipher; _collectionIds = collectionIds; diff --git a/src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs similarity index 82% rename from src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs index c64c09066..120635fc2 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdCipherIdQuery.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CollectionCipherReadByUserIdCipherIdQuery : CollectionCipherReadByUserIdQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdQuery.cs similarity index 94% rename from src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdQuery.cs index 7468b274b..1c4a55dcb 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CollectionCipherReadByUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionCipherReadByUserIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CollectionCipherReadByUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CollectionReadCountByOrganizationIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionReadCountByOrganizationIdQuery.cs similarity index 83% rename from src/Core/Repositories/EntityFramework/Queries/CollectionReadCountByOrganizationIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CollectionReadCountByOrganizationIdQuery.cs index 9856a5ac9..5590c371e 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CollectionReadCountByOrganizationIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionReadCountByOrganizationIdQuery.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CollectionReadCountByOrganizationIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/CollectionUserUpdateUsersQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionUserUpdateUsersQuery.cs similarity index 81% rename from src/Core/Repositories/EntityFramework/Queries/CollectionUserUpdateUsersQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/CollectionUserUpdateUsersQuery.cs index cbd456e0e..1d23e9c43 100644 --- a/src/Core/Repositories/EntityFramework/Queries/CollectionUserUpdateUsersQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/CollectionUserUpdateUsersQuery.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.Core.Models.Data; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; -using EfModel = Bit.Core.Models.EntityFramework; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class CollectionUserUpdateUsersQuery { @@ -22,7 +22,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries } } - public class CollectionUserUpdateUsersInsertQuery : IQuery + public class CollectionUserUpdateUsersInsertQuery : IQuery { private readonly Guid _collectionId; private readonly IEnumerable _users; @@ -33,7 +33,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries _users = users; } - public IQueryable Run(DatabaseContext dbContext) + public IQueryable Run(DatabaseContext dbContext) { var orgId = dbContext.Collections.FirstOrDefault(c => c.Id == _collectionId)?.OrganizationId; var organizationUserIds = _users.Select(u => u.Id); @@ -47,10 +47,10 @@ namespace Bit.Core.Repositories.EntityFramework.Queries return insertQuery; } - public async Task> BuildInMemory(DatabaseContext dbContext) + public async Task> BuildInMemory(DatabaseContext dbContext) { var data = await Run(dbContext).ToListAsync(); - var collectionUsers = data.Select(x => new EfModel.CollectionUser() + var collectionUsers = data.Select(x => new CollectionUser() { CollectionId = _collectionId, OrganizationUserId = x.Id, @@ -61,7 +61,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries } } - public class CollectionUserUpdateUsersUpdateQuery : IQuery + public class CollectionUserUpdateUsersUpdateQuery : IQuery { private readonly Guid _collectionId; private readonly IEnumerable _users; @@ -72,7 +72,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries _users = users; } - public IQueryable Run(DatabaseContext dbContext) + public IQueryable Run(DatabaseContext dbContext) { var orgId = dbContext.Collections.FirstOrDefault(c => c.Id == _collectionId)?.OrganizationId; var ids = _users.Select(x => x.Id); @@ -83,10 +83,10 @@ namespace Bit.Core.Repositories.EntityFramework.Queries return updateQuery; } - public async Task> BuildInMemory(DatabaseContext dbContext) + public async Task> BuildInMemory(DatabaseContext dbContext) { var data = await Run(dbContext).ToListAsync(); - var collectionUsers = data.Select(x => new EfModel.CollectionUser + var collectionUsers = data.Select(x => new CollectionUser { CollectionId = _collectionId, OrganizationUserId = x.OrganizationUserId, @@ -97,7 +97,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries } } - public class CollectionUserUpdateUsersDeleteQuery : IQuery + public class CollectionUserUpdateUsersDeleteQuery : IQuery { private readonly Guid _collectionId; private readonly IEnumerable _users; @@ -108,7 +108,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries _users = users; } - public IQueryable Run(DatabaseContext dbContext) + public IQueryable Run(DatabaseContext dbContext) { var orgId = dbContext.Collections.FirstOrDefault(c => c.Id == _collectionId)?.OrganizationId; var deleteQuery = from cu in dbContext.CollectionUsers diff --git a/src/Core/Repositories/EntityFramework/Queries/EmergencyAccessDetailsViewQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs similarity index 96% rename from src/Core/Repositories/EntityFramework/Queries/EmergencyAccessDetailsViewQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs index ed24b0ab3..c975fc566 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EmergencyAccessDetailsViewQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs @@ -1,7 +1,7 @@ using System.Linq; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EmergencyAccessDetailsViewQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs similarity index 90% rename from src/Core/Repositories/EntityFramework/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs index eb68797d3..4bfbe80d2 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EmergencyAccessReadCountByGrantorIdEmailQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByCipherIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs similarity index 76% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByCipherIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs index 9bbba0387..45a7bc766 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByCipherIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs @@ -1,20 +1,20 @@ using System; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; -using Table = Bit.Core.Models.Table; +using Event = Bit.Infrastructure.EntityFramework.Models.Event; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByCipherIdQuery : IQuery { - private readonly Table.Cipher _cipher; + private readonly Cipher _cipher; private readonly DateTime _startDate; private readonly DateTime _endDate; private readonly DateTime? _beforeDate; private readonly PageOptions _pageOptions; - public EventReadPageByCipherIdQuery(Table.Cipher cipher, DateTime startDate, DateTime endDate, PageOptions pageOptions) + public EventReadPageByCipherIdQuery(Cipher cipher, DateTime startDate, DateTime endDate, PageOptions pageOptions) { _cipher = cipher; _startDate = startDate; @@ -23,7 +23,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries _pageOptions = pageOptions; } - public EventReadPageByCipherIdQuery(Table.Cipher cipher, DateTime startDate, DateTime endDate, DateTime? beforeDate, PageOptions pageOptions) + public EventReadPageByCipherIdQuery(Cipher cipher, DateTime startDate, DateTime endDate, DateTime? beforeDate, PageOptions pageOptions) { _cipher = cipher; _startDate = startDate; diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs similarity index 92% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs index bb47ac359..934e7d0cd 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdActingUserIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByOrganizationIdActingUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdQuery.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdQuery.cs index f01d88f8c..5a8f3d004 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByOrganizationIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByOrganizationIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByOrganizationIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdActingUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdActingUserIdQuery.cs similarity index 92% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdActingUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdActingUserIdQuery.cs index 07ccd9fb6..cf777ef0f 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdActingUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdActingUserIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByProviderIdActingUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdQuery.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdQuery.cs index 3df12ad2e..b7650c505 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByProviderIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByProviderIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByProviderIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByUserIdQuery.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/Queries/EventReadPageByUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByUserIdQuery.cs index 293d02e07..6789f69af 100644 --- a/src/Core/Repositories/EntityFramework/Queries/EventReadPageByUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByUserIdQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class EventReadPageByUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/GroupUserUpdateGroupsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/GroupUserUpdateGroupsQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/GroupUserUpdateGroupsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/GroupUserUpdateGroupsQuery.cs index cf60a0259..e71ae9822 100644 --- a/src/Core/Repositories/EntityFramework/Queries/GroupUserUpdateGroupsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/GroupUserUpdateGroupsQuery.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.EntityFramework; -using Microsoft.EntityFrameworkCore; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class GroupUserUpdateGroupsQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/IQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/IQuery.cs similarity index 66% rename from src/Core/Repositories/EntityFramework/Queries/IQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/IQuery.cs index d0e235431..5cad41af5 100644 --- a/src/Core/Repositories/EntityFramework/Queries/IQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/IQuery.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public interface IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserOrganizationDetailsViewQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs similarity index 94% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserOrganizationDetailsViewQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs index 43619f8ea..eac842db0 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserOrganizationDetailsViewQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs @@ -1,9 +1,7 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using Bit.Core.Models.Data; -using Microsoft.Azure.Documents.SystemFunctions; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserOrganizationDetailsViewQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs similarity index 88% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs index 15b7ad620..d3c90dcd2 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByFreeOrganizationAdminUserQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserReadCountByFreeOrganizationAdminUserQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs similarity index 90% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs index 73d54550d..ccc0b72b1 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOnlyOwnerQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserReadCountByOnlyOwnerQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs similarity index 90% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs index aec5b2b3c..fdc476c2a 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdEmailQuery.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserReadCountByOrganizationIdEmailQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs similarity index 84% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs index a8f72532c..2f08d6efd 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserReadCountByOrganizationIdQuery.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserReadCountByOrganizationIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserUpdateWithCollectionsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUpdateWithCollectionsQuery.cs similarity index 84% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserUpdateWithCollectionsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUpdateWithCollectionsQuery.cs index dc55912bf..ff03388f4 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserUpdateWithCollectionsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUpdateWithCollectionsQuery.cs @@ -1,12 +1,10 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.EntityFramework; -using Microsoft.EntityFrameworkCore; -using Table = Bit.Core.Models.Table; +using CollectionUser = Bit.Infrastructure.EntityFramework.Models.CollectionUser; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserUpdateWithCollectionsQuery { @@ -14,7 +12,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries public OrganizationUserUpdateWithCollectionsUpdateQuery Update { get; set; } public OrganizationUserUpdateWithCollectionsDeleteQuery Delete { get; set; } - public OrganizationUserUpdateWithCollectionsQuery(Table.OrganizationUser organizationUser, + public OrganizationUserUpdateWithCollectionsQuery(OrganizationUser organizationUser, IEnumerable collections) { Insert = new OrganizationUserUpdateWithCollectionsInsertQuery(organizationUser, collections); @@ -25,10 +23,10 @@ namespace Bit.Core.Repositories.EntityFramework.Queries public class OrganizationUserUpdateWithCollectionsInsertQuery : IQuery { - private readonly Table.OrganizationUser _organizationUser; + private readonly OrganizationUser _organizationUser; private readonly IEnumerable _collections; - public OrganizationUserUpdateWithCollectionsInsertQuery(Table.OrganizationUser organizationUser, IEnumerable collections) + public OrganizationUserUpdateWithCollectionsInsertQuery(OrganizationUser organizationUser, IEnumerable collections) { _organizationUser = organizationUser; _collections = collections; @@ -58,10 +56,10 @@ namespace Bit.Core.Repositories.EntityFramework.Queries public class OrganizationUserUpdateWithCollectionsUpdateQuery : IQuery { - private readonly Table.OrganizationUser _organizationUser; + private readonly OrganizationUser _organizationUser; private readonly IEnumerable _collections; - public OrganizationUserUpdateWithCollectionsUpdateQuery(Table.OrganizationUser organizationUser, IEnumerable collections) + public OrganizationUserUpdateWithCollectionsUpdateQuery(OrganizationUser organizationUser, IEnumerable collections) { _organizationUser = organizationUser; _collections = collections; @@ -89,10 +87,10 @@ namespace Bit.Core.Repositories.EntityFramework.Queries public class OrganizationUserUpdateWithCollectionsDeleteQuery : IQuery { - private readonly Table.OrganizationUser _organizationUser; + private readonly OrganizationUser _organizationUser; private readonly IEnumerable _collections; - public OrganizationUserUpdateWithCollectionsDeleteQuery(Table.OrganizationUser organizationUser, IEnumerable collections) + public OrganizationUserUpdateWithCollectionsDeleteQuery(OrganizationUser organizationUser, IEnumerable collections) { _organizationUser = organizationUser; _collections = collections; diff --git a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserUserViewQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUserViewQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/OrganizationUserUserViewQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUserViewQuery.cs index 7d01bf7c7..26d1e3d72 100644 --- a/src/Core/Repositories/EntityFramework/Queries/OrganizationUserUserViewQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/OrganizationUserUserViewQuery.cs @@ -1,7 +1,7 @@ using System.Linq; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class OrganizationUserUserDetailsViewQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/PolicyReadByTypeApplicableToUserQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByTypeApplicableToUserQuery.cs similarity index 94% rename from src/Core/Repositories/EntityFramework/Queries/PolicyReadByTypeApplicableToUserQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByTypeApplicableToUserQuery.cs index 538c65431..017e42072 100644 --- a/src/Core/Repositories/EntityFramework/Queries/PolicyReadByTypeApplicableToUserQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByTypeApplicableToUserQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class PolicyReadByTypeApplicableToUserQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/PolicyReadByUserIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByUserIdQuery.cs similarity index 87% rename from src/Core/Repositories/EntityFramework/Queries/PolicyReadByUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByUserIdQuery.cs index 5ef6e86bb..b5c05a3bc 100644 --- a/src/Core/Repositories/EntityFramework/Queries/PolicyReadByUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/PolicyReadByUserIdQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class PolicyReadByUserIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs index 6261f6150..c120cf80e 100644 --- a/src/Core/Repositories/EntityFramework/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderOrganizationOrganizationDetailsReadByProviderIdQuery.cs @@ -2,7 +2,7 @@ using System.Linq; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class ProviderOrganizationOrganizationDetailsReadByProviderIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/ProviderUserOrganizationDetailsViewQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserOrganizationDetailsViewQuery.cs similarity index 94% rename from src/Core/Repositories/EntityFramework/Queries/ProviderUserOrganizationDetailsViewQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserOrganizationDetailsViewQuery.cs index 0ac54059e..0fe7cdb89 100644 --- a/src/Core/Repositories/EntityFramework/Queries/ProviderUserOrganizationDetailsViewQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserOrganizationDetailsViewQuery.cs @@ -1,8 +1,7 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class ProviderUserOrganizationDetailsViewQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs index 3d2dd8419..1d79251be 100644 --- a/src/Core/Repositories/EntityFramework/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserProviderDetailsReadByUserIdStatusQuery.cs @@ -3,7 +3,7 @@ using System.Linq; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class ProviderUserProviderDetailsReadByUserIdStatusQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs index b1cb35065..5e43fb120 100644 --- a/src/Core/Repositories/EntityFramework/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/ProviderUserReadCountByOnlyOwnerQuery.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using Bit.Core.Enums.Provider; -using Bit.Core.Models.EntityFramework.Provider; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class ProviderUserReadCountByOnlyOwnerQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs similarity index 87% rename from src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs index 0827bef01..5a0f1c7f0 100644 --- a/src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByCipherIdQuery.cs @@ -1,16 +1,15 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; -using Table = Bit.Core.Models.Table; +using User = Bit.Infrastructure.EntityFramework.Models.User; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class UserBumpAccountRevisionDateByCipherIdQuery : IQuery { - private readonly Table.Cipher _cipher; + private readonly Cipher _cipher; - public UserBumpAccountRevisionDateByCipherIdQuery(Table.Cipher cipher) + public UserBumpAccountRevisionDateByCipherIdQuery(Cipher cipher) { _cipher = cipher; } diff --git a/src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs similarity index 86% rename from src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs index 4ed4fdaff..da90f35f4 100644 --- a/src/Core/Repositories/EntityFramework/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserBumpAccountRevisionDateByOrganizationIdQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Models.EntityFramework; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class UserBumpAccountRevisionDateByOrganizationIdQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/UserCipherDetailsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs similarity index 96% rename from src/Core/Repositories/EntityFramework/Queries/UserCipherDetailsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs index 02ae9d3a4..2a27473f8 100644 --- a/src/Core/Repositories/EntityFramework/Queries/UserCipherDetailsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs @@ -1,12 +1,10 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; -using Bit.Core.Utilities; using Core.Models.Data; using Newtonsoft.Json.Linq; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class UserCipherDetailsQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/UserCollectionDetailsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCollectionDetailsQuery.cs similarity index 96% rename from src/Core/Repositories/EntityFramework/Queries/UserCollectionDetailsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/UserCollectionDetailsQuery.cs index ef218bb82..5d5eb5289 100644 --- a/src/Core/Repositories/EntityFramework/Queries/UserCollectionDetailsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCollectionDetailsQuery.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using Bit.Core.Enums; using Bit.Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class UserCollectionDetailsQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs similarity index 91% rename from src/Core/Repositories/EntityFramework/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs rename to src/Infrastructure.EntityFramework/Repositories/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs index 5b9a63add..0a4c7d73e 100644 --- a/src/Core/Repositories/EntityFramework/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserReadPublicKeysByProviderUserIdsQuery.cs @@ -3,10 +3,8 @@ using System.Collections.Generic; using System.Linq; using Bit.Core.Enums.Provider; using Bit.Core.Models.Data; -using Bit.Core.Utilities; -using Core.Models.Data; -namespace Bit.Core.Repositories.EntityFramework.Queries +namespace Bit.Infrastructure.EntityFramework.Repositories.Queries { public class UserReadPublicKeysByProviderUserIdsQuery : IQuery { diff --git a/src/Core/Repositories/EntityFramework/Repository.cs b/src/Infrastructure.EntityFramework/Repositories/Repository.cs similarity index 95% rename from src/Core/Repositories/EntityFramework/Repository.cs rename to src/Infrastructure.EntityFramework/Repositories/Repository.cs index 9e9817958..3bd866969 100644 --- a/src/Core/Repositories/EntityFramework/Repository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Repository.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; +using Bit.Core.Entities; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { public abstract class Repository : BaseEntityFrameworkRepository, IRepository where TId : IEquatable diff --git a/src/Core/Repositories/EntityFramework/SendRepository.cs b/src/Infrastructure.EntityFramework/Repositories/SendRepository.cs similarity index 64% rename from src/Core/Repositories/EntityFramework/SendRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/SendRepository.cs index fd3d011e9..604c4abab 100644 --- a/src/Core/Repositories/EntityFramework/SendRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/SendRepository.cs @@ -3,22 +3,20 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class SendRepository : Repository, ISendRepository + public class SendRepository : Repository, ISendRepository { public SendRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Sends) { } - public override async Task CreateAsync(Send send) + public override async Task CreateAsync(Core.Entities.Send send) { send = await base.CreateAsync(send); if (send.UserId.HasValue) @@ -29,23 +27,23 @@ namespace Bit.Core.Repositories.EntityFramework return send; } - public async Task> GetManyByDeletionDateAsync(DateTime deletionDateBefore) + public async Task> GetManyByDeletionDateAsync(DateTime deletionDateBefore) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var results = await dbContext.Sends.Where(s => s.DeletionDate < deletionDateBefore).ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var results = await dbContext.Sends.Where(s => s.UserId == userId).ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } } diff --git a/src/Core/Repositories/EntityFramework/SsoConfigRepository.cs b/src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs similarity index 63% rename from src/Core/Repositories/EntityFramework/SsoConfigRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs index cda75d2cf..bceec6068 100644 --- a/src/Core/Repositories/EntityFramework/SsoConfigRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs @@ -3,48 +3,47 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class SsoConfigRepository : Repository, ISsoConfigRepository + public class SsoConfigRepository : Repository, ISsoConfigRepository { public SsoConfigRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.SsoConfigs) { } - public async Task GetByOrganizationIdAsync(Guid organizationId) + public async Task GetByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfig = await GetDbSet(dbContext).SingleOrDefaultAsync(sc => sc.OrganizationId == organizationId); - return Mapper.Map(ssoConfig); + return Mapper.Map(ssoConfig); } } - public async Task GetByIdentifierAsync(string identifier) + public async Task GetByIdentifierAsync(string identifier) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfig = await GetDbSet(dbContext).SingleOrDefaultAsync(sc => sc.Organization.Identifier == identifier); - return Mapper.Map(ssoConfig); + return Mapper.Map(ssoConfig); } } - public async Task> GetManyByRevisionNotBeforeDate(DateTime? notBefore) + public async Task> GetManyByRevisionNotBeforeDate(DateTime? notBefore) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfigs = await GetDbSet(dbContext).Where(sc => sc.Enabled && sc.RevisionDate >= notBefore).ToListAsync(); - return Mapper.Map>(ssoConfigs); + return Mapper.Map>(ssoConfigs); } } } diff --git a/src/Core/Repositories/EntityFramework/SsoUserRepository.cs b/src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs similarity index 77% rename from src/Core/Repositories/EntityFramework/SsoUserRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs index b1521448d..edbf66e31 100644 --- a/src/Core/Repositories/EntityFramework/SsoUserRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; using AutoMapper; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class SsoUserRepository : Repository, ISsoUserRepository + public class SsoUserRepository : Repository, ISsoUserRepository { public SsoUserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.SsoUsers) @@ -25,7 +25,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId) + public async Task GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Core/Repositories/EntityFramework/TaxRateRepository.cs b/src/Infrastructure.EntityFramework/Repositories/TaxRateRepository.cs similarity index 65% rename from src/Core/Repositories/EntityFramework/TaxRateRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/TaxRateRepository.cs index c1e0ab1d9..1e71b39e9 100644 --- a/src/Core/Repositories/EntityFramework/TaxRateRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/TaxRateRepository.cs @@ -1,35 +1,32 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class TaxRateRepository : Repository, ITaxRateRepository + public class TaxRateRepository : Repository, ITaxRateRepository { public TaxRateRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.TaxRates) { } - public async Task ArchiveAsync(TaxRate model) + public async Task ArchiveAsync(Core.Entities.TaxRate model) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var entity = await dbContext.FindAsync(model); + var entity = await dbContext.FindAsync(model); entity.Active = false; await dbContext.SaveChangesAsync(); } } - public async Task> GetAllActiveAsync() + public async Task> GetAllActiveAsync() { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -37,11 +34,11 @@ namespace Bit.Core.Repositories.EntityFramework var results = await dbContext.TaxRates .Where(t => t.Active) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> GetByLocationAsync(TaxRate taxRate) + public async Task> GetByLocationAsync(Core.Entities.TaxRate taxRate) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -51,11 +48,11 @@ namespace Bit.Core.Repositories.EntityFramework t.Country == taxRate.Country && t.PostalCode == taxRate.PostalCode) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> SearchAsync(int skip, int count) + public async Task> SearchAsync(int skip, int count) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -66,7 +63,7 @@ namespace Bit.Core.Repositories.EntityFramework .Where(t => t.Active) .OrderBy(t => t.Country).ThenByDescending(t => t.PostalCode) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } } diff --git a/src/Core/Repositories/EntityFramework/TransactionRepository.cs b/src/Infrastructure.EntityFramework/Repositories/TransactionRepository.cs similarity index 63% rename from src/Core/Repositories/EntityFramework/TransactionRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/TransactionRepository.cs index d2a540dac..de485a87c 100644 --- a/src/Core/Repositories/EntityFramework/TransactionRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/TransactionRepository.cs @@ -4,33 +4,31 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class TransactionRepository : Repository, ITransactionRepository + public class TransactionRepository : Repository, ITransactionRepository { public TransactionRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Transactions) { } - public async Task GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId) + public async Task GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var results = await dbContext.Transactions .FirstOrDefaultAsync(t => (t.GatewayId == gatewayId && t.Gateway == gatewayType)); - return Mapper.Map(results); + return Mapper.Map(results); } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -38,11 +36,11 @@ namespace Bit.Core.Repositories.EntityFramework var results = await dbContext.Transactions .Where(t => (t.OrganizationId == organizationId && !t.UserId.HasValue)) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -50,7 +48,7 @@ namespace Bit.Core.Repositories.EntityFramework var results = await dbContext.Transactions .Where(t => (t.UserId == userId)) .ToListAsync(); - return Mapper.Map>(results); + return Mapper.Map>(results); } } } diff --git a/src/Core/Repositories/EntityFramework/U2fRepository.cs b/src/Infrastructure.EntityFramework/Repositories/U2fRepository.cs similarity index 68% rename from src/Core/Repositories/EntityFramework/U2fRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/U2fRepository.cs index f2e567f3b..112686827 100644 --- a/src/Core/Repositories/EntityFramework/U2fRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/U2fRepository.cs @@ -3,28 +3,26 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using DataModel = Bit.Core.Models.Data; -using EfModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class U2fRepository : Repository, IU2fRepository + public class U2fRepository : Repository, IU2fRepository { public U2fRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.U2fs) { } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var results = await dbContext.U2fs.Where(u => u.UserId == userId).ToListAsync(); - return (ICollection)results; + return (ICollection)results; } } @@ -39,17 +37,17 @@ namespace Bit.Core.Repositories.EntityFramework } } - public override Task ReplaceAsync(U2f obj) + public override Task ReplaceAsync(Core.Entities.U2f obj) { throw new NotSupportedException(); } - public override Task UpsertAsync(U2f obj) + public override Task UpsertAsync(Core.Entities.U2f obj) { throw new NotSupportedException(); } - public override Task DeleteAsync(U2f obj) + public override Task DeleteAsync(Core.Entities.U2f obj) { throw new NotSupportedException(); } diff --git a/src/Core/Repositories/EntityFramework/UserRepository.cs b/src/Infrastructure.EntityFramework/Repositories/UserRepository.cs similarity index 82% rename from src/Core/Repositories/EntityFramework/UserRepository.cs rename to src/Infrastructure.EntityFramework/Repositories/UserRepository.cs index 04177bd48..86ff37a5a 100644 --- a/src/Core/Repositories/EntityFramework/UserRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/UserRepository.cs @@ -1,31 +1,29 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.Json; using System.Threading.Tasks; using AutoMapper; -using Bit.Core.Models.Table; +using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using DataModel = Bit.Core.Models.Data; -using EFModel = Bit.Core.Models.EntityFramework; -using TableModel = Bit.Core.Models.Table; -namespace Bit.Core.Repositories.EntityFramework +namespace Bit.Infrastructure.EntityFramework.Repositories { - public class UserRepository : Repository, IUserRepository + public class UserRepository : Repository, IUserRepository { public UserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Users) { } - public async Task GetByEmailAsync(string email) + public async Task GetByEmailAsync(string email) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var entity = await GetDbSet(dbContext).FirstOrDefaultAsync(e => e.Email == email); - return Mapper.Map(entity); + return Mapper.Map(entity); } } @@ -43,12 +41,12 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task> SearchAsync(string email, int skip, int take) + public async Task> SearchAsync(string email, int skip, int take) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - List users; + List users; if (dbContext.Database.IsNpgsql()) { users = await GetDbSet(dbContext) @@ -66,17 +64,17 @@ namespace Bit.Core.Repositories.EntityFramework .Skip(skip).Take(take) .ToListAsync(); } - return Mapper.Map>(users); + return Mapper.Map>(users); } } - public async Task> GetManyByPremiumAsync(bool premium) + public async Task> GetManyByPremiumAsync(bool premium) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var users = await GetDbSet(dbContext).Where(e => e.Premium == premium).ToListAsync(); - return Mapper.Map>(users); + return Mapper.Map>(users); } } @@ -109,7 +107,7 @@ namespace Bit.Core.Repositories.EntityFramework using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); - var user = new EFModel.User + var user = new User { Id = id, RenewalReminderDate = renewalReminderDate, @@ -121,7 +119,7 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task GetBySsoUserAsync(string externalId, Guid? organizationId) + public async Task GetBySsoUserAsync(string externalId, Guid? organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -135,11 +133,11 @@ namespace Bit.Core.Repositories.EntityFramework } var entity = await dbContext.Users.SingleOrDefaultAsync(e => e.Id == ssoUser.UserId); - return Mapper.Map(entity); + return Mapper.Map(entity); } } - public async Task> GetManyAsync(IEnumerable ids) + public async Task> GetManyAsync(IEnumerable ids) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Notifications/Notifications.csproj b/src/Notifications/Notifications.csproj index fc5016613..57a3b46ca 100644 --- a/src/Notifications/Notifications.csproj +++ b/src/Notifications/Notifications.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Notifications/Startup.cs b/src/Notifications/Startup.cs index 9cad57cd0..4ca7b728e 100644 --- a/src/Notifications/Startup.cs +++ b/src/Notifications/Startup.cs @@ -2,6 +2,7 @@ using System.Globalization; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.SharedWeb.Utilities; using IdentityModel; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; diff --git a/src/SharedWeb/SharedWeb.csproj b/src/SharedWeb/SharedWeb.csproj new file mode 100644 index 000000000..d363f8025 --- /dev/null +++ b/src/SharedWeb/SharedWeb.csproj @@ -0,0 +1,13 @@ + + + + net5.0 + + + + + + + + + diff --git a/src/Core/Utilities/ServiceCollectionExtensions.cs b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs similarity index 80% rename from src/Core/Utilities/ServiceCollectionExtensions.cs rename to src/SharedWeb/Utilities/ServiceCollectionExtensions.cs index 8431d9d8c..418e7655e 100644 --- a/src/Core/Utilities/ServiceCollectionExtensions.cs +++ b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs @@ -1,26 +1,25 @@ using System; using System.IO; -using System.Linq; using System.Reflection; using System.Security.Claims; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -using AutoMapper; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Identity; using Bit.Core.IdentityServer; using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Resources; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Tokens; using Bit.Core.Utilities; +using Bit.Infrastructure.Dapper; +using Bit.Infrastructure.EntityFramework; using IdentityModel; using IdentityServer4.AccessTokenValidation; using IdentityServer4.Configuration; -using LinqToDB.EntityFrameworkCore; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; @@ -30,19 +29,16 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc.Localization; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Serilog.Context; -using EntityFrameworkRepos = Bit.Core.Repositories.EntityFramework; using NoopRepos = Bit.Core.Repositories.Noop; -using SqlServerRepos = Bit.Core.Repositories.SqlServer; using TableStorageRepos = Bit.Core.Repositories.TableStorage; -namespace Bit.Core.Utilities +namespace Bit.SharedWeb.Utilities { public static class ServiceCollectionExtensions { @@ -74,87 +70,15 @@ namespace Bit.Core.Utilities if (useEf) { - if (string.IsNullOrWhiteSpace(connectionString)) - { - throw new Exception($"Database provider type {provider} was selected but no connection string was found."); - } - LinqToDBForEFTools.Initialize(); - services.AddAutoMapper(typeof(EntityFrameworkRepos.UserRepository)); - services.AddDbContext(options => - { - if (provider == SupportedDatabaseProviders.Postgres) - { - options.UseNpgsql(connectionString); - } - else if (provider == SupportedDatabaseProviders.MySql) - { - options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); - } - }); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); + services.AddEFRepositories(globalSettings.SelfHosted, connectionString, provider); } else { - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); + services.AddDapperRepositories(globalSettings.SelfHosted); } if (globalSettings.SelfHosted) { - if (useEf) - { - services.AddSingleton(); - } - else - { - services.AddSingleton(); - } services.AddSingleton(); services.AddSingleton(); } diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index d912a9bd1..cf4c16d48 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -17,7 +17,7 @@ 1033,CI BySchemaAndSchemaType True - v4.6 + v4.8 CS Properties False diff --git a/test/Api.Test/Controllers/AccountsControllerTests.cs b/test/Api.Test/Controllers/AccountsControllerTests.cs index 4149479b2..39cdb4455 100644 --- a/test/Api.Test/Controllers/AccountsControllerTests.cs +++ b/test/Api.Test/Controllers/AccountsControllerTests.cs @@ -4,10 +4,10 @@ using System.Threading.Tasks; using Bit.Api.Controllers; using Bit.Api.Models.Request.Accounts; using Bit.Core; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/test/Api.Test/Controllers/OrganizationSponsorshipsControllerTests.cs b/test/Api.Test/Controllers/OrganizationSponsorshipsControllerTests.cs index b24c7c0c1..be51f093b 100644 --- a/test/Api.Test/Controllers/OrganizationSponsorshipsControllerTests.cs +++ b/test/Api.Test/Controllers/OrganizationSponsorshipsControllerTests.cs @@ -6,9 +6,9 @@ using Bit.Api.Controllers; using Bit.Api.Models.Request.Organizations; using Bit.Api.Test.AutoFixture.Attributes; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/test/Api.Test/Controllers/OrganizationsControllerTests.cs b/test/Api.Test/Controllers/OrganizationsControllerTests.cs index 1a2b79ce4..3f2576d07 100644 --- a/test/Api.Test/Controllers/OrganizationsControllerTests.cs +++ b/test/Api.Test/Controllers/OrganizationsControllerTests.cs @@ -4,9 +4,9 @@ using System.Threading.Tasks; using AutoFixture.Xunit2; using Bit.Api.Controllers; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/test/Api.Test/Controllers/SendsControllerTests.cs b/test/Api.Test/Controllers/SendsControllerTests.cs index 0eaad4c84..49fa09cf1 100644 --- a/test/Api.Test/Controllers/SendsControllerTests.cs +++ b/test/Api.Test/Controllers/SendsControllerTests.cs @@ -6,8 +6,8 @@ using Bit.Api.Controllers; using Bit.Api.Models.Request; using Bit.Api.Models.Response; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/test/Billing.Test/Controllers/FreshsalesControllerTests.cs b/test/Billing.Test/Controllers/FreshsalesControllerTests.cs index d008bf894..f922560db 100644 --- a/test/Billing.Test/Controllers/FreshsalesControllerTests.cs +++ b/test/Billing.Test/Controllers/FreshsalesControllerTests.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Reflection; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Bit.Billing.Controllers; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Common/Helpers/Factories.cs b/test/Common/Helpers/Factories.cs index ecd0cfe85..6d947e0fe 100644 --- a/test/Common/Helpers/Factories.cs +++ b/test/Common/Helpers/Factories.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Settings; -using Microsoft.EntityFrameworkCore; +using Bit.Core.Settings; using Microsoft.Extensions.Configuration; namespace Bit.Test.Common.Helpers.Factories diff --git a/test/Core.Test/AutoFixture/CipherFixtures.cs b/test/Core.Test/AutoFixture/CipherFixtures.cs index 145c9bfcb..09600649d 100644 --- a/test/Core.Test/AutoFixture/CipherFixtures.cs +++ b/test/Core.Test/AutoFixture/CipherFixtures.cs @@ -4,14 +4,14 @@ using System.Linq; using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.OrganizationUserFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Core.Models.Data; diff --git a/test/Core.Test/AutoFixture/CollectionCipherFixtures.cs b/test/Core.Test/AutoFixture/CollectionCipherFixtures.cs index 607a6ca50..52513c2d1 100644 --- a/test/Core.Test/AutoFixture/CollectionCipherFixtures.cs +++ b/test/Core.Test/AutoFixture/CollectionCipherFixtures.cs @@ -1,15 +1,15 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.CipherFixtures; using Bit.Core.Test.AutoFixture.CollectionFixtures; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.CollectionCipherFixtures { @@ -23,14 +23,14 @@ namespace Bit.Core.Test.AutoFixture.CollectionCipherFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.CollectionCipher)) + if (type == null || type != typeof(CollectionCipher)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/CollectionFixtures.cs b/test/Core.Test/AutoFixture/CollectionFixtures.cs index 9eb7bc60f..154e0f54c 100644 --- a/test/Core.Test/AutoFixture/CollectionFixtures.cs +++ b/test/Core.Test/AutoFixture/CollectionFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.CollectionFixtures { @@ -21,14 +21,14 @@ namespace Bit.Core.Test.AutoFixture.CollectionFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Collection)) + if (type == null || type != typeof(Collection)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/DeviceFixtures.cs b/test/Core.Test/AutoFixture/DeviceFixtures.cs index f16e608f2..2be71edbb 100644 --- a/test/Core.Test/AutoFixture/DeviceFixtures.cs +++ b/test/Core.Test/AutoFixture/DeviceFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.DeviceFixtures { @@ -21,14 +21,14 @@ namespace Bit.Core.Test.AutoFixture.DeviceFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Device)) + if (type == null || type != typeof(Device)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/EmergencyAccessFixtures.cs b/test/Core.Test/AutoFixture/EmergencyAccessFixtures.cs index fcbf49bf7..4fbcab41b 100644 --- a/test/Core.Test/AutoFixture/EmergencyAccessFixtures.cs +++ b/test/Core.Test/AutoFixture/EmergencyAccessFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.EmergencyAccessFixtures { @@ -21,14 +21,14 @@ namespace Bit.Core.Test.AutoFixture.EmergencyAccessFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.EmergencyAccess)) + if (type == null || type != typeof(EmergencyAccess)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.Create(); + var obj = fixture.Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs b/test/Core.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs index 92ba4423d..ae2056380 100644 --- a/test/Core.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs +++ b/test/Core.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs @@ -4,11 +4,10 @@ using System.Reflection; using AutoFixture; using AutoFixture.Kernel; using AutoMapper; -using Bit.Core.Models.EntityFramework; -using Bit.Core.Models.EntityFramework.Provider; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Settings; using Bit.Core.Test.Helpers.Factories; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Moq; diff --git a/test/Core.Test/AutoFixture/EventFixtures.cs b/test/Core.Test/AutoFixture/EventFixtures.cs index e0569e4fb..660345f2f 100644 --- a/test/Core.Test/AutoFixture/EventFixtures.cs +++ b/test/Core.Test/AutoFixture/EventFixtures.cs @@ -1,12 +1,12 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.EventFixtures { @@ -20,14 +20,14 @@ namespace Bit.Core.Test.AutoFixture.EventFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Event)) + if (type == null || type != typeof(Event)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/FolderFixtures.cs b/test/Core.Test/AutoFixture/FolderFixtures.cs index cfc0d0723..0d4534598 100644 --- a/test/Core.Test/AutoFixture/FolderFixtures.cs +++ b/test/Core.Test/AutoFixture/FolderFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.FolderFixtures { @@ -21,14 +21,14 @@ namespace Bit.Core.Test.AutoFixture.FolderFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Folder)) + if (type == null || type != typeof(Folder)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/GrantFixtures.cs b/test/Core.Test/AutoFixture/GrantFixtures.cs index 18846e86e..9d6b435ab 100644 --- a/test/Core.Test/AutoFixture/GrantFixtures.cs +++ b/test/Core.Test/AutoFixture/GrantFixtures.cs @@ -1,12 +1,12 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.GrantFixtures { @@ -20,14 +20,14 @@ namespace Bit.Core.Test.AutoFixture.GrantFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Grant)) + if (type == null || type != typeof(Grant)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/GroupFixtures.cs b/test/Core.Test/AutoFixture/GroupFixtures.cs index 4f2891cc9..822ed421e 100644 --- a/test/Core.Test/AutoFixture/GroupFixtures.cs +++ b/test/Core.Test/AutoFixture/GroupFixtures.cs @@ -1,14 +1,14 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Fixtures = Bit.Core.Test.AutoFixture.OrganizationFixtures; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.GroupFixtures { @@ -36,14 +36,14 @@ namespace Bit.Core.Test.AutoFixture.GroupFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Group)) + if (type == null || type != typeof(Group)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/GroupUserFixtures.cs b/test/Core.Test/AutoFixture/GroupUserFixtures.cs index 5ec1e9062..a7a4063cd 100644 --- a/test/Core.Test/AutoFixture/GroupUserFixtures.cs +++ b/test/Core.Test/AutoFixture/GroupUserFixtures.cs @@ -1,11 +1,11 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.GroupUserFixtures { @@ -19,13 +19,13 @@ namespace Bit.Core.Test.AutoFixture.GroupUserFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.GroupUser)) + if (type == null || type != typeof(GroupUser)) { return new NoSpecimen(); } var fixture = new Fixture(); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/InstallationFixtures.cs b/test/Core.Test/AutoFixture/InstallationFixtures.cs index 91657ba55..7636c923a 100644 --- a/test/Core.Test/AutoFixture/InstallationFixtures.cs +++ b/test/Core.Test/AutoFixture/InstallationFixtures.cs @@ -1,11 +1,11 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.InstallationFixtures { @@ -19,13 +19,13 @@ namespace Bit.Core.Test.AutoFixture.InstallationFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Installation)) + if (type == null || type != typeof(Installation)) { return new NoSpecimen(); } var fixture = new Fixture(); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/OrganizationFixtures.cs b/test/Core.Test/AutoFixture/OrganizationFixtures.cs index c674e50ea..d324aff6b 100644 --- a/test/Core.Test/AutoFixture/OrganizationFixtures.cs +++ b/test/Core.Test/AutoFixture/OrganizationFixtures.cs @@ -4,16 +4,16 @@ using System.Linq; using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Utilities; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.OrganizationFixtures { @@ -26,16 +26,18 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures var organizationId = Guid.NewGuid(); var maxConnections = (short)new Random().Next(10, short.MaxValue); - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.Id, organizationId) .With(o => o.MaxCollections, maxConnections) .With(o => o.UseGroups, UseGroups)); - fixture.Customize(composer => + fixture.Customize(composer => composer - .With(c => c.OrganizationId, organizationId)); + .With(c => c.OrganizationId, organizationId) + .Without(o => o.CreationDate) + .Without(o => o.RevisionDate)); - fixture.Customize(composer => composer.With(g => g.OrganizationId, organizationId)); + fixture.Customize(composer => composer.With(g => g.OrganizationId, organizationId)); } } @@ -49,14 +51,14 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Organization)) + if (type == null || type != typeof(Entities.Organization)) { return new NoSpecimen(); } var fixture = new Fixture(); var providers = fixture.Create>(); - var organization = new Fixture().WithAutoNSubstitutions().Create(); + var organization = new Fixture().WithAutoNSubstitutions().Create(); organization.SetTwoFactorProviders(providers); return organization; } @@ -71,7 +73,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures var lowestActivePaidPlan = validUpgradePlans.First(); CheckedPlanType = CheckedPlanType.Equals(PlanType.Free) ? lowestActivePaidPlan : CheckedPlanType; validUpgradePlans.Remove(lowestActivePaidPlan); - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.PlanType, CheckedPlanType)); fixture.Customize(composer => composer .With(ou => ou.Plan, validUpgradePlans.First())); @@ -82,7 +84,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures { public void Customize(IFixture fixture) { - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.PlanType, PlanType.Free)); } } @@ -91,7 +93,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures { public void Customize(IFixture fixture) { - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.PlanType, PlanType.Free)); var plansToIgnore = new List { PlanType.Free, PlanType.Custom }; @@ -100,7 +102,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures fixture.Customize(composer => composer .With(ou => ou.Plan, selectedPlan.Type) .With(ou => ou.PremiumAccessAddon, selectedPlan.HasPremiumAccessOption)); - fixture.Customize(composer => composer + fixture.Customize(composer => composer .Without(o => o.GatewaySubscriptionId)); } } @@ -117,10 +119,10 @@ namespace Bit.Core.Test.AutoFixture.OrganizationFixtures { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }); - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.Id, organizationId) .With(o => o.Seats, (short)100)); - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(ou => ou.OrganizationId, organizationId) .With(ou => ou.Type, InvitorUserType) .With(ou => ou.Permissions, PermissionsBlob)); diff --git a/test/Core.Test/AutoFixture/OrganizationSponsorshipFixtures.cs b/test/Core.Test/AutoFixture/OrganizationSponsorshipFixtures.cs index 8ef89252b..d002444d0 100644 --- a/test/Core.Test/AutoFixture/OrganizationSponsorshipFixtures.cs +++ b/test/Core.Test/AutoFixture/OrganizationSponsorshipFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.OrganizationUserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.OrganizationSponsorshipFixtures { @@ -21,13 +21,13 @@ namespace Bit.Core.Test.AutoFixture.OrganizationSponsorshipFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.OrganizationSponsorship)) + if (type == null || type != typeof(OrganizationSponsorship)) { return new NoSpecimen(); } var fixture = new Fixture(); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/OrganizationUserFixtures.cs b/test/Core.Test/AutoFixture/OrganizationUserFixtures.cs index 828bc953a..b03043263 100644 --- a/test/Core.Test/AutoFixture/OrganizationUserFixtures.cs +++ b/test/Core.Test/AutoFixture/OrganizationUserFixtures.cs @@ -8,13 +8,12 @@ using AutoFixture.Xunit2; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Data; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.OrganizationUserFixtures { @@ -31,7 +30,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationUserFixtures if (type == typeof(OrganizationUser)) { var fixture = new Fixture(); - var orgUser = fixture.WithAutoNSubstitutions().Create(); + var orgUser = fixture.WithAutoNSubstitutions().Create(); var orgUserPermissions = fixture.WithAutoNSubstitutions().Create(); orgUser.Permissions = JsonSerializer.Serialize(orgUserPermissions, new JsonSerializerOptions() { @@ -42,7 +41,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationUserFixtures else if (type == typeof(List)) { var fixture = new Fixture(); - var orgUsers = fixture.WithAutoNSubstitutions().CreateMany(2); + var orgUsers = fixture.WithAutoNSubstitutions().CreateMany(2); foreach (var orgUser in orgUsers) { var providers = fixture.Create>(); @@ -71,7 +70,7 @@ namespace Bit.Core.Test.AutoFixture.OrganizationUserFixtures public void Customize(IFixture fixture) { - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.Type, Type) .With(o => o.Status, Status)); } diff --git a/test/Core.Test/AutoFixture/PolicyFixtures.cs b/test/Core.Test/AutoFixture/PolicyFixtures.cs index ceb493a7d..a428e7395 100644 --- a/test/Core.Test/AutoFixture/PolicyFixtures.cs +++ b/test/Core.Test/AutoFixture/PolicyFixtures.cs @@ -4,12 +4,11 @@ using AutoFixture; using AutoFixture.Kernel; using AutoFixture.Xunit2; using Bit.Core.Enums; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.PolicyFixtures { @@ -24,7 +23,7 @@ namespace Bit.Core.Test.AutoFixture.PolicyFixtures public void Customize(IFixture fixture) { - fixture.Customize(composer => composer + fixture.Customize(composer => composer .With(o => o.OrganizationId, Guid.NewGuid()) .With(o => o.Type, Type) .With(o => o.Enabled, true)); @@ -56,13 +55,13 @@ namespace Bit.Core.Test.AutoFixture.PolicyFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Policy)) + if (type == null || type != typeof(Entities.Policy)) { return new NoSpecimen(); } var fixture = new Fixture(); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/SendFixtures.cs b/test/Core.Test/AutoFixture/SendFixtures.cs index c6ff9a457..00d870b25 100644 --- a/test/Core.Test/AutoFixture/SendFixtures.cs +++ b/test/Core.Test/AutoFixture/SendFixtures.cs @@ -1,12 +1,12 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Core.Test/AutoFixture/SsoConfigFixtures.cs b/test/Core.Test/AutoFixture/SsoConfigFixtures.cs index 95938272b..0a5d11564 100644 --- a/test/Core.Test/AutoFixture/SsoConfigFixtures.cs +++ b/test/Core.Test/AutoFixture/SsoConfigFixtures.cs @@ -2,13 +2,13 @@ using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.SsoConfigFixtures { @@ -22,13 +22,13 @@ namespace Bit.Core.Test.AutoFixture.SsoConfigFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.SsoConfig)) + if (type == null || type != typeof(SsoConfig)) { return new NoSpecimen(); } var fixture = new Fixture(); - var ssoConfig = fixture.WithAutoNSubstitutions().Create(); + var ssoConfig = fixture.WithAutoNSubstitutions().Create(); var ssoConfigData = fixture.WithAutoNSubstitutions().Create(); ssoConfig.SetData(ssoConfigData); return ssoConfig; diff --git a/test/Core.Test/AutoFixture/SsoUserFixtures.cs b/test/Core.Test/AutoFixture/SsoUserFixtures.cs index e28f7ac64..0de71f6b0 100644 --- a/test/Core.Test/AutoFixture/SsoUserFixtures.cs +++ b/test/Core.Test/AutoFixture/SsoUserFixtures.cs @@ -1,11 +1,11 @@ using AutoFixture; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.SsoUserFixtures { @@ -17,7 +17,7 @@ namespace Bit.Core.Test.AutoFixture.SsoUserFixtures fixture.Customizations.Add(new GlobalSettingsBuilder()); fixture.Customizations.Add(new UserBuilder()); fixture.Customizations.Add(new OrganizationBuilder()); - fixture.Customize(composer => composer.Without(ou => ou.Id)); + fixture.Customize(composer => composer.Without(ou => ou.Id)); fixture.Customizations.Add(new EfRepositoryListBuilder()); fixture.Customizations.Add(new EfRepositoryListBuilder()); fixture.Customizations.Add(new EfRepositoryListBuilder()); diff --git a/test/Core.Test/AutoFixture/TaxRateFixtures.cs b/test/Core.Test/AutoFixture/TaxRateFixtures.cs index af42e224f..1132af01e 100644 --- a/test/Core.Test/AutoFixture/TaxRateFixtures.cs +++ b/test/Core.Test/AutoFixture/TaxRateFixtures.cs @@ -1,12 +1,12 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.TaxRateFixtures { @@ -20,14 +20,14 @@ namespace Bit.Core.Test.AutoFixture.TaxRateFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.TaxRate)) + if (type == null || type != typeof(TaxRate)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Insert(0, new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/TransactionFixutres.cs b/test/Core.Test/AutoFixture/TransactionFixutres.cs index 107c27a19..7c2199a30 100644 --- a/test/Core.Test/AutoFixture/TransactionFixutres.cs +++ b/test/Core.Test/AutoFixture/TransactionFixutres.cs @@ -1,15 +1,14 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Models.EntityFramework; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.TransactionFixtures { @@ -24,7 +23,7 @@ namespace Bit.Core.Test.AutoFixture.TransactionFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.Transaction)) + if (type == null || type != typeof(Entities.Transaction)) { return new NoSpecimen(); } @@ -36,7 +35,7 @@ namespace Bit.Core.Test.AutoFixture.TransactionFixtures .Without(c => c.OrganizationId)); } fixture.Customizations.Add(new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/U2fFixtures.cs b/test/Core.Test/AutoFixture/U2fFixtures.cs index 51c5d619d..6100c61ed 100644 --- a/test/Core.Test/AutoFixture/U2fFixtures.cs +++ b/test/Core.Test/AutoFixture/U2fFixtures.cs @@ -1,13 +1,13 @@ using System; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Repositories.EntityFramework; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.U2fFixtures { @@ -21,14 +21,14 @@ namespace Bit.Core.Test.AutoFixture.U2fFixtures } var type = request as Type; - if (type == null || type != typeof(TableModel.U2f)) + if (type == null || type != typeof(U2f)) { return new NoSpecimen(); } var fixture = new Fixture(); fixture.Customizations.Add(new MaxLengthStringRelay()); - var obj = fixture.WithAutoNSubstitutions().Create(); + var obj = fixture.WithAutoNSubstitutions().Create(); return obj; } } diff --git a/test/Core.Test/AutoFixture/UserFixtures.cs b/test/Core.Test/AutoFixture/UserFixtures.cs index ddc32f854..14a7ee434 100644 --- a/test/Core.Test/AutoFixture/UserFixtures.cs +++ b/test/Core.Test/AutoFixture/UserFixtures.cs @@ -2,14 +2,14 @@ using System.Collections.Generic; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Test.AutoFixture.EntityFrameworkRepositoryFixtures; using Bit.Core.Test.AutoFixture.OrganizationFixtures; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using TableModel = Bit.Core.Models.Table; namespace Bit.Core.Test.AutoFixture.UserFixtures { @@ -23,18 +23,18 @@ namespace Bit.Core.Test.AutoFixture.UserFixtures } var type = request as Type; - if (type == typeof(TableModel.User)) + if (type == typeof(User)) { var fixture = new Fixture(); var providers = fixture.Create>(); - var user = fixture.WithAutoNSubstitutions().Create(); + var user = fixture.WithAutoNSubstitutions().Create(); user.SetTwoFactorProviders(providers); return user; } - else if (type == typeof(List)) + else if (type == typeof(List)) { var fixture = new Fixture(); - var users = fixture.WithAutoNSubstitutions().CreateMany(2); + var users = fixture.WithAutoNSubstitutions().CreateMany(2); foreach (var user in users) { var providers = fixture.Create>(); diff --git a/test/Core.Test/Helpers/Factories.cs b/test/Core.Test/Helpers/Factories.cs index 0ca18e7c7..7f96bcdb7 100644 --- a/test/Core.Test/Helpers/Factories.cs +++ b/test/Core.Test/Helpers/Factories.cs @@ -1,15 +1,13 @@ using System.Collections.Generic; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Settings; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.Helpers.Factories; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; namespace Bit.Core.Test.Helpers.Factories { public static class DatabaseOptionsFactory { - public static List> Options { get; } = new List>(); + public static List> Options { get; } = new(); static DatabaseOptionsFactory() { diff --git a/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs b/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs index 48d0245ca..e456a434e 100644 --- a/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs +++ b/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs @@ -1,7 +1,7 @@ using System; using AutoFixture.Xunit2; +using Bit.Core.Entities; using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Table; using Bit.Core.Tokens; using Xunit; diff --git a/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs b/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs index 47b49f4ee..3aaccfbea 100644 --- a/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs +++ b/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs @@ -1,8 +1,7 @@ using System; -using System.Text.Json; using AutoFixture.Xunit2; +using Bit.Core.Entities; using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Table; using Bit.Core.Tokens; using Xunit; diff --git a/test/Core.Test/Models/CipherTests.cs b/test/Core.Test/Models/CipherTests.cs index 06fe15f68..4a339b8e1 100644 --- a/test/Core.Test/Models/CipherTests.cs +++ b/test/Core.Test/Models/CipherTests.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.CipherFixtures; using Newtonsoft.Json; using Xunit; diff --git a/test/Core.Test/Models/PermissionsTests.cs b/test/Core.Test/Models/PermissionsTests.cs index 090bc72a6..5b15b7d4b 100644 --- a/test/Core.Test/Models/PermissionsTests.cs +++ b/test/Core.Test/Models/PermissionsTests.cs @@ -2,7 +2,6 @@ using System.Text.Json; using AutoFixture.Xunit2; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; diff --git a/test/Core.Test/Models/Tables/UserTests.cs b/test/Core.Test/Models/Tables/UserTests.cs index 851174e05..3db8d3055 100644 --- a/test/Core.Test/Models/Tables/UserTests.cs +++ b/test/Core.Test/Models/Tables/UserTests.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Xunit; namespace Bit.Core.Test.Models.Tables diff --git a/test/Core.Test/Repositories/EntityFramework/CipherRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/CipherRepositoryTests.cs index f1fbb11e9..3509a4e6a 100644 --- a/test/Core.Test/Repositories/EntityFramework/CipherRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/CipherRepositoryTests.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework.Queries; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.CipherFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; -using Microsoft.EntityFrameworkCore; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; +using LinqToDB; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/CollectionRepository.cs b/test/Core.Test/Repositories/EntityFramework/CollectionRepository.cs index eadac57aa..20183951a 100644 --- a/test/Core.Test/Repositories/EntityFramework/CollectionRepository.cs +++ b/test/Core.Test/Repositories/EntityFramework/CollectionRepository.cs @@ -1,15 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Test.AutoFixture; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.CollectionFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; -using Microsoft.EntityFrameworkCore; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/DeviceRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/DeviceRepositoryTests.cs index c62b70eda..ac91035f8 100644 --- a/test/Core.Test/Repositories/EntityFramework/DeviceRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/DeviceRepositoryTests.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.DeviceFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/EmergencyAccessRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/EmergencyAccessRepositoryTests.cs index 4f8007a63..2b319b8d3 100644 --- a/test/Core.Test/Repositories/EntityFramework/EmergencyAccessRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/EmergencyAccessRepositoryTests.cs @@ -3,15 +3,15 @@ using System.Linq; using AutoFixture; using AutoFixture.DataAnnotations; using AutoFixture.Kernel; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.EmergencyAccessFixtures; using Bit.Core.Test.AutoFixture.Relays; using Bit.Core.Test.AutoFixture.TransactionFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CipherCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CipherCompare.cs index f396bdf7b..b405d87a1 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CipherCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CipherCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CollectionCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CollectionCompare.cs index eeced8b66..aa5303e92 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CollectionCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/CollectionCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/DeviceCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/DeviceCompare.cs index f793a784d..159ed9cdb 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/DeviceCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/DeviceCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EmergencyAccessCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EmergencyAccessCompare.cs index 36bce9b6e..aaa3d799c 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EmergencyAccessCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EmergencyAccessCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EventCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EventCompare.cs index 3c1733483..e8add1450 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EventCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/EventCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/FolderCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/FolderCompare.cs index 41f25dc26..bb9dce2b4 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/FolderCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/FolderCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GrantCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GrantCompare.cs index f0b07da30..fadab5a26 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GrantCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GrantCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GroupCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GroupCompare.cs index 3604368cf..2d48f95ba 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GroupCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/GroupCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/InstallationCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/InstallationCompare.cs index 496b71cb6..11259334c 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/InstallationCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/InstallationCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationCompare.cs index 91ef9f3bc..69d140137 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationSponsorshipCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationSponsorshipCompare.cs index c9698e07f..97ef30985 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationSponsorshipCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationSponsorshipCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationUserCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationUserCompare.cs index 3684b2077..715e72907 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationUserCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/OrganizationUserCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/PolicyCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/PolicyCompare.cs index a192502f1..964ca6e36 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/PolicyCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/PolicyCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SendCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SendCompare.cs index 917ee30a3..ca97abcf6 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SendCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SendCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoConfigCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoConfigCompare.cs index 47c24bc3a..4d435cb33 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoConfigCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoConfigCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoUserCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoUserCompare.cs index d11c2e518..d6a826949 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoUserCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/SsoUserCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TaxRateCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TaxRateCompare.cs index 13d7a29bc..bcc8c1f5b 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TaxRateCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TaxRateCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TransactionCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TransactionCompare.cs index 5de0c4c33..36df5f80f 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TransactionCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/TransactionCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/U2fCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/U2fCompare.cs index 09687b7d8..7736c70aa 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/U2fCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/U2fCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/UserCompare.cs b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/UserCompare.cs index 1388ea96b..77fe57887 100644 --- a/test/Core.Test/Repositories/EntityFramework/EqualityComparers/UserCompare.cs +++ b/test/Core.Test/Repositories/EntityFramework/EqualityComparers/UserCompare.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Bit.Core.Models.Table; +using Bit.Core.Entities; namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers { diff --git a/test/Core.Test/Repositories/EntityFramework/FolderRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/FolderRepositoryTests.cs index 4dd478e17..8941683be 100644 --- a/test/Core.Test/Repositories/EntityFramework/FolderRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/FolderRepositoryTests.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.FolderFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Microsoft.EntityFrameworkCore; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/InstallationRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/InstallationRepositoryTests.cs index 45991d7e9..2bf26d5f1 100644 --- a/test/Core.Test/Repositories/EntityFramework/InstallationRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/InstallationRepositoryTests.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.InstallationFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/OrganizationRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/OrganizationRepositoryTests.cs index dc6c3e0d1..251bd08c3 100644 --- a/test/Core.Test/Repositories/EntityFramework/OrganizationRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/OrganizationRepositoryTests.cs @@ -7,9 +7,9 @@ using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Core.Test.Helpers.Factories; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; -using TableModel = Bit.Core.Models.Table; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using Organization = Bit.Core.Entities.Organization; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { @@ -17,11 +17,11 @@ namespace Bit.Core.Test.Repositories.EntityFramework { [CiSkippedTheory, EfOrganizationAutoData] public async void CreateAsync_Works_DataMatches( - TableModel.Organization organization, + Organization organization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityComparer, List suts) { - var savedOrganizations = new List(); + var savedOrganizations = new List(); foreach (var sut in suts) { var postEfOrganization = await sut.CreateAsync(organization); @@ -39,11 +39,11 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationAutoData] - public async void ReplaceAsync_Works_DataMatches(TableModel.Organization postOrganization, - TableModel.Organization replaceOrganization, SqlRepo.OrganizationRepository sqlOrganizationRepo, + public async void ReplaceAsync_Works_DataMatches(Organization postOrganization, + Organization replaceOrganization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityComparer, List suts) { - var savedOrganizations = new List(); + var savedOrganizations = new List(); foreach (var sut in suts) { var postEfOrganization = await sut.CreateAsync(postOrganization); @@ -67,7 +67,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationAutoData] - public async void DeleteAsync_Works_DataMatches(TableModel.Organization organization, + public async void DeleteAsync_Works_DataMatches(Organization organization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityComparer, List suts) { @@ -97,11 +97,11 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationAutoData] - public async void GetByIdentifierAsync_Works_DataMatches(TableModel.Organization organization, + public async void GetByIdentifierAsync_Works_DataMatches(Organization organization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityComparer, List suts) { - var returnedOrgs = new List(); + var returnedOrgs = new List(); foreach (var sut in suts) { var postEfOrg = await sut.CreateAsync(organization); @@ -119,11 +119,11 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationAutoData] - public async void GetManyByEnabledAsync_Works_DataMatches(TableModel.Organization organization, + public async void GetManyByEnabledAsync_Works_DataMatches(Organization organization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityCompare, List suts) { - var returnedOrgs = new List(); + var returnedOrgs = new List(); foreach (var sut in suts) { var postEfOrg = await sut.CreateAsync(organization); @@ -141,7 +141,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework // testing data matches here would require manipulating all organization abilities in the db [CiSkippedTheory, EfOrganizationAutoData] - public async void GetManyAbilitiesAsync_Works(TableModel.Organization organization, + public async void GetManyAbilitiesAsync_Works(Organization organization, SqlRepo.OrganizationRepository sqlOrganizationRepo, OrganizationCompare equalityComparer, List suts) { diff --git a/test/Core.Test/Repositories/EntityFramework/OrganizationSponsorshipRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/OrganizationSponsorshipRepositoryTests.cs index 3fc9dbb6b..603b08cae 100644 --- a/test/Core.Test/Repositories/EntityFramework/OrganizationSponsorshipRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/OrganizationSponsorshipRepositoryTests.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.OrganizationSponsorshipFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; -using TableModel = Bit.Core.Models.Table; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { @@ -14,7 +14,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework { [CiSkippedTheory, EfOrganizationSponsorshipAutoData] public async void CreateAsync_Works_DataMatches( - TableModel.OrganizationSponsorship organizationSponsorship, TableModel.Organization sponsoringOrg, + OrganizationSponsorship organizationSponsorship, Organization sponsoringOrg, List efOrgRepos, SqlRepo.OrganizationRepository sqlOrganizationRepo, SqlRepo.OrganizationSponsorshipRepository sqlOrganizationSponsorshipRepo, @@ -24,7 +24,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework organizationSponsorship.InstallationId = null; organizationSponsorship.SponsoredOrganizationId = null; - var savedOrganizationSponsorships = new List(); + var savedOrganizationSponsorships = new List(); foreach (var (sut, orgRepo) in suts.Zip(efOrgRepos)) { var efSponsoringOrg = await orgRepo.CreateAsync(sponsoringOrg); @@ -49,8 +49,8 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationSponsorshipAutoData] - public async void ReplaceAsync_Works_DataMatches(TableModel.OrganizationSponsorship postOrganizationSponsorship, - TableModel.OrganizationSponsorship replaceOrganizationSponsorship, TableModel.Organization sponsoringOrg, + public async void ReplaceAsync_Works_DataMatches(OrganizationSponsorship postOrganizationSponsorship, + OrganizationSponsorship replaceOrganizationSponsorship, Organization sponsoringOrg, List efOrgRepos, SqlRepo.OrganizationRepository sqlOrganizationRepo, SqlRepo.OrganizationSponsorshipRepository sqlOrganizationSponsorshipRepo, @@ -61,7 +61,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework replaceOrganizationSponsorship.InstallationId = null; replaceOrganizationSponsorship.SponsoredOrganizationId = null; - var savedOrganizationSponsorships = new List(); + var savedOrganizationSponsorships = new List(); foreach (var (sut, orgRepo) in suts.Zip(efOrgRepos)) { var efSponsoringOrg = await orgRepo.CreateAsync(sponsoringOrg); @@ -93,8 +93,8 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationSponsorshipAutoData] - public async void DeleteAsync_Works_DataMatches(TableModel.OrganizationSponsorship organizationSponsorship, - TableModel.Organization sponsoringOrg, + public async void DeleteAsync_Works_DataMatches(OrganizationSponsorship organizationSponsorship, + Organization sponsoringOrg, List efOrgRepos, SqlRepo.OrganizationRepository sqlOrganizationRepo, SqlRepo.OrganizationSponsorshipRepository sqlOrganizationSponsorshipRepo, diff --git a/test/Core.Test/Repositories/EntityFramework/OrganizationUserRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/OrganizationUserRepositoryTests.cs index c7bb0dbf7..a0c405094 100644 --- a/test/Core.Test/Repositories/EntityFramework/OrganizationUserRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/OrganizationUserRepositoryTests.cs @@ -1,27 +1,28 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.OrganizationUserFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; -using TableModel = Bit.Core.Models.Table; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using OrganizationUser = Bit.Core.Entities.OrganizationUser; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { public class OrganizationUserRepositoryTests { [CiSkippedTheory, EfOrganizationUserAutoData] - public async void CreateAsync_Works_DataMatches(TableModel.OrganizationUser orgUser, TableModel.User user, TableModel.Organization org, + public async void CreateAsync_Works_DataMatches(OrganizationUser orgUser, User user, Organization org, OrganizationUserCompare equalityComparer, List suts, List efOrgRepos, List efUserRepos, SqlRepo.OrganizationUserRepository sqlOrgUserRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo) { - var savedOrgUsers = new List(); + var savedOrgUsers = new List(); foreach (var sut in suts) { var i = suts.IndexOf(sut); @@ -54,10 +55,10 @@ namespace Bit.Core.Test.Repositories.EntityFramework [CiSkippedTheory, EfOrganizationUserAutoData] public async void ReplaceAsync_Works_DataMatches( - TableModel.OrganizationUser postOrgUser, - TableModel.OrganizationUser replaceOrgUser, - TableModel.User user, - TableModel.Organization org, + OrganizationUser postOrgUser, + OrganizationUser replaceOrgUser, + User user, + Organization org, OrganizationUserCompare equalityComparer, List suts, List efUserRepos, @@ -67,7 +68,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework SqlRepo.OrganizationRepository sqlOrgRepo ) { - var savedOrgUsers = new List(); + var savedOrgUsers = new List(); foreach (var sut in suts) { var i = suts.IndexOf(sut); @@ -105,7 +106,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework } [CiSkippedTheory, EfOrganizationUserAutoData] - public async void DeleteAsync_Works_DataMatches(TableModel.OrganizationUser orgUser, TableModel.User user, TableModel.Organization org, + public async void DeleteAsync_Works_DataMatches(OrganizationUser orgUser, User user, Organization org, OrganizationUserCompare equalityComparer, List suts, List efUserRepos, List efOrgRepos, SqlRepo.OrganizationUserRepository sqlOrgUserRepo, SqlRepo.UserRepository sqlUserRepo, diff --git a/test/Core.Test/Repositories/EntityFramework/PolicyRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/PolicyRepositoryTests.cs index d929a026f..b450a26bc 100644 --- a/test/Core.Test/Repositories/EntityFramework/PolicyRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/PolicyRepositoryTests.cs @@ -1,21 +1,18 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; -using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Repositories; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Test.AutoFixture; using Bit.Core.Test.AutoFixture.Attributes; -using Bit.Core.Test.AutoFixture.OrganizationUserFixtures; using Bit.Core.Test.AutoFixture.PolicyFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; -using Microsoft.EntityFrameworkCore; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; -using TableModel = Bit.Core.Models.Table; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using Policy = Bit.Core.Entities.Policy; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { @@ -23,8 +20,8 @@ namespace Bit.Core.Test.Repositories.EntityFramework { [CiSkippedTheory, EfPolicyAutoData] public async void CreateAsync_Works_DataMatches( - TableModel.Policy policy, - TableModel.Organization organization, + Policy policy, + Organization organization, PolicyCompare equalityComparer, List suts, List efOrganizationRepos, @@ -32,7 +29,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework SqlRepo.OrganizationRepository sqlOrganizationRepo ) { - var savedPolicys = new List(); + var savedPolicys = new List(); foreach (var sut in suts) { var i = suts.IndexOf(sut); @@ -81,13 +78,13 @@ namespace Bit.Core.Test.Repositories.EntityFramework bool isProvider, // Auto data - models - TableModel.Policy policy, - TableModel.User user, - TableModel.Organization organization, - TableModel.OrganizationUser orgUser, - TableModel.Provider.Provider provider, - TableModel.Provider.ProviderOrganization providerOrganization, - TableModel.Provider.ProviderUser providerUser, + Policy policy, + User user, + Organization organization, + OrganizationUser orgUser, + Provider provider, + ProviderOrganization providerOrganization, + ProviderUser providerUser, PolicyCompareIncludingOrganization equalityComparer, // Auto data - EF repos @@ -140,7 +137,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework policy.Enabled = policyEnabled; policy.Type = savedPolicyType; - var results = new List(); + var results = new List(); foreach (var policyRepo in policyRepos) { @@ -181,7 +178,7 @@ namespace Bit.Core.Test.Repositories.EntityFramework await policyRepo.CreateAsync(policy); if (suts.Contains(policyRepo)) { - (policyRepo as BaseEntityFrameworkRepository).ClearChangeTracking(); + (policyRepo as EfRepo.BaseEntityFrameworkRepository).ClearChangeTracking(); } var minStatus = includeInvited ? OrganizationUserStatusType.Invited : OrganizationUserStatusType.Accepted; diff --git a/test/Core.Test/Repositories/EntityFramework/SendRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/SendRepositoryTests.cs index 9b2660cdf..5145e002f 100644 --- a/test/Core.Test/Repositories/EntityFramework/SendRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/SendRepositoryTests.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.SendFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/SsoConfigRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/SsoConfigRepositoryTests.cs index 3b2e00435..8ac3df87b 100644 --- a/test/Core.Test/Repositories/EntityFramework/SsoConfigRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/SsoConfigRepositoryTests.cs @@ -1,15 +1,15 @@ using System; using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.SsoConfigFixtures; using Bit.Core.Test.Helpers.Factories; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/SsoUserRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/SsoUserRepositoryTests.cs index 0562f8d4b..1eb318c45 100644 --- a/test/Core.Test/Repositories/EntityFramework/SsoUserRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/SsoUserRepositoryTests.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.SsoUserFixtures; using Bit.Core.Test.Helpers.Factories; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/TaxRateRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/TaxRateRepositoryTests.cs index 892032002..844f2048b 100644 --- a/test/Core.Test/Repositories/EntityFramework/TaxRateRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/TaxRateRepositoryTests.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.TaxRateFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/TransactionRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/TransactionRepositoryTests.cs index c25c48254..cafd6c87d 100644 --- a/test/Core.Test/Repositories/EntityFramework/TransactionRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/TransactionRepositoryTests.cs @@ -1,15 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Test.AutoFixture; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.TransactionFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; -using Microsoft.EntityFrameworkCore; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/U2fRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/U2fRepositoryTests.cs index 3ea666ee3..cd15ae5a1 100644 --- a/test/Core.Test/Repositories/EntityFramework/U2fRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/U2fRepositoryTests.cs @@ -1,15 +1,12 @@ using System.Collections.Generic; using System.Linq; -using Bit.Core.Models.Table; -using Bit.Core.Repositories.EntityFramework; -using Bit.Core.Test.AutoFixture; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.U2fFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; -using Microsoft.EntityFrameworkCore; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Repositories/EntityFramework/UserRepositoryTests.cs b/test/Core.Test/Repositories/EntityFramework/UserRepositoryTests.cs index e6545e4fb..23eee7e11 100644 --- a/test/Core.Test/Repositories/EntityFramework/UserRepositoryTests.cs +++ b/test/Core.Test/Repositories/EntityFramework/UserRepositoryTests.cs @@ -1,14 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Core.Test.AutoFixture.UserFixtures; using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers; using Xunit; -using EfRepo = Bit.Core.Repositories.EntityFramework; -using SqlRepo = Bit.Core.Repositories.SqlServer; +using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Core.Test.Repositories.EntityFramework { diff --git a/test/Core.Test/Services/CipherServiceTests.cs b/test/Core.Test/Services/CipherServiceTests.cs index fe5fb2da0..9a3e97252 100644 --- a/test/Core.Test/Services/CipherServiceTests.cs +++ b/test/Core.Test/Services/CipherServiceTests.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Test.AutoFixture.CipherFixtures; diff --git a/test/Core.Test/Services/CollectionServiceTests.cs b/test/Core.Test/Services/CollectionServiceTests.cs index 727621690..cad18f046 100644 --- a/test/Core.Test/Services/CollectionServiceTests.cs +++ b/test/Core.Test/Services/CollectionServiceTests.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Test.AutoFixture.CollectionFixtures; diff --git a/test/Core.Test/Services/DeviceServiceTests.cs b/test/Core.Test/Services/DeviceServiceTests.cs index 413648634..bf5766f43 100644 --- a/test/Core.Test/Services/DeviceServiceTests.cs +++ b/test/Core.Test/Services/DeviceServiceTests.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using NSubstitute; diff --git a/test/Core.Test/Services/EmergencyAccessServiceTests.cs b/test/Core.Test/Services/EmergencyAccessServiceTests.cs index f010ec993..aed79cc17 100644 --- a/test/Core.Test/Services/EmergencyAccessServiceTests.cs +++ b/test/Core.Test/Services/EmergencyAccessServiceTests.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Test.AutoFixture; diff --git a/test/Core.Test/Services/GroupServiceTests.cs b/test/Core.Test/Services/GroupServiceTests.cs index 824e4d2bb..0018d47c8 100644 --- a/test/Core.Test/Services/GroupServiceTests.cs +++ b/test/Core.Test/Services/GroupServiceTests.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Test.AutoFixture; diff --git a/test/Core.Test/Services/HandlebarsMailServiceTests.cs b/test/Core.Test/Services/HandlebarsMailServiceTests.cs index a531ecb11..f5931e2c8 100644 --- a/test/Core.Test/Services/HandlebarsMailServiceTests.cs +++ b/test/Core.Test/Services/HandlebarsMailServiceTests.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; +using Bit.Core.Entities; +using Bit.Core.Entities.Provider; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; -using Bit.Core.Models.Table.Provider; using Bit.Core.Services; using Bit.Core.Settings; using Microsoft.Extensions.Logging; diff --git a/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs b/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs index 846b9784b..64ab3b834 100644 --- a/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs +++ b/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs @@ -2,8 +2,8 @@ using System.IO; using System.Threading.Tasks; using AutoFixture; +using Bit.Core.Entities; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Test.AutoFixture.CipherAttachmentMetaData; diff --git a/test/Core.Test/Services/OrganizationServiceTests.cs b/test/Core.Test/Services/OrganizationServiceTests.cs index ab3d9ee7d..02207d4ed 100644 --- a/test/Core.Test/Services/OrganizationServiceTests.cs +++ b/test/Core.Test/Services/OrganizationServiceTests.cs @@ -4,11 +4,11 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; @@ -19,9 +19,9 @@ using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -using Organization = Bit.Core.Models.Table.Organization; -using OrganizationUser = Bit.Core.Models.Table.OrganizationUser; -using Policy = Bit.Core.Models.Table.Policy; +using Organization = Bit.Core.Entities.Organization; +using OrganizationUser = Bit.Core.Entities.OrganizationUser; +using Policy = Bit.Core.Entities.Policy; namespace Bit.Core.Test.Services { diff --git a/test/Core.Test/Services/OrganizationSponsorshipServiceTests.cs b/test/Core.Test/Services/OrganizationSponsorshipServiceTests.cs index cde45af20..0b43fcd83 100644 --- a/test/Core.Test/Services/OrganizationSponsorshipServiceTests.cs +++ b/test/Core.Test/Services/OrganizationSponsorshipServiceTests.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/test/Core.Test/Services/PolicyServiceTests.cs b/test/Core.Test/Services/PolicyServiceTests.cs index c5932190b..c8b49918c 100644 --- a/test/Core.Test/Services/PolicyServiceTests.cs +++ b/test/Core.Test/Services/PolicyServiceTests.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; @@ -18,7 +18,7 @@ namespace Bit.Core.Test.Services public class PolicyServiceTests { [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_OrganizationDoesNotExist_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.DisableSend)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_OrganizationDoesNotExist_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.DisableSend)] Policy policy, SutProvider sutProvider) { SetupOrg(sutProvider, policy.OrganizationId, null); @@ -40,7 +40,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_OrganizationCannotUsePolicies_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.DisableSend)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_OrganizationCannotUsePolicies_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.DisableSend)] Policy policy, SutProvider sutProvider) { var orgId = Guid.NewGuid(); @@ -67,7 +67,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_SingleOrg_RequireSsoEnabled_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.SingleOrg)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_SingleOrg_RequireSsoEnabled_ThrowsBadRequest([PolicyFixtures.Policy(PolicyType.SingleOrg)] Policy policy, SutProvider sutProvider) { policy.Enabled = false; @@ -79,7 +79,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency() .GetByOrganizationIdTypeAsync(policy.OrganizationId, PolicyType.RequireSso) - .Returns(Task.FromResult(new Core.Models.Table.Policy { Enabled = true })); + .Returns(Task.FromResult(new Policy { Enabled = true })); var badRequestException = await Assert.ThrowsAsync( () => sutProvider.Sut.SaveAsync(policy, @@ -99,7 +99,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_SingleOrg_VaultTimeoutEnabled_ThrowsBadRequest([PolicyFixtures.Policy(Enums.PolicyType.SingleOrg)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_SingleOrg_VaultTimeoutEnabled_ThrowsBadRequest([PolicyFixtures.Policy(Enums.PolicyType.SingleOrg)] Policy policy, SutProvider sutProvider) { policy.Enabled = false; @@ -165,7 +165,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_RequireSsoPolicy_NotEnabled_ThrowsBadRequestAsync([PolicyFixtures.Policy(Enums.PolicyType.RequireSso)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_RequireSsoPolicy_NotEnabled_ThrowsBadRequestAsync([PolicyFixtures.Policy(Enums.PolicyType.RequireSso)] Policy policy, SutProvider sutProvider) { policy.Enabled = true; @@ -177,7 +177,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency() .GetByOrganizationIdTypeAsync(policy.OrganizationId, PolicyType.SingleOrg) - .Returns(Task.FromResult(new Core.Models.Table.Policy { Enabled = false })); + .Returns(Task.FromResult(new Policy { Enabled = false })); var badRequestException = await Assert.ThrowsAsync( () => sutProvider.Sut.SaveAsync(policy, @@ -197,7 +197,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_NewPolicy_Created([PolicyFixtures.Policy(PolicyType.MasterPassword)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_NewPolicy_Created([PolicyFixtures.Policy(PolicyType.MasterPassword)] Policy policy, SutProvider sutProvider) { policy.Id = default; @@ -222,7 +222,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_VaultTimeoutPolicy_NotEnabled_ThrowsBadRequestAsync([PolicyFixtures.Policy(Enums.PolicyType.MaximumVaultTimeout)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_VaultTimeoutPolicy_NotEnabled_ThrowsBadRequestAsync([PolicyFixtures.Policy(Enums.PolicyType.MaximumVaultTimeout)] Policy policy, SutProvider sutProvider) { policy.Enabled = true; @@ -234,7 +234,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency() .GetByOrganizationIdTypeAsync(policy.OrganizationId, Enums.PolicyType.SingleOrg) - .Returns(Task.FromResult(new Core.Models.Table.Policy { Enabled = false })); + .Returns(Task.FromResult(new Policy { Enabled = false })); var badRequestException = await Assert.ThrowsAsync( () => sutProvider.Sut.SaveAsync(policy, @@ -254,7 +254,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_ExistingPolicy_UpdateTwoFactor([PolicyFixtures.Policy(PolicyType.TwoFactorAuthentication)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_ExistingPolicy_UpdateTwoFactor([PolicyFixtures.Policy(PolicyType.TwoFactorAuthentication)] Policy policy, SutProvider sutProvider) { // If the policy that this is updating isn't enabled then do some work now that the current one is enabled @@ -269,7 +269,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency() .GetByIdAsync(policy.Id) - .Returns(new Core.Models.Table.Policy + .Returns(new Policy { Id = policy.Id, Type = PolicyType.TwoFactorAuthentication, @@ -323,7 +323,7 @@ namespace Bit.Core.Test.Services } [Theory, CustomAutoData(typeof(SutProviderCustomization))] - public async Task SaveAsync_ExistingPolicy_UpdateSingleOrg([PolicyFixtures.Policy(PolicyType.TwoFactorAuthentication)] Core.Models.Table.Policy policy, SutProvider sutProvider) + public async Task SaveAsync_ExistingPolicy_UpdateSingleOrg([PolicyFixtures.Policy(PolicyType.TwoFactorAuthentication)] Policy policy, SutProvider sutProvider) { // If the policy that this is updating isn't enabled then do some work now that the current one is enabled @@ -338,7 +338,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency() .GetByIdAsync(policy.Id) - .Returns(new Core.Models.Table.Policy + .Returns(new Policy { Id = policy.Id, Type = PolicyType.SingleOrg, diff --git a/test/Core.Test/Services/SendServiceTests.cs b/test/Core.Test/Services/SendServiceTests.cs index 974e0e674..eeb467009 100644 --- a/test/Core.Test/Services/SendServiceTests.cs +++ b/test/Core.Test/Services/SendServiceTests.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Text.Json; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Test.AutoFixture.SendFixtures; diff --git a/test/Core.Test/Services/SsoConfigServiceTests.cs b/test/Core.Test/Services/SsoConfigServiceTests.cs index 310859e60..3438ee922 100644 --- a/test/Core.Test/Services/SsoConfigServiceTests.cs +++ b/test/Core.Test/Services/SsoConfigServiceTests.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Models.Data; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; diff --git a/test/Core.Test/Services/StripePaymentServiceTests.cs b/test/Core.Test/Services/StripePaymentServiceTests.cs index a88cdd055..398674b5c 100644 --- a/test/Core.Test/Services/StripePaymentServiceTests.cs +++ b/test/Core.Test/Services/StripePaymentServiceTests.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.Models.Table; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; diff --git a/test/Core.Test/Services/UserServiceTests.cs b/test/Core.Test/Services/UserServiceTests.cs index 18cc63f1d..ee43a5c13 100644 --- a/test/Core.Test/Services/UserServiceTests.cs +++ b/test/Core.Test/Services/UserServiceTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Bit.Core.Context; -using Bit.Core.Models.Table; +using Bit.Core.Entities; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/test/Core.Test/Utilities/CoreHelpersTests.cs b/test/Core.Test/Utilities/CoreHelpersTests.cs index 36e0515b1..6264610f6 100644 --- a/test/Core.Test/Utilities/CoreHelpersTests.cs +++ b/test/Core.Test/Utilities/CoreHelpersTests.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Linq; using AutoFixture; using Bit.Core.Context; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; -using Bit.Core.Models.Table; using Bit.Core.Test.AutoFixture.UserFixtures; using Bit.Core.Utilities; +using Bit.Infrastructure.Dapper; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using IdentityModel; diff --git a/util/MySqlMigrations/Factories.cs b/util/MySqlMigrations/Factories.cs index 935299777..a47875019 100644 --- a/util/MySqlMigrations/Factories.cs +++ b/util/MySqlMigrations/Factories.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using Bit.Core.Enums; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Settings; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; diff --git a/util/MySqlMigrations/Migrations/20210617183900_Init.Designer.cs b/util/MySqlMigrations/Migrations/20210617183900_Init.Designer.cs index 932da8d2b..d83b4ee31 100644 --- a/util/MySqlMigrations/Migrations/20210617183900_Init.Designer.cs +++ b/util/MySqlMigrations/Migrations/20210617183900_Init.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20210709095522_RemoveProviderOrganizationProviderUser.Designer.cs b/util/MySqlMigrations/Migrations/20210709095522_RemoveProviderOrganizationProviderUser.Designer.cs index 0fc1de79a..3b435aeb6 100644 --- a/util/MySqlMigrations/Migrations/20210709095522_RemoveProviderOrganizationProviderUser.Designer.cs +++ b/util/MySqlMigrations/Migrations/20210709095522_RemoveProviderOrganizationProviderUser.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20210716142145_UserForcePasswordReset.Designer.cs b/util/MySqlMigrations/Migrations/20210716142145_UserForcePasswordReset.Designer.cs index ede70169d..729112e03 100644 --- a/util/MySqlMigrations/Migrations/20210716142145_UserForcePasswordReset.Designer.cs +++ b/util/MySqlMigrations/Migrations/20210716142145_UserForcePasswordReset.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20210921132418_AddMaxAutoscaleSeatsToOrganization.Designer.cs b/util/MySqlMigrations/Migrations/20210921132418_AddMaxAutoscaleSeatsToOrganization.Designer.cs index 9aac1898f..ffbbbf64d 100644 --- a/util/MySqlMigrations/Migrations/20210921132418_AddMaxAutoscaleSeatsToOrganization.Designer.cs +++ b/util/MySqlMigrations/Migrations/20210921132418_AddMaxAutoscaleSeatsToOrganization.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20211011144835_SplitManageCollectionsPermissions2.Designer.cs b/util/MySqlMigrations/Migrations/20211011144835_SplitManageCollectionsPermissions2.Designer.cs index aa86100fb..973c02d5d 100644 --- a/util/MySqlMigrations/Migrations/20211011144835_SplitManageCollectionsPermissions2.Designer.cs +++ b/util/MySqlMigrations/Migrations/20211011144835_SplitManageCollectionsPermissions2.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20211021201150_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs b/util/MySqlMigrations/Migrations/20211021201150_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs index 8cb10a95a..f9076340e 100644 --- a/util/MySqlMigrations/Migrations/20211021201150_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs +++ b/util/MySqlMigrations/Migrations/20211021201150_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20211108041911_KeyConnector.Designer.cs b/util/MySqlMigrations/Migrations/20211108041911_KeyConnector.Designer.cs index 2852a1190..cbec90c47 100644 --- a/util/MySqlMigrations/Migrations/20211108041911_KeyConnector.Designer.cs +++ b/util/MySqlMigrations/Migrations/20211108041911_KeyConnector.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20211108225243_OrganizationSponsorship.Designer.cs b/util/MySqlMigrations/Migrations/20211108225243_OrganizationSponsorship.Designer.cs index 4631f9e77..99b391395 100644 --- a/util/MySqlMigrations/Migrations/20211108225243_OrganizationSponsorship.Designer.cs +++ b/util/MySqlMigrations/Migrations/20211108225243_OrganizationSponsorship.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/20211115145402_KeyConnectorFlag.Designer.cs b/util/MySqlMigrations/Migrations/20211115145402_KeyConnectorFlag.Designer.cs index 287ac5bda..e6bf8175b 100644 --- a/util/MySqlMigrations/Migrations/20211115145402_KeyConnectorFlag.Designer.cs +++ b/util/MySqlMigrations/Migrations/20211115145402_KeyConnectorFlag.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs b/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs index 653f22c8b..59a77919d 100644 --- a/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/util/PostgresMigrations/Factories.cs b/util/PostgresMigrations/Factories.cs index 5c0cd79d0..98a6ebea7 100644 --- a/util/PostgresMigrations/Factories.cs +++ b/util/PostgresMigrations/Factories.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using Bit.Core.Enums; -using Bit.Core.Repositories.EntityFramework; using Bit.Core.Settings; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; diff --git a/util/PostgresMigrations/Migrations/20210708191531_Init.Designer.cs b/util/PostgresMigrations/Migrations/20210708191531_Init.Designer.cs index abec18b65..73f66165a 100644 --- a/util/PostgresMigrations/Migrations/20210708191531_Init.Designer.cs +++ b/util/PostgresMigrations/Migrations/20210708191531_Init.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20210709092227_RemoveProviderOrganizationProviderUser.Designer.cs b/util/PostgresMigrations/Migrations/20210709092227_RemoveProviderOrganizationProviderUser.Designer.cs index cce294ced..22dd25fd3 100644 --- a/util/PostgresMigrations/Migrations/20210709092227_RemoveProviderOrganizationProviderUser.Designer.cs +++ b/util/PostgresMigrations/Migrations/20210709092227_RemoveProviderOrganizationProviderUser.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20210716141748_UserForcePasswordReset.Designer.cs b/util/PostgresMigrations/Migrations/20210716141748_UserForcePasswordReset.Designer.cs index 449144642..1799bb61e 100644 --- a/util/PostgresMigrations/Migrations/20210716141748_UserForcePasswordReset.Designer.cs +++ b/util/PostgresMigrations/Migrations/20210716141748_UserForcePasswordReset.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20210920201829_AddMaxAutoscaleSeatsToOrganization.Designer.cs b/util/PostgresMigrations/Migrations/20210920201829_AddMaxAutoscaleSeatsToOrganization.Designer.cs index a992e8aad..b12f79570 100644 --- a/util/PostgresMigrations/Migrations/20210920201829_AddMaxAutoscaleSeatsToOrganization.Designer.cs +++ b/util/PostgresMigrations/Migrations/20210920201829_AddMaxAutoscaleSeatsToOrganization.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20211011145128_SplitManageCollectionsPermissions2.Designer.cs b/util/PostgresMigrations/Migrations/20211011145128_SplitManageCollectionsPermissions2.Designer.cs index daf45b756..e7c3c7cdb 100644 --- a/util/PostgresMigrations/Migrations/20211011145128_SplitManageCollectionsPermissions2.Designer.cs +++ b/util/PostgresMigrations/Migrations/20211011145128_SplitManageCollectionsPermissions2.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20211021204521_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs b/util/PostgresMigrations/Migrations/20211021204521_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs index 007a6a1b5..1817825a8 100644 --- a/util/PostgresMigrations/Migrations/20211021204521_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs +++ b/util/PostgresMigrations/Migrations/20211021204521_SetMaxAutoscaleSeatsToCurrentSeatCount.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20211108041547_KeyConnector.Designer.cs b/util/PostgresMigrations/Migrations/20211108041547_KeyConnector.Designer.cs index 8919e604e..45a959656 100644 --- a/util/PostgresMigrations/Migrations/20211108041547_KeyConnector.Designer.cs +++ b/util/PostgresMigrations/Migrations/20211108041547_KeyConnector.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20211108225011_OrganizationSponsorship.Designer.cs b/util/PostgresMigrations/Migrations/20211108225011_OrganizationSponsorship.Designer.cs index d512fb402..4c59a8d42 100644 --- a/util/PostgresMigrations/Migrations/20211108225011_OrganizationSponsorship.Designer.cs +++ b/util/PostgresMigrations/Migrations/20211108225011_OrganizationSponsorship.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/20211115142623_KeyConnectorFlag.Designer.cs b/util/PostgresMigrations/Migrations/20211115142623_KeyConnectorFlag.Designer.cs index 63628cfe1..6be8ae65e 100644 --- a/util/PostgresMigrations/Migrations/20211115142623_KeyConnectorFlag.Designer.cs +++ b/util/PostgresMigrations/Migrations/20211115142623_KeyConnectorFlag.Designer.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs b/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs index ed14e0421..7e0f0c9ee 100644 --- a/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs @@ -1,6 +1,6 @@ // using System; -using Bit.Core.Repositories.EntityFramework; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;