From a33c0d3d4a5fbb73e76072f76c9c618f073ddeef Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 3 Sep 2024 08:58:51 +0200 Subject: [PATCH] feat(processWorker): create process worker package Refs: #240 --- src/Portal.Backend.sln | 92 +- .../Administration.Service.csproj | 2 + .../BusinessLogic/CompanyDataBusinessLogic.cs | 14 +- .../BusinessLogic/ConnectorsBusinessLogic.cs | 10 +- .../BusinessLogic/DocumentsBusinessLogic.cs | 2 +- .../IdentityProviderBusinessLogic.cs | 2 +- .../BusinessLogic/InvitationBusinessLogic.cs | 26 +- .../BusinessLogic/MailBusinessLogic.cs | 5 +- .../BusinessLogic/NetworkBusinessLogic.cs | 6 +- .../RegistrationBusinessLogic.cs | 15 +- .../RegistrationStatusBusinessLogic.cs | 2 +- .../ServiceAccountBusinessLogic.cs | 12 +- .../BusinessLogic/ServiceAccountManagement.cs | 10 +- .../SubscriptionConfigurationBusinessLogic.cs | 2 +- .../BusinessLogic/UserBusinessLogic.cs | 2 +- .../BusinessLogic/UserRolesBusinessLogic.cs | 2 +- .../BusinessLogic/UserUploadBusinessLogic.cs | 2 +- .../Controllers/ConnectorsController.cs | 1 - .../Bpdm.Library/Bpdm.Library.csproj | 1 + .../BusinessLogic/BpdmBusinessLogic.cs | 1 + .../BpnDidResolver.Library.csproj | 1 + .../BpnDidResolverBusinessLogic.cs | 1 + .../ClearinghouseBusinessLogic.cs | 1 + .../Clearinghouse.Library.csproj | 1 + .../BusinessLogic/CustodianBusinessLogic.cs | 1 + .../Custodian.Library.csproj | 1 + .../BusinessLogic/DimBusinessLogic.cs | 1 + .../Dim.Library/Dim.Library.csproj | 1 + .../IssuerComponentBusinessLogic.cs | 1 + .../IssuerComponent.Library.csproj | 1 + .../IOfferProviderBusinessLogic.cs | 1 + .../OfferProviderBusinessLogic.cs | 1 + .../OfferProvider.Library.csproj | 1 + ...IOnboardingServiceProviderBusinessLogic.cs | 1 + .../OnboardingServiceProvider.Library.csproj | 1 + .../OnboardingServiceProviderBusinessLogic.cs | 1 + .../BusinessLogic/SdFactoryBusinessLogic.cs | 1 + .../SdFactory.Library.csproj | 1 + .../Framework.Async/Directory.Build.props | 2 +- .../Framework.Cors/Directory.Build.props | 2 +- .../Framework.DBAccess/Directory.Build.props | 2 +- .../Framework.DBAccess}/IBaseEntity.cs | 2 +- .../Directory.Build.props | 2 +- .../Directory.Build.props | 2 +- .../Directory.Build.props | 2 +- .../Directory.Build.props | 2 +- .../Directory.Build.props | 2 +- .../Directory.Build.props | 2 +- .../Framework.IO/Directory.Build.props | 2 +- .../Framework.Identity.csproj | 63 + .../Framework.Identity}/IIdentityData.cs | 4 +- .../Framework.Identity}/IIdentityService.cs | 2 +- .../Framework.Identity}/IdentityTypeId.cs | 3 +- src/framework/Framework.Identity/README.md | 21 + .../Framework.Linq/Directory.Build.props | 2 +- .../Framework.Logging/Directory.Build.props | 2 +- .../Framework.Models/Directory.Build.props | 2 +- .../Context/IProcessRepositories.cs | 55 + .../Context/IProcessStepRepository.cs | 42 + .../Context/ProcessDbContext.cs | 64 + .../Context/ProcessRepositories.cs | 89 + .../Context/ProcessStepRepository.cs | 113 + .../Directory.Build.props} | 22 +- .../Entities/Process.cs | 51 + .../Entities/ProcessStep.cs | 51 + .../Entities/ProcessStepStatus.cs | 12 +- .../Enums/ProcessStepStatusId.cs | 3 +- .../Extensions/RetriggerExtensions.cs | 48 + .../Framework.Processes.Library.csproj | 73 + .../ManualProcessStepData.cs | 32 + .../ManualProcessStepDataExtensions.cs | 72 +- .../Models/VerifyProcessData.cs} | 19 +- .../Framework.Processes.Library/README.md | 22 + .../Directory.Build.props | 25 + .../Extensions/ProcessIdentitySettings.cs} | 15 +- ...Framework.Processes.ProcessIdentity.csproj | 69 + .../IProcessIdentityDataBuilder.cs | 5 +- .../IProcessIdentityDataDetermination.cs | 2 +- .../README.md | 22 + .../Directory.Build.props | 25 + .../Framework.Processes.Worker.Library.csproj | 79 + .../IProcessExecutor.cs | 15 +- .../IProcessTypeExecutor.cs | 26 +- .../ProcessExecutionService.cs | 38 +- .../ProcessExecutionServiceExtensions.cs | 18 +- .../ProcessExecutionServiceSettings.cs | 2 +- .../ProcessExecutor.cs | 84 +- .../README.md | 22 + .../Framework.Seeding/Directory.Build.props | 2 +- .../Framework.Swagger/Directory.Build.props | 2 +- .../Framework.Token/Directory.Build.props | 2 +- .../Framework.Web/Directory.Build.props | 2 +- .../Maintenance.App/Maintenance.App.csproj | 1 + .../Services/MaintenanceService.cs | 2 +- .../Apps.Service/Apps.Service.csproj | 1 + .../BusinessLogic/AppChangeBusinessLogic.cs | 2 +- .../BusinessLogic/AppReleaseBusinessLogic.cs | 2 +- .../BusinessLogic/AppsBusinessLogic.cs | 2 +- .../OfferDocumentService.cs | 2 +- .../Offers.Library.Web.csproj | 1 + .../Extensions/ProcessStepExtensions.cs | 3 +- .../Offers.Library/Offers.Library.csproj | 2 + .../Service/IOfferSetupService.cs | 1 + .../Offers.Library/Service/OfferService.cs | 2 +- .../Service/OfferSetupService.cs | 3 +- .../Service/OfferSubscriptionService.cs | 6 +- .../BusinessLogic/ServiceBusinessLogic.cs | 2 +- .../ServiceReleaseBusinessLogic.cs | 2 +- .../Services.Service/Services.Service.csproj | 1 + .../NotificationBusinessLogic.cs | 2 +- .../Notifications.Service.csproj | 1 + .../IPortalRepositories.cs | 35 +- .../Models/CompanySubscriptionStatusData.cs | 1 + .../Models/OfferSubscriptionDetailData.cs | 1 + .../Models/ProcessStepData.cs | 1 + .../Models/VerifyChecklistData.cs | 6 +- .../PortalBackend.DBAccess.csproj | 2 + .../PortalRepositories.cs | 63 +- .../ApplicationChecklistRepository.cs | 13 +- .../Repositories/ApplicationRepository.cs | 2 + .../Repositories/CompanyRepository.cs | 1 + .../Repositories/ConnectorsRepository.cs | 1 + .../Repositories/IIdentityRepository.cs | 2 +- .../Repositories/INetworkRepository.cs | 5 +- .../IOfferSubscriptionsRepository.cs | 3 +- .../Repositories/IProcessStepRepository.cs | 42 - .../Repositories/IServiceAccountRepository.cs | 3 + .../Repositories/IUserRepository.cs | 1 + .../Repositories/IdentityRepository.cs | 1 + .../Repositories/NetworkRepository.cs | 16 +- .../OfferSubscriptionsRepository.cs | 7 +- .../Repositories/ProcessStepRepository.cs | 141 - .../Repositories/ServiceAccountRepository.cs | 34 + .../Repositories/UserRepository.cs | 1 + .../Repositories/UserRolesRepository.cs | 1 + ...913115133_CreateProcessPackage.Designer.cs | 9754 +++++++++++++++++ .../20240913115133_CreateProcessPackage.cs | 158 + .../PortalDbContextModelSnapshot.cs | 407 +- .../PortalBackend.Migrations.csproj | 1 + .../Seeder/BatchInsertSeeder.cs | 8 +- .../AuditEntities/AuditIdentity20230526.cs | 1 + .../AuditEntities/AuditIdentity20231115.cs | 1 + .../Auditing/AuditExtensions.cs | 2 +- .../Auditing/AuditHandlerV1.cs | 2 +- .../Entities/Address.cs | 2 +- .../Entities/Agreement.cs | 2 +- .../Entities/AppInstance.cs | 2 +- .../Entities/AppInstanceSetup.cs | 2 +- .../Entities/AppSubscriptionDetail.cs | 3 +- .../Entities/Company.cs | 5 +- .../Entities/CompanyApplication.cs | 5 +- .../Entities/CompanyCertificate.cs | 2 +- .../Entities/CompanyInvitation.cs | 6 +- .../Entities/CompanyServiceAccount.cs | 1 - .../Entities/CompanyUser.cs | 2 +- .../Entities/CompanyUserAssignedProcess.cs | 5 +- .../Entities/CompanyWalletData.cs | 2 +- .../Entities/Connector.cs | 5 +- .../Entities/Consent.cs | 2 +- .../Entities/DimCompanyServiceAccount.cs | 2 +- .../Entities/DimUserCreationData.cs | 5 +- .../Entities/Document.cs | 2 +- .../Entities/IamClient.cs | 2 +- .../Entities/Identity.cs | 3 +- .../Entities/IdentityProvider.cs | 2 +- .../IdentityProviderAssignedProcess.cs | 5 +- .../Entities/IdentityType.cs | 2 +- .../Entities/Invitation.cs | 2 +- .../Entities/MailingInformation.cs | 5 +- .../Entities/NetworkRegistration.cs | 6 +- .../Entities/Notification.cs | 2 +- .../Entities/Offer.cs | 2 +- .../Entities/OfferLicense.cs | 2 +- .../Entities/OfferSubscription.cs | 5 +- .../Entities/OfferSubscriptionProcessData.cs | 2 +- .../OnboardingServiceProviderDetail.cs | 2 +- .../Entities/Process.cs | 63 - .../Entities/ProcessStep.cs | 57 - .../Entities/ProcessStepType.cs | 5 +- .../Entities/ProcessType.cs | 5 +- .../Entities/ProviderCompanyDetail.cs | 2 +- .../Entities/TechnicalUserProfile.cs | 2 +- .../Entities/UseCase.cs | 2 +- .../Entities/UserRole.cs | 2 +- .../Entities/UserRoleCollection.cs | 2 +- .../Extensions/ProcessTypeExtensions.cs | 2 +- .../PortalBackend.PortalEntities.csproj | 2 + .../PortalDbContext.cs | 44 +- .../ApplicationChecklist.Executor.csproj | 3 +- ...ApplicationChecklistProcessTypeExecutor.cs | 15 +- .../ApplicationChecklist.Library.csproj | 1 + .../ApplicationChecklistService.cs | 6 +- .../IApplicationChecklistService.cs | 8 +- ...erifyApplicationChecklistDataExtensions.cs | 7 +- .../DimUserProcessCollectionExtensions.cs | 5 +- .../DimUserProcess.Executor.csproj | 3 +- .../DimUserProcessService.cs | 2 +- .../DimUserProcessTypeExecutor.cs | 13 +- .../IDimUserProcessService.cs | 1 + ...entityProviderProvisioning.Executor.csproj | 4 +- ...ProviderProvisioningProcessTypeExecutor.cs | 13 +- .../InvitationProcessCollectionExtensions.cs | 5 +- .../IInvitationProcessService.cs | 1 + .../Invitation.Executor.csproj | 2 +- .../InvitationProcessService.cs | 1 + .../InvitationProcessTypeExecutor.cs | 13 +- .../MailingProcessCollectionExtensions.cs | 5 +- .../Mailing.Executor/Mailing.Executor.csproj | 2 +- .../MailingProcessTypeExecutor.cs | 13 +- .../Mailing.Library/Mailing.Library.csproj | 1 + .../Mailing.Library/MailingProcessCreation.cs | 6 +- ...RegistrationProcessCollectionExtensions.cs | 5 +- .../NetworkRegistration.Executor.csproj | 2 +- .../NetworkRegistrationProcessTypeExecutor.cs | 13 +- .../INetworkRegistrationHandler.cs | 1 + .../NetworkRegistration.Library.csproj | 4 +- .../NetworkRegistrationHandler.cs | 1 + .../NetworkRegistrationProcessHelper.cs | 19 +- ...SubscriptionProcessCollectionExtensions.cs | 5 +- .../OfferSubscription.Executor.csproj | 4 +- .../OfferSubscriptionProcessTypeExecutor.cs | 13 +- .../IOfferSubscriptionProcessService.cs | 6 +- .../OfferSubscription.Library.csproj | 8 +- .../OfferSubscriptionProcessService.cs | 19 +- ...cessIdentityServiceCollectionExtensions.cs | 3 +- .../ProcessIdentityDataBuilder.cs | 3 +- .../ProcessIdentityDataDetermination.cs | 4 +- .../ProcessIdentityService.cs | 3 +- .../Processes.ProcessIdentity.csproj | 2 + .../Processes.Worker.Library.csproj | 40 - .../Processes.Worker/Processes.Worker.csproj | 3 +- src/processes/Processes.Worker/Program.cs | 13 +- .../SdCreationProcessExtensions.cs | 5 +- ...fDescriptionProcessCollectionExtensions.cs | 5 +- .../SdCreationProcessTypeExecutor.cs | 13 +- .../SelfDescriptionCreation.Executor.csproj | 4 +- .../UserProvisioning.Executor.csproj | 5 +- .../UserProvisioningProcessTypeExecutor.cs | 13 +- .../Provisioning.Library.csproj | 2 + .../Service/ServiceAccountCreation.cs | 5 +- .../Service/UserProvisioningService.cs | 1 + .../ApplicationActivation.Library.csproj | 1 + .../ApplicationActivationService.cs | 4 +- .../BusinessLogic/NetworkBusinessLogic.cs | 10 +- .../RegistrationBusinessLogic.cs | 12 +- .../Registration.Service.csproj | 3 +- .../Web.Identity/ClaimsIdentityDataBuilder.cs | 2 +- src/web/Web.Identity/ClaimsIdentityService.cs | 2 +- ...aimsIdentityServiceCollectionExtensions.cs | 2 +- .../IClaimsIdentityDataBuilder.cs | 3 +- .../MandatoryIdentityClaimHandler.cs | 11 +- src/web/Web.Identity/Web.Identity.csproj | 1 + .../PublicInformationBusinessLogic.cs | 2 +- .../Web.PublicInfos/Web.PublicInfos.csproj | 1 + .../Administration.Service.Tests.csproj | 2 + .../CompanyDataBusinessLogicTests.cs | 31 +- .../ConnectorsBusinessLogicTests.cs | 32 +- .../DocumentsBusinessLogicTests.cs | 2 +- .../IdentityProviderBusinessLogicTests.cs | 2 +- .../InvitationBusinessLogicTests.cs | 130 +- .../BusinessLogic/MailBusinessLogicTests.cs | 2 +- .../NetworkBusinessLogicTests.cs | 33 +- .../RegistrationBusinessLogicTest.cs | 83 +- .../RegistrationStatusBusinessLogicTest.cs | 2 +- .../ServiceAccountBusinessLogicTests.cs | 41 +- .../ServiceAccountManagementTests.cs | 23 +- ...criptionConfigurationBusinessLogicTests.cs | 30 +- .../BusinessLogic/UserBusinessLogicTests.cs | 2 +- .../UserUploadBusinessLogicTests.cs | 3 +- .../Controllers/CompanyDataControllerTests.cs | 2 +- .../Controllers/ConnectorsControllerTests.cs | 3 +- .../Controllers/DocumentsControllerTests.cs | 3 +- .../Controllers/MailControllerTest.cs | 3 +- .../Controllers/RegistrationControllerTest.cs | 2 +- .../ServiceAccountControllerTests.cs | 2 +- ...ubscriptionConfigurationControllerTests.cs | 3 +- .../Controllers/UserControllerTest.cs | 3 +- .../BpnDidResolverBusinessLogicTests.cs | 1 + .../ClearinghouseBusinessLogicTests.cs | 5 +- .../CustodianBusinessLogicTests.cs | 1 + .../DimBusinessLogicTests.cs | 14 +- .../IssuerComponentBusinessLogicTests.cs | 10 +- .../OfferProviderBusinessLogicTests.cs | 1 + .../OfferProvider.Library.Tests.csproj} | 0 .../OfferProviderServiceTests.cs | 0 .../Usings.cs | 0 ...ardingServiceProviderBusinessLogicTests.cs | 1 + .../SdFactoryBusinessLogicTests.cs | 8 +- .../ValidationExpressionsTests.cs | 2 - .../MaintenanceServiceTests.cs | 2 +- .../Apps.Service.Tests.csproj | 1 + .../BusinessLogic/AppBusinessLogicTests.cs | 2 +- .../AppChangeBusinessLogicTest.cs | 2 +- .../AppReleaseBusinessLogicTest.cs | 2 +- .../Controllers/AppChangeControllerTest.cs | 2 +- .../AppReleaseProcessControllerTest.cs | 2 +- .../Controllers/AppsControllerTests.cs | 2 +- .../Offer.Library.Web.Tests.csproj | 1 + .../OfferDocumentServiceTests.cs | 2 +- .../Offers.Library.Tests.csproj | 2 + .../Service/ExtensionsTest.cs | 1 + .../Service/OfferServiceTests.cs | 2 +- .../Service/OfferSetupServiceTests.cs | 49 +- .../Service/OfferSubscriptionServiceTests.cs | 10 +- .../ServiceBusinessLogicTests.cs | 2 +- .../ServiceReleaseBusinessLogicTest.cs | 2 +- .../ServiceChangeControllerTest.cs | 3 +- .../Controllers/ServiceControllerTest.cs | 2 +- .../ServiceReleaseControllerTest.cs | 2 +- .../Services.Service.Tests.csproj | 1 + .../NotificationBusinessLogicTests.cs | 2 +- .../Controllers/NotificationControllerTest.cs | 2 +- .../Notifications.Service.Tests.csproj | 1 + .../ApplicationChecklistRepositoryTests.cs | 1 + .../LockableProcessEntityTests.cs | 48 +- .../NetworkRepositoryTests.cs | 1 + .../OfferSubscriptionRepositoryTest.cs | 1 + .../PortalBackend.DBAccess.Tests.csproj | 1 + .../ProcessStepRepositoryTests.cs | 41 +- ...cationChecklistProcessTypeExecutorTests.cs | 1 + .../ApplicationChecklistServiceTests.cs | 117 +- .../DimUserProcessServiceTests.cs | 1 + .../DimUserProcessTypeExecutorTests.cs | 1 + ...derProvisioningProcessTypeExecutorTests.cs | 1 + .../InvitationProcessServiceTests.cs | 2 + .../InvitationProcessTypeExecutorTests.cs | 1 + .../MailingProcessTypeExecutorTests.cs | 1 + .../RoleBaseMailServiceTests.cs | 8 +- ...orkRegistrationProcessTypeExecutorTests.cs | 1 + .../NetworkRegistration.Library.Tests.csproj | 2 + .../NetworkRegistrationHandlerTests.cs | 9 +- .../NetworkRegistrationProcessHelperTests.cs | 30 +- ...ferSubscriptionProcessTypeExecutorTests.cs | 1 + .../OfferSubscriptionProcessServiceTests.cs | 114 +- .../ManualProcessDataExtensionsTests.cs | 186 +- .../Processes.Library.Tests.csproj | 1 - .../ProcessExecutionServiceTests.cs | 146 +- .../ProcessExecutorTests.cs | 436 +- .../Processes.Worker.Library.Tests.csproj | 3 +- .../SdCreationProcessTypeExecutorTests.cs | 1 + ...fDescriptionCreation.Executor.Tests.csproj | 2 + ...serProvisioningProcessTypeExecutorTests.cs | 1 + .../Extensions/ServiceAccountCreationTests.cs | 14 +- .../Provisioning.Library.Tests.csproj | 1 + ...UserProvisioningServiceCreateUsersTests.cs | 1 + .../ApplicationActivationTests.cs | 13 +- .../NetworkBusinessLogicTests.cs | 40 +- .../RegistrationBusinessLogicTest.cs | 25 +- .../Controller/RegistrationControllerTest.cs | 2 +- .../Registration.Service.Tests.csproj | 1 + .../Extensions/ControllerExtensions.cs | 2 +- .../Tests.Shared/FakeIdentityService.cs | 3 +- .../IntegrationTestFactory.cs | 2 +- .../shared/Tests.Shared/TestSeeds/BaseSeed.cs | 1 + tests/shared/Tests.Shared/Tests.Shared.csproj | 1 + .../MandatoryIdentityClaimHandlerTests.cs | 2 +- .../Web.Identity.Tests.csproj | 1 + .../PublicInformationBusinessLogicTests.cs | 2 +- .../Web.PublicInfos.Tests.csproj | 1 + 359 files changed, 12802 insertions(+), 2069 deletions(-) rename src/{portalbackend/PortalBackend.PortalEntities/Base => framework/Framework.DBAccess}/IBaseEntity.cs (92%) create mode 100644 src/framework/Framework.Identity/Framework.Identity.csproj rename src/{portalbackend/PortalBackend.PortalEntities/Identities => framework/Framework.Identity}/IIdentityData.cs (86%) rename src/{portalbackend/PortalBackend.PortalEntities/Identities => framework/Framework.Identity}/IIdentityService.cs (91%) rename src/{portalbackend/PortalBackend.PortalEntities/Enums => framework/Framework.Identity}/IdentityTypeId.cs (89%) create mode 100644 src/framework/Framework.Identity/README.md create mode 100644 src/framework/Framework.Processes.Library/Context/IProcessRepositories.cs create mode 100644 src/framework/Framework.Processes.Library/Context/IProcessStepRepository.cs create mode 100644 src/framework/Framework.Processes.Library/Context/ProcessDbContext.cs create mode 100644 src/framework/Framework.Processes.Library/Context/ProcessRepositories.cs create mode 100644 src/framework/Framework.Processes.Library/Context/ProcessStepRepository.cs rename src/{processes/Processes.Library/Processes.Library.csproj => framework/Framework.Processes.Library/Directory.Build.props} (50%) create mode 100644 src/framework/Framework.Processes.Library/Entities/Process.cs create mode 100644 src/framework/Framework.Processes.Library/Entities/ProcessStep.cs rename src/{portalbackend/PortalBackend.PortalEntities => framework/Framework.Processes.Library}/Entities/ProcessStepStatus.cs (71%) rename src/{portalbackend/PortalBackend.PortalEntities => framework/Framework.Processes.Library}/Enums/ProcessStepStatusId.cs (89%) create mode 100644 src/framework/Framework.Processes.Library/Extensions/RetriggerExtensions.cs create mode 100644 src/framework/Framework.Processes.Library/Framework.Processes.Library.csproj create mode 100644 src/framework/Framework.Processes.Library/ManualProcessStepData.cs rename src/{processes/Processes.Library => framework/Framework.Processes.Library}/ManualProcessStepDataExtensions.cs (53%) rename src/{processes/Processes.Library/ManualProcessStepData.cs => framework/Framework.Processes.Library/Models/VerifyProcessData.cs} (63%) create mode 100644 src/framework/Framework.Processes.Library/README.md create mode 100644 src/framework/Framework.Processes.ProcessIdentity/Directory.Build.props rename src/{portalbackend/PortalBackend.DBAccess/Models/VerifyProcessData.cs => framework/Framework.Processes.ProcessIdentity/Extensions/ProcessIdentitySettings.cs} (72%) create mode 100644 src/framework/Framework.Processes.ProcessIdentity/Framework.Processes.ProcessIdentity.csproj rename src/{processes/Processes.ProcessIdentity => framework/Framework.Processes.ProcessIdentity}/IProcessIdentityDataBuilder.cs (81%) rename src/{processes/Processes.ProcessIdentity => framework/Framework.Processes.ProcessIdentity}/IProcessIdentityDataDetermination.cs (92%) create mode 100644 src/framework/Framework.Processes.ProcessIdentity/README.md create mode 100644 src/framework/Framework.Processes.Worker.Library/Directory.Build.props create mode 100644 src/framework/Framework.Processes.Worker.Library/Framework.Processes.Worker.Library.csproj rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/IProcessExecutor.cs (71%) rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/IProcessTypeExecutor.cs (53%) rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/ProcessExecutionService.cs (79%) rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/ProcessExecutionServiceExtensions.cs (55%) rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/ProcessExecutionServiceSettings.cs (93%) rename src/{processes/Processes.Worker.Library => framework/Framework.Processes.Worker.Library}/ProcessExecutor.cs (62%) create mode 100644 src/framework/Framework.Processes.Worker.Library/README.md delete mode 100644 src/portalbackend/PortalBackend.DBAccess/Repositories/IProcessStepRepository.cs delete mode 100644 src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.Designer.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.cs delete mode 100644 src/portalbackend/PortalBackend.PortalEntities/Entities/Process.cs delete mode 100644 src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStep.cs delete mode 100644 src/processes/Processes.Worker.Library/Processes.Worker.Library.csproj rename tests/externalsystems/{OfferProvider.Library => OfferProvider.Library.Tests}/BusinessLogic/OfferProviderBusinessLogicTests.cs (99%) rename tests/externalsystems/{OfferProvider.Library/OfferProvider.Library.csproj => OfferProvider.Library.Tests/OfferProvider.Library.Tests.csproj} (100%) rename tests/externalsystems/{OfferProvider.Library => OfferProvider.Library.Tests}/OfferProviderServiceTests.cs (100%) rename tests/externalsystems/{OfferProvider.Library => OfferProvider.Library.Tests}/Usings.cs (100%) diff --git a/src/Portal.Backend.sln b/src/Portal.Backend.sln index 45967dba53..c805437675 100644 --- a/src/Portal.Backend.sln +++ b/src/Portal.Backend.sln @@ -122,8 +122,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationActivation.Libra EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationChecklist.Config", "processes\ApplicationChecklist.Config\ApplicationChecklist.Config.csproj", "{C3E5E7C8-69D3-4ECB-A4FA-53A9A780EFF0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Processes.Worker.Library", "processes\Processes.Worker.Library\Processes.Worker.Library.csproj", "{527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationChecklist.Executor", "processes\ApplicationChecklist.Executor\ApplicationChecklist.Executor.csproj", "{0221E83B-B26B-442F-ACAD-B1043DF9993A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Processes.Worker.Library.Tests", "..\tests\processes\Processes.Worker.Library.Tests\Processes.Worker.Library.Tests.csproj", "{B787DF92-23F7-410A-B592-95701E4B423D}" @@ -140,9 +138,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfferSubscription.Executor. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfferSubscription.Library.Tests", "..\tests\processes\OfferSubscription.Library.Tests\OfferSubscription.Library.Tests.csproj", "{C356AA93-5BEE-44CD-A905-EFD325ED7578}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfferProvider.Library", "..\tests\externalsystems\OfferProvider.Library\OfferProvider.Library.csproj", "{CC063A63-8282-4293-9A0E-2598ADCA747B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Processes.Library", "processes\Processes.Library\Processes.Library.csproj", "{58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfferProvider.Library.Tests", "..\tests\externalsystems\OfferProvider.Library.Tests\OfferProvider.Library.Tests.csproj", "{CC063A63-8282-4293-9A0E-2598ADCA747B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Processes.Library.Tests", "..\tests\processes\Processes.Library.Tests\Processes.Library.Tests.csproj", "{5E80DEEA-B254-425C-8220-27EEF47C10BD}" EndProject @@ -286,6 +282,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Exe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Executor.Tests", "..\tests\processes\SelfDescriptionCreation.Executor.Tests\SelfDescriptionCreation.Executor.Tests.csproj", "{AA14B842-6A65-40BB-818A-D450F66F4101}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Processes.Worker.Library", "framework\Framework.Processes.Worker.Library\Framework.Processes.Worker.Library.csproj", "{DE38F44A-8B1F-4C41-81A0-350CF767F7B2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Processes.Library", "framework\Framework.Processes.Library\Framework.Processes.Library.csproj", "{A6A4C3C9-4962-4EEA-96CC-687650680504}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Processes.ProcessIdentity", "framework\Framework.Processes.ProcessIdentity\Framework.Processes.ProcessIdentity.csproj", "{346AA429-2AE0-4171-9F41-D3F31D823D19}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Identity", "framework\Framework.Identity\Framework.Identity.csproj", "{A0B339C0-5BCD-40C1-8FF6-421F41321F74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -872,18 +876,6 @@ Global {C3E5E7C8-69D3-4ECB-A4FA-53A9A780EFF0}.Release|x64.Build.0 = Release|Any CPU {C3E5E7C8-69D3-4ECB-A4FA-53A9A780EFF0}.Release|x86.ActiveCfg = Release|Any CPU {C3E5E7C8-69D3-4ECB-A4FA-53A9A780EFF0}.Release|x86.Build.0 = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|x64.ActiveCfg = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|x64.Build.0 = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|x86.ActiveCfg = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Debug|x86.Build.0 = Debug|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|Any CPU.Build.0 = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|x64.ActiveCfg = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|x64.Build.0 = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|x86.ActiveCfg = Release|Any CPU - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E}.Release|x86.Build.0 = Release|Any CPU {0221E83B-B26B-442F-ACAD-B1043DF9993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0221E83B-B26B-442F-ACAD-B1043DF9993A}.Debug|Any CPU.Build.0 = Debug|Any CPU {0221E83B-B26B-442F-ACAD-B1043DF9993A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -992,18 +984,6 @@ Global {CC063A63-8282-4293-9A0E-2598ADCA747B}.Release|x64.Build.0 = Release|Any CPU {CC063A63-8282-4293-9A0E-2598ADCA747B}.Release|x86.ActiveCfg = Release|Any CPU {CC063A63-8282-4293-9A0E-2598ADCA747B}.Release|x86.Build.0 = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|x64.ActiveCfg = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|x64.Build.0 = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|x86.ActiveCfg = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Debug|x86.Build.0 = Debug|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|Any CPU.Build.0 = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|x64.ActiveCfg = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|x64.Build.0 = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|x86.ActiveCfg = Release|Any CPU - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1}.Release|x86.Build.0 = Release|Any CPU {5E80DEEA-B254-425C-8220-27EEF47C10BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E80DEEA-B254-425C-8220-27EEF47C10BD}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E80DEEA-B254-425C-8220-27EEF47C10BD}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1822,6 +1802,54 @@ Global {AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x64.Build.0 = Release|Any CPU {AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x86.ActiveCfg = Release|Any CPU {AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x86.Build.0 = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|x64.ActiveCfg = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|x64.Build.0 = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|x86.ActiveCfg = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Debug|x86.Build.0 = Debug|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|Any CPU.Build.0 = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|x64.ActiveCfg = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|x64.Build.0 = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|x86.ActiveCfg = Release|Any CPU + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2}.Release|x86.Build.0 = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|x64.ActiveCfg = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|x64.Build.0 = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|x86.ActiveCfg = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Debug|x86.Build.0 = Debug|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|Any CPU.Build.0 = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|x64.ActiveCfg = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|x64.Build.0 = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|x86.ActiveCfg = Release|Any CPU + {A6A4C3C9-4962-4EEA-96CC-687650680504}.Release|x86.Build.0 = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|x64.ActiveCfg = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|x64.Build.0 = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|x86.ActiveCfg = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Debug|x86.Build.0 = Debug|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|Any CPU.Build.0 = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|x64.ActiveCfg = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|x64.Build.0 = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|x86.ActiveCfg = Release|Any CPU + {346AA429-2AE0-4171-9F41-D3F31D823D19}.Release|x86.Build.0 = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|x64.ActiveCfg = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|x64.Build.0 = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|x86.ActiveCfg = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Debug|x86.Build.0 = Debug|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|Any CPU.Build.0 = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|x64.ActiveCfg = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|x64.Build.0 = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|x86.ActiveCfg = Release|Any CPU + {A0B339C0-5BCD-40C1-8FF6-421F41321F74}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1884,7 +1912,6 @@ Global {0BFA8C5B-3F15-4381-9621-AD7A3EC0315F} = {AB9C5AA2-DD5D-4A38-97C0-674A995C0AE0} {96D96CA7-35C0-40C6-A8C8-91E0C4456660} = {323C198D-A8C6-4EB0-8B79-72624275E35F} {C3E5E7C8-69D3-4ECB-A4FA-53A9A780EFF0} = {282CEF03-292F-4A49-83C6-997567D0FF5F} - {527A4A82-D63A-4DD5-B37D-0AC8A79F1B0E} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {0221E83B-B26B-442F-ACAD-B1043DF9993A} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {4C7E9EAC-222B-4C13-B8B1-5987406817A0} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {7985B208-CE41-49DA-B749-B94B582612E6} = {323C198D-A8C6-4EB0-8B79-72624275E35F} @@ -1893,7 +1920,6 @@ Global {B682C5B9-AFAB-474D-95AD-B86099FC5EC7} = {323C198D-A8C6-4EB0-8B79-72624275E35F} {C356AA93-5BEE-44CD-A905-EFD325ED7578} = {323C198D-A8C6-4EB0-8B79-72624275E35F} {CC063A63-8282-4293-9A0E-2598ADCA747B} = {323C198D-A8C6-4EB0-8B79-72624275E35F} - {58D5C0B4-3C5C-4BE4-82EA-4CB9940943B1} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {EC493B36-9E14-4CAF-973F-FB96FDAF546F} = {A878BDF1-6DB6-4BA5-A724-92885A710856} {1694E75F-ABCE-4573-B805-18ED50F148FD} = {323C198D-A8C6-4EB0-8B79-72624275E35F} {E1D41A07-F468-4D13-8185-35F127230B17} = {46383371-8252-4598-9350-A97692851408} @@ -1958,5 +1984,9 @@ Global {E5494227-BDFE-41F2-A12F-54292D76C29F} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {D8EBE555-F103-4D05-9697-5381E4DE1DFE} = {282CEF03-292F-4A49-83C6-997567D0FF5F} {AA14B842-6A65-40BB-818A-D450F66F4101} = {323C198D-A8C6-4EB0-8B79-72624275E35F} + {DE38F44A-8B1F-4C41-81A0-350CF767F7B2} = {B42CFF96-B8DB-48A6-A9CA-72BFB5F0117B} + {A6A4C3C9-4962-4EEA-96CC-687650680504} = {B42CFF96-B8DB-48A6-A9CA-72BFB5F0117B} + {346AA429-2AE0-4171-9F41-D3F31D823D19} = {B42CFF96-B8DB-48A6-A9CA-72BFB5F0117B} + {A0B339C0-5BCD-40C1-8FF6-421F41321F74} = {B42CFF96-B8DB-48A6-A9CA-72BFB5F0117B} EndGlobalSection EndGlobal diff --git a/src/administration/Administration.Service/Administration.Service.csproj b/src/administration/Administration.Service/Administration.Service.csproj index 0a8248acb7..d1cfbb4e13 100644 --- a/src/administration/Administration.Service/Administration.Service.csproj +++ b/src/administration/Administration.Service/Administration.Service.csproj @@ -52,8 +52,10 @@ + + diff --git a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs index d71544ed11..ed4be03605 100644 --- a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs @@ -22,8 +22,12 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; @@ -31,12 +35,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; -using System.Collections.Immutable; -using System.Globalization; -using System.Text.Json; using System.Text.RegularExpressions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; @@ -448,7 +446,7 @@ public async Task DeleteCompanyCertificateAsync(Guid documentId) public async Task TriggerSelfDescriptionCreation() { var companiesWithMissingSd = portalRepositories.GetInstance().GetCompanyIdsWithMissingSelfDescription(); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); var companyRepository = portalRepositories.GetInstance(); await foreach (var companyId in companiesWithMissingSd) { @@ -464,7 +462,7 @@ public async Task RetriggerSelfDescriptionCreation(Guid processId) { const ProcessStepTypeId NextStep = ProcessStepTypeId.SELF_DESCRIPTION_COMPANY_CREATION; const ProcessStepTypeId StepToTrigger = ProcessStepTypeId.RETRIGGER_SELF_DESCRIPTION_COMPANY_CREATION; - var (validProcessId, processData) = await portalRepositories.GetInstance().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); + var (validProcessId, processData) = await portalRepositories.GetInstance>().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); if (!validProcessId) { throw new NotFoundException($"process {processId} does not exist"); diff --git a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs index c891a72ec7..f367975124 100644 --- a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs @@ -22,15 +22,17 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using System.Text.RegularExpressions; @@ -451,7 +453,7 @@ public IAsyncEnumerable GetConnectorOfferSubscri public async Task TriggerSelfDescriptionCreation() { var connectorRepository = portalRepositories.GetInstance(); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); var connectorIds = connectorRepository.GetConnectorIdsWithMissingSelfDescription(); await foreach (var connectorId in connectorIds) { @@ -467,7 +469,7 @@ public async Task RetriggerSelfDescriptionCreation(Guid processId) { const ProcessStepTypeId NextStep = ProcessStepTypeId.SELF_DESCRIPTION_CONNECTOR_CREATION; const ProcessStepTypeId StepToTrigger = ProcessStepTypeId.RETRIGGER_SELF_DESCRIPTION_CONNECTOR_CREATION; - var (validProcessId, processData) = await portalRepositories.GetInstance().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); + var (validProcessId, processData) = await portalRepositories.GetInstance>().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); if (!validProcessId) { throw new NotFoundException($"process {processId} does not exist"); diff --git a/src/administration/Administration.Service/BusinessLogic/DocumentsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/DocumentsBusinessLogic.cs index 4ad378747f..8f637ba8eb 100644 --- a/src/administration/Administration.Service/BusinessLogic/DocumentsBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/DocumentsBusinessLogic.cs @@ -19,13 +19,13 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; diff --git a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs index 18a9f38bcf..44837b3c92 100644 --- a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs @@ -21,6 +21,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; @@ -29,7 +30,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; diff --git a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs index 73ba7a336c..ae98ece62e 100644 --- a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs @@ -20,11 +20,13 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Extensions; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; @@ -60,7 +62,7 @@ public Task ExecuteInvitation(CompanyInvitationData i private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitationData) { var (userName, firstName, lastName, email, organisationName) = invitationData; - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); var processId = processStepRepository.CreateProcess(ProcessTypeId.INVITATION).Id; processStepRepository.CreateProcessStep(ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP, ProcessStepStatusId.TODO, processId); @@ -80,16 +82,16 @@ private async Task ExecuteInvitationInternalAsync(Com return new CompanyInvitationResponse(applicationId, company.Id); } - public Task RetriggerCreateCentralIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerCreateSharedIdpServiceAccount(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerAddRealmRole(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_ADD_REALM_ROLE.TriggerProcessStep(processId, _portalRepositories); + public Task RetriggerCreateCentralIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerCreateSharedIdpServiceAccount(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerAddRealmRole(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_ADD_REALM_ROLE.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); - public Task RetriggerInviteSharedClient(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_CLIENT.TriggerProcessStep(processId, _portalRepositories); + public Task RetriggerInviteSharedClient(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_CLIENT.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); - public Task RetriggerUpdateCentralIdpUrls(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_UPDATE_CENTRAL_IDP_URLS.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerCreateCentralIdpOrgMapper(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerCreateSharedRealmIdpClient(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_REALM.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerEnableCentralIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_ENABLE_CENTRAL_IDP.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerCreateDatabaseIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_DATABASE_IDP.TriggerProcessStep(processId, _portalRepositories); - public Task RetriggerInvitationCreateUser(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_USER.TriggerProcessStep(processId, _portalRepositories); + public Task RetriggerUpdateCentralIdpUrls(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_UPDATE_CENTRAL_IDP_URLS.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerCreateCentralIdpOrgMapper(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerCreateSharedRealmIdpClient(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_REALM.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerEnableCentralIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_ENABLE_CENTRAL_IDP.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerCreateDatabaseIdp(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_DATABASE_IDP.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerInvitationCreateUser(Guid processId) => ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_USER.TriggerProcessStep(processId, _portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); } diff --git a/src/administration/Administration.Service/BusinessLogic/MailBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/MailBusinessLogic.cs index 90716b8707..0196111823 100644 --- a/src/administration/Administration.Service/BusinessLogic/MailBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/MailBusinessLogic.cs @@ -20,10 +20,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using System.Collections.Immutable; @@ -61,5 +62,5 @@ public async Task SendMail(MailData mailData) } } - public Task RetriggerSendMail(Guid processId) => ProcessStepTypeId.RETRIGGER_SEND_MAIL.TriggerProcessStep(processId, portalRepositories); + public Task RetriggerSendMail(Guid processId) => ProcessStepTypeId.RETRIGGER_SEND_MAIL.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); } diff --git a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs index 2ba3be6374..2f029ac49c 100644 --- a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs @@ -21,13 +21,15 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; @@ -60,7 +62,7 @@ public async Task HandlePartnerRegistration(PartnerRegistrationData data) var ownerCompanyId = _identityData.CompanyId; var networkRepository = portalRepositories.GetInstance(); var companyRepository = portalRepositories.GetInstance(); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); var identityProviderRepository = portalRepositories.GetInstance(); var (roleData, identityProviderIdAliase, singleIdentityProviderIdAlias, allIdentityProviderIds) = await ValidatePartnerRegistrationData(data, networkRepository, identityProviderRepository, ownerCompanyId).ConfigureAwait(ConfigureAwaitOptions.None); diff --git a/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs index 3db4a91b2d..1d9fa647af 100644 --- a/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs @@ -27,7 +27,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; @@ -36,9 +40,8 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Registration.Common; @@ -654,8 +657,8 @@ private async Task GetApplicationIdByBpn(IssuerResponseData data, Cancella return result.Single(); } - public Task RetriggerDeleteIdpSharedRealm(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM.TriggerProcessStep(processId, portalRepositories); - public Task RetriggerDeleteIdpSharedServiceAccount(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT.TriggerProcessStep(processId, portalRepositories); - public Task RetriggerDeleteCentralIdentityProvider(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER.TriggerProcessStep(processId, portalRepositories); - public Task RetriggerDeleteCentralUser(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER.TriggerProcessStep(processId, portalRepositories); + public Task RetriggerDeleteIdpSharedRealm(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerDeleteIdpSharedServiceAccount(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerDeleteCentralIdentityProvider(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); + public Task RetriggerDeleteCentralUser(Guid processId) => ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); } diff --git a/src/administration/Administration.Service/BusinessLogic/RegistrationStatusBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/RegistrationStatusBusinessLogic.cs index 761519570d..cb0a21695e 100644 --- a/src/administration/Administration.Service/BusinessLogic/RegistrationStatusBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/RegistrationStatusBusinessLogic.cs @@ -19,13 +19,13 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; diff --git a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs index c25ebd9cfe..f4a98dda0d 100644 --- a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs @@ -22,15 +22,17 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; @@ -344,7 +346,7 @@ public async IAsyncEnumerable GetServiceAccountRolesAsy public async Task HandleServiceAccountCreationCallback(Guid processId, AuthenticationDetail callbackData) { - var processData = await portalRepositories.GetInstance().GetProcessDataForServiceAccountCallback(processId, [ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE]) + var processData = await portalRepositories.GetInstance().GetProcessDataForServiceAccountCallback(processId, [ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE]) .ConfigureAwait(ConfigureAwaitOptions.None); var context = processData.ProcessData.CreateManualProcessData(ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE, portalRepositories, () => $"externalId {processId}"); @@ -387,7 +389,7 @@ private void CreateDimServiceAccount(AuthenticationDetail callbackData, Guid ser public async Task HandleServiceAccountDeletionCallback(Guid processId) { - var processData = await portalRepositories.GetInstance() + var processData = await portalRepositories.GetInstance() .GetProcessDataForServiceAccountDeletionCallback(processId, [ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE]) .ConfigureAwait(ConfigureAwaitOptions.None); @@ -407,5 +409,5 @@ public async Task HandleServiceAccountDeletionCallback(Guid processId) await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); } - public Task RetriggerDimTechnicalUser(Guid processId, ProcessStepTypeId processStepTypeId) => processStepTypeId.TriggerProcessStep(processId, portalRepositories); + public Task RetriggerDimTechnicalUser(Guid processId, ProcessStepTypeId processStepTypeId) => processStepTypeId.TriggerProcessStep(processId, portalRepositories, ProcessTypeExtensions.GetProcessStepForRetrigger); } diff --git a/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs b/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs index b1f018c1af..1f59f2e812 100644 --- a/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs +++ b/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs @@ -18,15 +18,15 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; @@ -72,7 +72,7 @@ private async Task CreateDeletionProcess(Guid serviceAccountId, Gu throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_LINKED_TO_PROCESS, [new ErrorParameter("serviceAccountId", serviceAccountId.ToString())]); } - var processData = await portalRepositories.GetInstance() + var processData = await portalRepositories.GetInstance() .GetProcessDataForServiceAccountDeletionCallback(processId.Value, null) .ConfigureAwait(ConfigureAwaitOptions.None); @@ -80,7 +80,7 @@ private async Task CreateDeletionProcess(Guid serviceAccountId, Gu portalRepositories, () => $"externalId {processId}"); context.ProcessSteps.Where(step => step.ProcessStepTypeId != ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER).IfAny(pending => - throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, [new ErrorParameter("serviceAccountId", serviceAccountId.ToString()), new("processStepTypeIds", string.Join(",", pending))])); + throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, [new ErrorParameter("serviceAccountId", serviceAccountId.ToString()), new("processStepTypeIds", string.Join(",", pending))])); if (context.ProcessSteps.Any(step => step.ProcessStepTypeId == ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER)) return UserStatusId.DELETED; diff --git a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs index 0a6ba9896a..e48c264aa4 100644 --- a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs @@ -18,12 +18,12 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library.Extensions; diff --git a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs index baf79f70eb..f21454cc39 100644 --- a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs @@ -22,13 +22,13 @@ using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; diff --git a/src/administration/Administration.Service/BusinessLogic/UserRolesBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/UserRolesBusinessLogic.cs index ec743cc8b7..bc4153eacf 100644 --- a/src/administration/Administration.Service/BusinessLogic/UserRolesBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/UserRolesBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; @@ -27,7 +28,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using System.Collections.Immutable; using System.Text.Json; diff --git a/src/administration/Administration.Service/BusinessLogic/UserUploadBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/UserUploadBusinessLogic.cs index eb32fdfe2a..8eb6fd47ed 100644 --- a/src/administration/Administration.Service/BusinessLogic/UserUploadBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/UserUploadBusinessLogic.cs @@ -21,11 +21,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; diff --git a/src/administration/Administration.Service/Controllers/ConnectorsController.cs b/src/administration/Administration.Service/Controllers/ConnectorsController.cs index ff8aa8a64a..f3324d2212 100644 --- a/src/administration/Administration.Service/Controllers/ConnectorsController.cs +++ b/src/administration/Administration.Service/Controllers/ConnectorsController.cs @@ -18,7 +18,6 @@ ********************************************************************************/ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; diff --git a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj index b85c3a2e6a..3f78c0180f 100644 --- a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj +++ b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/externalsystems/Bpdm.Library/BusinessLogic/BpdmBusinessLogic.cs b/src/externalsystems/Bpdm.Library/BusinessLogic/BpdmBusinessLogic.cs index c4badb4a39..6107a7313d 100644 --- a/src/externalsystems/Bpdm.Library/BusinessLogic/BpdmBusinessLogic.cs +++ b/src/externalsystems/Bpdm.Library/BusinessLogic/BpdmBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/src/externalsystems/BpnDidResolver.Library/BpnDidResolver.Library.csproj b/src/externalsystems/BpnDidResolver.Library/BpnDidResolver.Library.csproj index cd3b267855..32ccb0044b 100644 --- a/src/externalsystems/BpnDidResolver.Library/BpnDidResolver.Library.csproj +++ b/src/externalsystems/BpnDidResolver.Library/BpnDidResolver.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/externalsystems/BpnDidResolver.Library/BusinessLogic/BpnDidResolverBusinessLogic.cs b/src/externalsystems/BpnDidResolver.Library/BusinessLogic/BpnDidResolverBusinessLogic.cs index 25ca1bb315..98c17a58e4 100644 --- a/src/externalsystems/BpnDidResolver.Library/BusinessLogic/BpnDidResolverBusinessLogic.cs +++ b/src/externalsystems/BpnDidResolver.Library/BusinessLogic/BpnDidResolverBusinessLogic.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/externalsystems/Clearinghouse.Library/BusinessLogic/ClearinghouseBusinessLogic.cs b/src/externalsystems/Clearinghouse.Library/BusinessLogic/ClearinghouseBusinessLogic.cs index ccffde8768..1300dbb781 100644 --- a/src/externalsystems/Clearinghouse.Library/BusinessLogic/ClearinghouseBusinessLogic.cs +++ b/src/externalsystems/Clearinghouse.Library/BusinessLogic/ClearinghouseBusinessLogic.cs @@ -23,6 +23,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/externalsystems/Clearinghouse.Library/Clearinghouse.Library.csproj b/src/externalsystems/Clearinghouse.Library/Clearinghouse.Library.csproj index c29ec0ea95..9542f1dd8d 100644 --- a/src/externalsystems/Clearinghouse.Library/Clearinghouse.Library.csproj +++ b/src/externalsystems/Clearinghouse.Library/Clearinghouse.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/externalsystems/Custodian.Library/BusinessLogic/CustodianBusinessLogic.cs b/src/externalsystems/Custodian.Library/BusinessLogic/CustodianBusinessLogic.cs index 8b034a8eec..b5d69d8d9d 100644 --- a/src/externalsystems/Custodian.Library/BusinessLogic/CustodianBusinessLogic.cs +++ b/src/externalsystems/Custodian.Library/BusinessLogic/CustodianBusinessLogic.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/externalsystems/Custodian.Library/Custodian.Library.csproj b/src/externalsystems/Custodian.Library/Custodian.Library.csproj index e5eb3aae37..e1aa838316 100644 --- a/src/externalsystems/Custodian.Library/Custodian.Library.csproj +++ b/src/externalsystems/Custodian.Library/Custodian.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/externalsystems/Dim.Library/BusinessLogic/DimBusinessLogic.cs b/src/externalsystems/Dim.Library/BusinessLogic/DimBusinessLogic.cs index 1e64036e67..7ae3026cf1 100644 --- a/src/externalsystems/Dim.Library/BusinessLogic/DimBusinessLogic.cs +++ b/src/externalsystems/Dim.Library/BusinessLogic/DimBusinessLogic.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/externalsystems/Dim.Library/Dim.Library.csproj b/src/externalsystems/Dim.Library/Dim.Library.csproj index 37c1be9825..8bce3789dc 100644 --- a/src/externalsystems/Dim.Library/Dim.Library.csproj +++ b/src/externalsystems/Dim.Library/Dim.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/externalsystems/IssuerComponent.Library/BusinessLogic/IssuerComponentBusinessLogic.cs b/src/externalsystems/IssuerComponent.Library/BusinessLogic/IssuerComponentBusinessLogic.cs index 9044f83e94..d01a27a38d 100644 --- a/src/externalsystems/IssuerComponent.Library/BusinessLogic/IssuerComponentBusinessLogic.cs +++ b/src/externalsystems/IssuerComponent.Library/BusinessLogic/IssuerComponentBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.Service; diff --git a/src/externalsystems/IssuerComponent.Library/IssuerComponent.Library.csproj b/src/externalsystems/IssuerComponent.Library/IssuerComponent.Library.csproj index ec06ac80dd..722b34ae32 100644 --- a/src/externalsystems/IssuerComponent.Library/IssuerComponent.Library.csproj +++ b/src/externalsystems/IssuerComponent.Library/IssuerComponent.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/externalsystems/OfferProvider.Library/BusinessLogic/IOfferProviderBusinessLogic.cs b/src/externalsystems/OfferProvider.Library/BusinessLogic/IOfferProviderBusinessLogic.cs index 2b6ee0e746..19a222983f 100644 --- a/src/externalsystems/OfferProvider.Library/BusinessLogic/IOfferProviderBusinessLogic.cs +++ b/src/externalsystems/OfferProvider.Library/BusinessLogic/IOfferProviderBusinessLogic.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.BusinessLogic; diff --git a/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs b/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs index 04e1e30e29..c35a6b73c0 100644 --- a/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs +++ b/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/src/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj b/src/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj index 2348279cba..0b97811d9b 100644 --- a/src/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj +++ b/src/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/externalsystems/OnboardingServiceProvider.Library/IOnboardingServiceProviderBusinessLogic.cs b/src/externalsystems/OnboardingServiceProvider.Library/IOnboardingServiceProviderBusinessLogic.cs index 17f97f3bc8..867b14b3d4 100644 --- a/src/externalsystems/OnboardingServiceProvider.Library/IOnboardingServiceProviderBusinessLogic.cs +++ b/src/externalsystems/OnboardingServiceProvider.Library/IOnboardingServiceProviderBusinessLogic.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library; diff --git a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProvider.Library.csproj b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProvider.Library.csproj index 0873f612e1..31cc727a80 100644 --- a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProvider.Library.csproj +++ b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProvider.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs index dc727bca99..8466e1f096 100644 --- a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs +++ b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs index bbd8a60fbf..b2a19520ee 100644 --- a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs +++ b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/externalsystems/SdFactory.Library/SdFactory.Library.csproj b/src/externalsystems/SdFactory.Library/SdFactory.Library.csproj index 234265f87b..ef85fe198e 100644 --- a/src/externalsystems/SdFactory.Library/SdFactory.Library.csproj +++ b/src/externalsystems/SdFactory.Library/SdFactory.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/framework/Framework.Async/Directory.Build.props b/src/framework/Framework.Async/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Async/Directory.Build.props +++ b/src/framework/Framework.Async/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Cors/Directory.Build.props b/src/framework/Framework.Cors/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Cors/Directory.Build.props +++ b/src/framework/Framework.Cors/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.DBAccess/Directory.Build.props b/src/framework/Framework.DBAccess/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DBAccess/Directory.Build.props +++ b/src/framework/Framework.DBAccess/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/portalbackend/PortalBackend.PortalEntities/Base/IBaseEntity.cs b/src/framework/Framework.DBAccess/IBaseEntity.cs similarity index 92% rename from src/portalbackend/PortalBackend.PortalEntities/Base/IBaseEntity.cs rename to src/framework/Framework.DBAccess/IBaseEntity.cs index 3f34ce0bc8..903fdd2fba 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Base/IBaseEntity.cs +++ b/src/framework/Framework.DBAccess/IBaseEntity.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; /// /// Marker interface diff --git a/src/framework/Framework.DateTimeProvider/Directory.Build.props b/src/framework/Framework.DateTimeProvider/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DateTimeProvider/Directory.Build.props +++ b/src/framework/Framework.DateTimeProvider/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.DependencyInjection/Directory.Build.props b/src/framework/Framework.DependencyInjection/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DependencyInjection/Directory.Build.props +++ b/src/framework/Framework.DependencyInjection/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props b/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling.Web/Directory.Build.props b/src/framework/Framework.ErrorHandling.Web/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling.Web/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling.Web/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling/Directory.Build.props b/src/framework/Framework.ErrorHandling/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.HttpClientExtensions/Directory.Build.props b/src/framework/Framework.HttpClientExtensions/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.HttpClientExtensions/Directory.Build.props +++ b/src/framework/Framework.HttpClientExtensions/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.IO/Directory.Build.props b/src/framework/Framework.IO/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.IO/Directory.Build.props +++ b/src/framework/Framework.IO/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Identity/Framework.Identity.csproj b/src/framework/Framework.Identity/Framework.Identity.csproj new file mode 100644 index 0000000000..2265c77385 --- /dev/null +++ b/src/framework/Framework.Identity/Framework.Identity.csproj @@ -0,0 +1,63 @@ + + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Identity + Org.Eclipse.TractusX.Portal.Backend.Framework.Identity + net8.0 + enable + enable + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Identity + Org.Eclipse.TractusX.Portal.Backend.Framework.Identity + TractusX + All content is the property of the respective authors or their employers. For more information regarding authorship of content, please consult the listed source code repository logs. + + The Catena-X Portal Backend Framework library is a versatile .NET library that provides a set of powerful tools and utilities for common development tasks. + This package simplifies various aspects of your application, including database interactions, asynchronous programming, file I/O, LINQ operations, logging, and database seeding. + + README.md + LICENSE + https://github.com/eclipse-tractusx/portal-backend + https://github.com/eclipse-tractusx/portal-backend + git + + true + + + true + + + true + snupkg + + + + + + + + + + diff --git a/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityData.cs b/src/framework/Framework.Identity/IIdentityData.cs similarity index 86% rename from src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityData.cs rename to src/framework/Framework.Identity/IIdentityData.cs index 3c4699387c..3a2724426a 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityData.cs +++ b/src/framework/Framework.Identity/IIdentityData.cs @@ -17,9 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; public interface IIdentityData { diff --git a/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs b/src/framework/Framework.Identity/IIdentityService.cs similarity index 91% rename from src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs rename to src/framework/Framework.Identity/IIdentityService.cs index f170e7e78c..9d84b35174 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs +++ b/src/framework/Framework.Identity/IIdentityService.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; public interface IIdentityService { diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/IdentityTypeId.cs b/src/framework/Framework.Identity/IdentityTypeId.cs similarity index 89% rename from src/portalbackend/PortalBackend.PortalEntities/Enums/IdentityTypeId.cs rename to src/framework/Framework.Identity/IdentityTypeId.cs index 04e4acfac9..a3d9043e09 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/IdentityTypeId.cs +++ b/src/framework/Framework.Identity/IdentityTypeId.cs @@ -1,5 +1,4 @@ /******************************************************************************** - * Copyright (c) 2023 BMW Group AG * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; public enum IdentityTypeId { diff --git a/src/framework/Framework.Identity/README.md b/src/framework/Framework.Identity/README.md new file mode 100644 index 0000000000..bc1e239dee --- /dev/null +++ b/src/framework/Framework.Identity/README.md @@ -0,0 +1,21 @@ +# Catena-X Portal Backend Framework Identity + +The Catena-X Portal Backend Framework Identity library provides a useful set of identity handling. + +This content is produced and maintained by the Eclipse Tractus-X project. + +* Project home: https://projects.eclipse.org/projects/automotive.tractusx + +## Installation + +dotnet add package Org.Eclipse.TractusX.Portal.Backend.Framework.Identity + +## Source Code + +The project maintains the following source code repositories in the GitHub organization https://github.com/eclipse-tractusx: + +- https://github.com/eclipse-tractusx/portal-backend + +## License + +Distributed under the Apache 2.0 License. diff --git a/src/framework/Framework.Linq/Directory.Build.props b/src/framework/Framework.Linq/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Linq/Directory.Build.props +++ b/src/framework/Framework.Linq/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Logging/Directory.Build.props b/src/framework/Framework.Logging/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Logging/Directory.Build.props +++ b/src/framework/Framework.Logging/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Models/Directory.Build.props b/src/framework/Framework.Models/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Models/Directory.Build.props +++ b/src/framework/Framework.Models/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Processes.Library/Context/IProcessRepositories.cs b/src/framework/Framework.Processes.Library/Context/IProcessRepositories.cs new file mode 100644 index 0000000000..1d24af00e4 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Context/IProcessRepositories.cs @@ -0,0 +1,55 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +public interface IProcessRepositories + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + /// + /// Attaches the given Entity to the database + /// + /// the entity that should be attached to the database + /// action to set optional parameters + /// Type of the entity + /// Returns the attached entity + TEntity Attach(TEntity entity, Action? setOptionalParameters = null) + where TEntity : class; + + void AttachRange(IEnumerable entities, Action setOptionalParameters) where TEntity : class; + + IEnumerable AttachRange(IEnumerable entities) where TEntity : class; + + /// + /// Removes the given entity from the database + /// + /// the entity that should be removed to the database + /// Type of the entity + /// Returns the attached entity + TEntity Remove(TEntity entity) + where TEntity : class; + + void RemoveRange(IEnumerable entities) where TEntity : class; + + public T GetInstance(); + + public Task SaveAsync(); + void Clear(); +} diff --git a/src/framework/Framework.Processes.Library/Context/IProcessStepRepository.cs b/src/framework/Framework.Processes.Library/Context/IProcessStepRepository.cs new file mode 100644 index 0000000000..64332d2f05 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Context/IProcessStepRepository.cs @@ -0,0 +1,42 @@ +/******************************************************************************** + * Copyright (c) 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +/// +/// Repository for accessing and creating processSteps on persistence layer. +/// +public interface IProcessStepRepository + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + Process CreateProcess(TProcessTypeId processTypeId); + IEnumerable> CreateProcessRange(IEnumerable processTypeIds); + ProcessStep CreateProcessStep(TProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId); + IEnumerable> CreateProcessStepRange(IEnumerable<(TProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus); + void AttachAndModifyProcessStep(Guid processStepId, Action>? initialize, Action> modify); + void AttachAndModifyProcessSteps(IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdsInitializeModifyData); + IAsyncEnumerable> GetActiveProcesses(IEnumerable processTypeIds, IEnumerable processStepTypeIds, DateTimeOffset lockExpiryDate); + IAsyncEnumerable<(Guid ProcessStepId, TProcessStepTypeId ProcessStepTypeId)> GetProcessStepData(Guid processId); + public Task<(bool ProcessExists, VerifyProcessData ProcessData)> IsValidProcess(Guid processId, TProcessTypeId processTypeId, IEnumerable processStepTypeIds); +} diff --git a/src/framework/Framework.Processes.Library/Context/ProcessDbContext.cs b/src/framework/Framework.Processes.Library/Context/ProcessDbContext.cs new file mode 100644 index 0000000000..d580272310 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Context/ProcessDbContext.cs @@ -0,0 +1,64 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +public class ProcessDbContext : DbContext + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + protected ProcessDbContext() + { + throw new InvalidOperationException("IdentityService should never be null"); + } + + public ProcessDbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet> Processes { get; set; } = default!; + public virtual DbSet> ProcessSteps { get; set; } = default!; + public virtual DbSet> ProcessStepStatuses { get; set; } = default!; + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSnakeCaseNamingConvention(); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity>() + .HasOne(d => d.Process) + .WithMany(p => p.ProcessSteps) + .HasForeignKey(d => d.ProcessId) + .OnDelete(DeleteBehavior.ClientSetNull); + + modelBuilder.Entity>() + .HasData( + Enum.GetValues(typeof(ProcessStepStatusId)) + .Cast() + .Select(e => new ProcessStepStatus(e)) + ); + } +} diff --git a/src/framework/Framework.Processes.Library/Context/ProcessRepositories.cs b/src/framework/Framework.Processes.Library/Context/ProcessRepositories.cs new file mode 100644 index 0000000000..1be104618e --- /dev/null +++ b/src/framework/Framework.Processes.Library/Context/ProcessRepositories.cs @@ -0,0 +1,89 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using System.Collections.Immutable; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +public class ProcessRepositories(ProcessDbContext dbContext) : IProcessRepositories + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + private static KeyValuePair, object>> CreateTypeEntry(Func, object> createFunc) => KeyValuePair.Create(typeof(T), createFunc); + + protected static readonly IReadOnlyDictionary, object>> ProcessRepositoryTypes = ImmutableDictionary.CreateRange(new[] + { + CreateTypeEntry>(context => new ProcessStepRepository(context)) + }); + + public RepositoryType GetInstance() + { + object? repository = default; + + if (ProcessRepositoryTypes.TryGetValue(typeof(RepositoryType), out var createFunc)) + { + repository = createFunc(dbContext); + } + + return (RepositoryType)(repository ?? throw new ArgumentException($"unexpected type {typeof(RepositoryType).Name}", nameof(RepositoryType))); + } + + /// + public TEntity Attach(TEntity entity, Action? setOptionalParameters = null) where TEntity : class + { + var attachedEntity = dbContext.Attach(entity).Entity; + setOptionalParameters?.Invoke(attachedEntity); + + return attachedEntity; + } + + public void AttachRange(IEnumerable entities, Action setOptionalParameters) where TEntity : class + { + foreach (var attachedEntity in entities.Select(entity => dbContext.Attach(entity).Entity)) + { + setOptionalParameters.Invoke(attachedEntity); + } + } + + public IEnumerable AttachRange(IEnumerable entities) where TEntity : class => + entities.Select(entity => dbContext.Attach(entity).Entity); + + /// + public TEntity Remove(TEntity entity) where TEntity : class + => dbContext.Remove(entity).Entity; + + public void RemoveRange(IEnumerable entities) where TEntity : class + => dbContext.RemoveRange(entities); + + public Task SaveAsync() + { + try + { + return dbContext.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException e) + { + throw new ConflictException("while processing a concurrent update was saved to the database (reason could also be data to be deleted is no longer existing)", e); + } + } + + public void Clear() => dbContext.ChangeTracker.Clear(); +} diff --git a/src/framework/Framework.Processes.Library/Context/ProcessStepRepository.cs b/src/framework/Framework.Processes.Library/Context/ProcessStepRepository.cs new file mode 100644 index 0000000000..6b6ded4c10 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Context/ProcessStepRepository.cs @@ -0,0 +1,113 @@ +/******************************************************************************** + * Copyright (c) 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; +using System.Collections.Immutable; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +public class ProcessStepRepository(ProcessDbContext dbContext) : IProcessStepRepository + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + public Process CreateProcess(TProcessTypeId processTypeId) => + dbContext.Add(new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid())).Entity; + + public IEnumerable> CreateProcessRange(IEnumerable processTypeIds) + { + var processes = processTypeIds.Select(x => new Process(Guid.NewGuid(), x, Guid.NewGuid())).ToImmutableList(); + dbContext.AddRange(processes); + return processes; + } + + public ProcessStep CreateProcessStep(TProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId) => + dbContext.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)).Entity; + + public IEnumerable> CreateProcessStepRange(IEnumerable<(TProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) + { + var processSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); + dbContext.AddRange(processSteps); + return processSteps; + } + + public void AttachAndModifyProcessStep(Guid processStepId, Action>? initialize, Action> modify) + { + var step = new ProcessStep(processStepId, default, default, Guid.Empty, default); + initialize?.Invoke(step); + dbContext.Attach(step); + step.DateLastChanged = DateTimeOffset.UtcNow; + modify(step); + } + + public void AttachAndModifyProcessSteps(IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdsInitializeModifyData) + { + var stepModifyData = processStepIdsInitializeModifyData.Select(data => + { + var step = new ProcessStep(data.ProcessStepId, default, default, Guid.Empty, default); + data.Initialize?.Invoke(step); + return (Step: step, data.Modify); + }).ToImmutableList(); + dbContext.AttachRange(stepModifyData.Select(data => data.Step)); + stepModifyData.ForEach(data => + { + data.Step.DateLastChanged = DateTimeOffset.UtcNow; + data.Modify(data.Step); + }); + } + + public IAsyncEnumerable> GetActiveProcesses(IEnumerable processTypeIds, IEnumerable processStepTypeIds, DateTimeOffset lockExpiryDate) => + dbContext.Processes + .AsNoTracking() + .Where(process => + processTypeIds.Contains(process.ProcessTypeId) && + process.ProcessSteps.Any(step => processStepTypeIds.Contains(step.ProcessStepTypeId) && step.ProcessStepStatusId == ProcessStepStatusId.TODO) && + (process.LockExpiryDate == null || process.LockExpiryDate < lockExpiryDate)) + .AsAsyncEnumerable(); + + public IAsyncEnumerable<(Guid ProcessStepId, TProcessStepTypeId ProcessStepTypeId)> GetProcessStepData(Guid processId) => + dbContext.ProcessSteps + .AsNoTracking() + .Where(step => + step.ProcessId == processId && + step.ProcessStepStatusId == ProcessStepStatusId.TODO) + .OrderBy(step => step.ProcessStepTypeId) + .Select(step => + new ValueTuple( + step.Id, + step.ProcessStepTypeId)) + .AsAsyncEnumerable(); + + public Task<(bool ProcessExists, VerifyProcessData ProcessData)> IsValidProcess(Guid processId, TProcessTypeId processTypeId, IEnumerable processStepTypeIds) => + dbContext.Processes + .AsNoTracking() + .Where(x => x.Id == processId && x.ProcessTypeId.Equals(processTypeId)) + .Select(x => new ValueTuple>( + true, + new VerifyProcessData( + x, + x.ProcessSteps + .Where(step => + processStepTypeIds.Contains(step.ProcessStepTypeId) && + step.ProcessStepStatusId == ProcessStepStatusId.TODO)) + )) + .SingleOrDefaultAsync(); +} diff --git a/src/processes/Processes.Library/Processes.Library.csproj b/src/framework/Framework.Processes.Library/Directory.Build.props similarity index 50% rename from src/processes/Processes.Library/Processes.Library.csproj rename to src/framework/Framework.Processes.Library/Directory.Build.props index 5de45af37f..e23d9cab37 100644 --- a/src/processes/Processes.Library/Processes.Library.csproj +++ b/src/framework/Framework.Processes.Library/Directory.Build.props @@ -1,5 +1,5 @@ - - - - Org.Eclipse.TractusX.Portal.Backend.Processes.Library - Org.Eclipse.TractusX.Portal.Backend.Processes.Library - net8.0 - enable - enable - 76a1cf69-39e1-43a7-b6a7-fef83be5359f - - - - - - + + + 2.9.0 + + diff --git a/src/framework/Framework.Processes.Library/Entities/Process.cs b/src/framework/Framework.Processes.Library/Entities/Process.cs new file mode 100644 index 0000000000..f31c3958df --- /dev/null +++ b/src/framework/Framework.Processes.Library/Entities/Process.cs @@ -0,0 +1,51 @@ +/******************************************************************************** + * Copyright (c) 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using System.ComponentModel.DataAnnotations; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; + +public class Process : IBaseEntity, ILockableEntity + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + private Process() + { + ProcessSteps = new HashSet>(); + } + + public Process(Guid id, TProcessTypeId processTypeId, Guid version) : this() + { + Id = id; + ProcessTypeId = processTypeId; + Version = version; + } + + public Guid Id { get; private set; } + + public TProcessTypeId ProcessTypeId { get; set; } + + public DateTimeOffset? LockExpiryDate { get; set; } + + [ConcurrencyCheck] + public Guid Version { get; set; } + + public virtual ICollection> ProcessSteps { get; private set; } +} diff --git a/src/framework/Framework.Processes.Library/Entities/ProcessStep.cs b/src/framework/Framework.Processes.Library/Entities/ProcessStep.cs new file mode 100644 index 0000000000..9e224a48a7 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Entities/ProcessStep.cs @@ -0,0 +1,51 @@ +/******************************************************************************** + * Copyright (c) 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; + +public class ProcessStep( + Guid id, + TProcessStepTypeId processStepTypeId, + ProcessStepStatusId processStepStatusId, + Guid processId, + DateTimeOffset dateCreated) + : IBaseEntity + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible +{ + public Guid Id { get; private set; } = id; + + public TProcessStepTypeId ProcessStepTypeId { get; private set; } = processStepTypeId; + + public ProcessStepStatusId ProcessStepStatusId { get; set; } = processStepStatusId; + + public Guid ProcessId { get; private set; } = processId; + + public DateTimeOffset DateCreated { get; private set; } = dateCreated; + + public DateTimeOffset? DateLastChanged { get; set; } + + public string? Message { get; set; } + + // Navigation properties + public virtual Process? Process { get; private set; } +} diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepStatus.cs b/src/framework/Framework.Processes.Library/Entities/ProcessStepStatus.cs similarity index 71% rename from src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepStatus.cs rename to src/framework/Framework.Processes.Library/Entities/ProcessStepStatus.cs index e9d7f0a5b2..9260e6ed7f 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepStatus.cs +++ b/src/framework/Framework.Processes.Library/Entities/ProcessStepStatus.cs @@ -17,17 +17,19 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using System.ComponentModel.DataAnnotations; -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; -public class ProcessStepStatus +public class ProcessStepStatus + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { private ProcessStepStatus() { Label = null!; - ProcessSteps = new HashSet(); + ProcessSteps = new HashSet>(); } public ProcessStepStatus(ProcessStepStatusId processStepStatusId) : this() @@ -42,5 +44,5 @@ public ProcessStepStatus(ProcessStepStatusId processStepStatusId) : this() public string Label { get; private set; } // Navigation properties - public virtual ICollection ProcessSteps { get; private set; } + public virtual ICollection> ProcessSteps { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/ProcessStepStatusId.cs b/src/framework/Framework.Processes.Library/Enums/ProcessStepStatusId.cs similarity index 89% rename from src/portalbackend/PortalBackend.PortalEntities/Enums/ProcessStepStatusId.cs rename to src/framework/Framework.Processes.Library/Enums/ProcessStepStatusId.cs index 4b04ff782a..a9743aedb3 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/ProcessStepStatusId.cs +++ b/src/framework/Framework.Processes.Library/Enums/ProcessStepStatusId.cs @@ -1,5 +1,4 @@ /******************************************************************************** - * Copyright (c) 2022 BMW Group AG * Copyright (c) 2022 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; public enum ProcessStepStatusId { diff --git a/src/framework/Framework.Processes.Library/Extensions/RetriggerExtensions.cs b/src/framework/Framework.Processes.Library/Extensions/RetriggerExtensions.cs new file mode 100644 index 0000000000..8a0d5150e3 --- /dev/null +++ b/src/framework/Framework.Processes.Library/Extensions/RetriggerExtensions.cs @@ -0,0 +1,48 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Extensions; + +public static class RetriggerExtensions +{ + public static async Task TriggerProcessStep( + this TProcessStepTypeId stepToTrigger, Guid processId, + IProcessRepositories processRepositories, + Func getProcessStepForRetrigger) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible + { + var (processType, nextStep) = getProcessStepForRetrigger(stepToTrigger); + + var (validProcessId, processData) = await processRepositories.GetInstance>().IsValidProcess(processId, processType, Enumerable.Repeat(stepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); + if (!validProcessId) + { + throw new NotFoundException($"process {processId} does not exist"); + } + + var context = processData.CreateManualProcessData(stepToTrigger, processRepositories, () => $"processId {processId}"); + + context.ScheduleProcessSteps(Enumerable.Repeat(nextStep, 1)); + context.FinalizeProcessStep(); + await processRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); + } +} diff --git a/src/framework/Framework.Processes.Library/Framework.Processes.Library.csproj b/src/framework/Framework.Processes.Library/Framework.Processes.Library.csproj new file mode 100644 index 0000000000..f4718b76cd --- /dev/null +++ b/src/framework/Framework.Processes.Library/Framework.Processes.Library.csproj @@ -0,0 +1,73 @@ + + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library + net8.0 + enable + enable + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library + TractusX + All content is the property of the respective authors or their employers. For more information regarding authorship of content, please consult the listed source code repository logs. + + The Catena-X Portal Backend Framework library is a versatile .NET library that provides a set of powerful tools and utilities for common development tasks. + This package simplifies various aspects of your application, including database interactions, asynchronous programming, file I/O, LINQ operations, logging, and database seeding. + + README.md + LICENSE + https://github.com/eclipse-tractusx/portal-backend + https://github.com/eclipse-tractusx/portal-backend + git + + true + + + true + + + true + snupkg + + + + + + + + + + + + + + + + + + + + diff --git a/src/framework/Framework.Processes.Library/ManualProcessStepData.cs b/src/framework/Framework.Processes.Library/ManualProcessStepData.cs new file mode 100644 index 0000000000..6604dd315a --- /dev/null +++ b/src/framework/Framework.Processes.Library/ManualProcessStepData.cs @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; + +public record ManualProcessStepData( + TProcessStepTypeId? ProcessStepTypeId, + Process Process, + IEnumerable> ProcessSteps, + IProcessRepositories ProcessRepositories +) +where TProcessTypeId : struct, IConvertible +where TProcessStepTypeId : struct, IConvertible; diff --git a/src/processes/Processes.Library/ManualProcessStepDataExtensions.cs b/src/framework/Framework.Processes.Library/ManualProcessStepDataExtensions.cs similarity index 53% rename from src/processes/Processes.Library/ManualProcessStepDataExtensions.cs rename to src/framework/Framework.Processes.Library/ManualProcessStepDataExtensions.cs index 82de981d71..3362f2bd29 100644 --- a/src/processes/Processes.Library/ManualProcessStepDataExtensions.cs +++ b/src/framework/Framework.Processes.Library/ManualProcessStepDataExtensions.cs @@ -19,21 +19,22 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; public static class VerifyProcessDataExtensions { - public static ManualProcessStepData CreateManualProcessData( - this VerifyProcessData? processData, - ProcessStepTypeId? processStepTypeId, - IPortalRepositories portalRepositories, + public static ManualProcessStepData CreateManualProcessData( + this VerifyProcessData? processData, + TProcessStepTypeId? processStepTypeId, + IProcessRepositories processRepositories, Func getProcessEntityName) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { if (processData is null) { @@ -60,20 +61,22 @@ public static ManualProcessStepData CreateManualProcessData( throw new UnexpectedConditionException("processSteps should never have any other status than TODO here"); } - if (processStepTypeId.HasValue && processData.ProcessSteps.All(step => step.ProcessStepTypeId != processStepTypeId.Value)) + if (processStepTypeId != null && processData.ProcessSteps.All(step => !step.ProcessStepTypeId.Equals(processStepTypeId))) { - throw new ConflictException($"{getProcessEntityName()}, process step {processStepTypeId.Value} is not eligible to run"); + throw new ConflictException($"{getProcessEntityName()}, process step {processStepTypeId} is not eligible to run"); } - return new(processStepTypeId, processData.Process, processData.ProcessSteps, portalRepositories); + return new(processStepTypeId, processData.Process, processData.ProcessSteps, processRepositories); } } public static class ManualProcessStepDataExtensions { - public static void RequestLock(this ManualProcessStepData context, DateTimeOffset lockExpiryDate) + public static void RequestLock(this ManualProcessStepData context, DateTimeOffset lockExpiryDate) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { - context.PortalRepositories.Attach(context.Process); + context.ProcessRepositories.Attach(context.Process); var isLocked = context.Process.TryLock(lockExpiryDate); if (!isLocked) @@ -82,47 +85,58 @@ public static void RequestLock(this ManualProcessStepData context, DateTimeOffse } } - public static void SkipProcessSteps(this ManualProcessStepData context, IEnumerable processStepTypeIds) => - context.PortalRepositories.GetInstance() + public static void SkipProcessSteps(this ManualProcessStepData context, IEnumerable processStepTypeIds) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible => + context.ProcessRepositories.GetInstance>() .AttachAndModifyProcessSteps( context.ProcessSteps - .Where(step => !context.ProcessStepTypeId.HasValue || step.ProcessStepTypeId != context.ProcessStepTypeId.Value) + .Where(step => !context.ProcessStepTypeId.HasValue || !step.ProcessStepTypeId.Equals(context.ProcessStepTypeId.Value)) .GroupBy(step => step.ProcessStepTypeId) .IntersectBy(processStepTypeIds, group => group.Key) .SelectMany(group => ModifyStepStatusRange(group, ProcessStepStatusId.SKIPPED))); - public static void SkipProcessStepsExcept(this ManualProcessStepData context, IEnumerable processStepTypeIds) => - context.PortalRepositories.GetInstance() + public static void SkipProcessStepsExcept(this ManualProcessStepData context, IEnumerable processStepTypeIds) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible => + context.ProcessRepositories.GetInstance>() .AttachAndModifyProcessSteps( context.ProcessSteps - .Where(step => !context.ProcessStepTypeId.HasValue || step.ProcessStepTypeId != context.ProcessStepTypeId.Value) + .Where(step => !context.ProcessStepTypeId.HasValue || !step.ProcessStepTypeId.Equals(context.ProcessStepTypeId.Value)) .GroupBy(step => step.ProcessStepTypeId) .ExceptBy(processStepTypeIds, group => group.Key) .SelectMany(group => ModifyStepStatusRange(group, ProcessStepStatusId.SKIPPED))); - public static void ScheduleProcessSteps(this ManualProcessStepData context, IEnumerable processStepTypeIds) => - context.PortalRepositories.GetInstance() + public static void ScheduleProcessSteps(this ManualProcessStepData context, IEnumerable processStepTypeIds) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible => + context.ProcessRepositories.GetInstance>() .CreateProcessStepRange( processStepTypeIds + .Select(x => x) .Except(context.ProcessSteps.Select(step => step.ProcessStepTypeId)) .Select(stepTypeId => (stepTypeId, ProcessStepStatusId.TODO, context.Process.Id))); - public static void FinalizeProcessStep(this ManualProcessStepData context) + public static void FinalizeProcessStep(this ManualProcessStepData context) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { - if (context.ProcessStepTypeId.HasValue) + if (context.ProcessStepTypeId != null) { - context.PortalRepositories.GetInstance().AttachAndModifyProcessSteps( - ModifyStepStatusRange(context.ProcessSteps.Where(step => step.ProcessStepTypeId == context.ProcessStepTypeId.Value), ProcessStepStatusId.DONE)); + context.ProcessRepositories.GetInstance>().AttachAndModifyProcessSteps( + ModifyStepStatusRange(context.ProcessSteps.Where(step => step.ProcessStepTypeId.Equals(context.ProcessStepTypeId.Value)), ProcessStepStatusId.DONE)); } - context.PortalRepositories.Attach(context.Process); + context.ProcessRepositories.Attach(context.Process); if (!context.Process.ReleaseLock()) { context.Process.UpdateVersion(); } } - private static IEnumerable<(Guid, Action?, Action)> ModifyStepStatusRange(IEnumerable steps, ProcessStepStatusId processStepStatusId) + private static IEnumerable<(Guid, Action>?, Action>)> ModifyStepStatusRange(IEnumerable> steps, ProcessStepStatusId processStepStatusId) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { using var enumerator = steps.GetEnumerator(); if (!enumerator.MoveNext()) diff --git a/src/processes/Processes.Library/ManualProcessStepData.cs b/src/framework/Framework.Processes.Library/Models/VerifyProcessData.cs similarity index 63% rename from src/processes/Processes.Library/ManualProcessStepData.cs rename to src/framework/Framework.Processes.Library/Models/VerifyProcessData.cs index ec0cd5768f..965bc66ccd 100644 --- a/src/processes/Processes.Library/ManualProcessStepData.cs +++ b/src/framework/Framework.Processes.Library/Models/VerifyProcessData.cs @@ -1,5 +1,4 @@ /******************************************************************************** - * Copyright (c) 2023 Microsoft and BMW Group AG * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -18,15 +17,13 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; -public record ManualProcessStepData( - ProcessStepTypeId? ProcessStepTypeId, - Process Process, - IEnumerable ProcessSteps, - IPortalRepositories PortalRepositories -); +public record VerifyProcessData( + Process? Process, + IEnumerable>? ProcessSteps +) +where TProcessTypeId : struct, IConvertible +where TProcessStepTypeId : struct, IConvertible; diff --git a/src/framework/Framework.Processes.Library/README.md b/src/framework/Framework.Processes.Library/README.md new file mode 100644 index 0000000000..d1f6f541d2 --- /dev/null +++ b/src/framework/Framework.Processes.Library/README.md @@ -0,0 +1,22 @@ +# Catena-X Portal Backend Framework Processes Library + +The Catena-X Portal Backend Framework Processes Library provides some base models. + +This content is produced and maintained by the Eclipse Tractus-X project. + +* Project home: https://projects.eclipse.org/projects/automotive.tractusx + +## Installation + +dotnet add package Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library + +## Source Code + +The project maintains the following source code repositories in the GitHub organization https://github.com/eclipse-tractusx: + +- https://github.com/eclipse-tractusx/portal-backend + + +## License + +Distributed under the Apache 2.0 License. diff --git a/src/framework/Framework.Processes.ProcessIdentity/Directory.Build.props b/src/framework/Framework.Processes.ProcessIdentity/Directory.Build.props new file mode 100644 index 0000000000..e23d9cab37 --- /dev/null +++ b/src/framework/Framework.Processes.ProcessIdentity/Directory.Build.props @@ -0,0 +1,25 @@ + + + + + 2.9.0 + + + diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/VerifyProcessData.cs b/src/framework/Framework.Processes.ProcessIdentity/Extensions/ProcessIdentitySettings.cs similarity index 72% rename from src/portalbackend/PortalBackend.DBAccess/Models/VerifyProcessData.cs rename to src/framework/Framework.Processes.ProcessIdentity/Extensions/ProcessIdentitySettings.cs index 1f85415cf3..88de97e716 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/VerifyProcessData.cs +++ b/src/framework/Framework.Processes.ProcessIdentity/Extensions/ProcessIdentitySettings.cs @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -17,11 +17,12 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +using System.ComponentModel.DataAnnotations; -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity.Extensions; -public record VerifyProcessData( - Process? Process, - IEnumerable? ProcessSteps -); +public class ProcessIdentitySettings +{ + [Required] + public Guid ProcessUserId { get; set; } = Guid.Empty; +} diff --git a/src/framework/Framework.Processes.ProcessIdentity/Framework.Processes.ProcessIdentity.csproj b/src/framework/Framework.Processes.ProcessIdentity/Framework.Processes.ProcessIdentity.csproj new file mode 100644 index 0000000000..18f929e8b6 --- /dev/null +++ b/src/framework/Framework.Processes.ProcessIdentity/Framework.Processes.ProcessIdentity.csproj @@ -0,0 +1,69 @@ + + + + net8.0 + enable + enable + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity + TractusX + All content is the property of the respective authors or their employers. For more information regarding authorship of content, please consult the listed source code repository logs. + + The Catena-X Portal Backend Framework library is a versatile .NET library that provides a set of powerful tools and utilities for common development tasks. + This package simplifies various aspects of your application, including database interactions, asynchronous programming, file I/O, LINQ operations, logging, and database seeding. + + README.md + LICENSE + https://github.com/eclipse-tractusx/portal-backend + https://github.com/eclipse-tractusx/portal-backend + git + + true + + + true + + + true + snupkg + + + + + + + + + + + + + + + + + + diff --git a/src/processes/Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs b/src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs similarity index 81% rename from src/processes/Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs rename to src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs index b4b2974f48..0c058f88b4 100644 --- a/src/processes/Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs +++ b/src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataBuilder.cs @@ -17,10 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; public interface IProcessIdentityDataBuilder : IIdentityData { diff --git a/src/processes/Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs b/src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs similarity index 92% rename from src/processes/Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs rename to src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs index 1ff5a00282..c468220ec8 100644 --- a/src/processes/Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs +++ b/src/framework/Framework.Processes.ProcessIdentity/IProcessIdentityDataDetermination.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; public interface IProcessIdentityDataDetermination { diff --git a/src/framework/Framework.Processes.ProcessIdentity/README.md b/src/framework/Framework.Processes.ProcessIdentity/README.md new file mode 100644 index 0000000000..6d09e7ec36 --- /dev/null +++ b/src/framework/Framework.Processes.ProcessIdentity/README.md @@ -0,0 +1,22 @@ +# Catena-X Portal Backend Framework Processes ProcessIdentity Library + +The Catena-X Portal Backend Framework Processes ProcessIdentity Library provides some base handling for process identities. + +This content is produced and maintained by the Eclipse Tractus-X project. + +* Project home: https://projects.eclipse.org/projects/automotive.tractusx + +## Installation + +dotnet add package Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity + +## Source Code + +The project maintains the following source code repositories in the GitHub organization https://github.com/eclipse-tractusx: + +- https://github.com/eclipse-tractusx/portal-backend + + +## License + +Distributed under the Apache 2.0 License. diff --git a/src/framework/Framework.Processes.Worker.Library/Directory.Build.props b/src/framework/Framework.Processes.Worker.Library/Directory.Build.props new file mode 100644 index 0000000000..e23d9cab37 --- /dev/null +++ b/src/framework/Framework.Processes.Worker.Library/Directory.Build.props @@ -0,0 +1,25 @@ + + + + + 2.9.0 + + + diff --git a/src/framework/Framework.Processes.Worker.Library/Framework.Processes.Worker.Library.csproj b/src/framework/Framework.Processes.Worker.Library/Framework.Processes.Worker.Library.csproj new file mode 100644 index 0000000000..073ead8e15 --- /dev/null +++ b/src/framework/Framework.Processes.Worker.Library/Framework.Processes.Worker.Library.csproj @@ -0,0 +1,79 @@ + + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library + net8.0 + enable + enable + + + + + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library + Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library + TractusX + All content is the property of the respective authors or their employers. For more information regarding authorship of content, please consult the listed source code repository logs. + + The Catena-X Portal Backend Framework library is a versatile .NET library that provides a set of powerful tools and utilities for common development tasks. + This package simplifies various aspects of your application, including database interactions, asynchronous programming, file I/O, LINQ operations, logging, and database seeding. + + README.md + LICENSE + https://github.com/eclipse-tractusx/portal-backend + https://github.com/eclipse-tractusx/portal-backend + git + + true + + + true + + + true + snupkg + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/processes/Processes.Worker.Library/IProcessExecutor.cs b/src/framework/Framework.Processes.Worker.Library/IProcessExecutor.cs similarity index 71% rename from src/processes/Processes.Worker.Library/IProcessExecutor.cs rename to src/framework/Framework.Processes.Worker.Library/IProcessExecutor.cs index 3add06e9bc..dfef0e5b23 100644 --- a/src/processes/Processes.Worker.Library/IProcessExecutor.cs +++ b/src/framework/Framework.Processes.Worker.Library/IProcessExecutor.cs @@ -18,11 +18,11 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; - -public interface IProcessExecutor +public interface IProcessExecutor + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { enum ProcessExecutionResult { @@ -30,7 +30,8 @@ enum ProcessExecutionResult LockRequested = 2, Unmodified = 3 } - IAsyncEnumerable ExecuteProcess(Guid processId, ProcessTypeId processTypeId, CancellationToken cancellationToken); - IEnumerable GetRegisteredProcessTypeIds(); - IEnumerable GetExecutableStepTypeIds(); + + IAsyncEnumerable ExecuteProcess(Guid processId, TProcessTypeId processTypeId, CancellationToken cancellationToken); + IEnumerable GetRegisteredProcessTypeIds(); + IEnumerable GetExecutableStepTypeIds(); } diff --git a/src/processes/Processes.Worker.Library/IProcessTypeExecutor.cs b/src/framework/Framework.Processes.Worker.Library/IProcessTypeExecutor.cs similarity index 53% rename from src/processes/Processes.Worker.Library/IProcessTypeExecutor.cs rename to src/framework/Framework.Processes.Worker.Library/IProcessTypeExecutor.cs index 3487a64d48..db96f1df40 100644 --- a/src/processes/Processes.Worker.Library/IProcessTypeExecutor.cs +++ b/src/framework/Framework.Processes.Worker.Library/IProcessTypeExecutor.cs @@ -17,17 +17,20 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; -public interface IProcessTypeExecutor +public interface IProcessTypeExecutor + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { - record InitializationResult(bool Modified, IEnumerable? ScheduleStepTypeIds); - record StepExecutionResult(bool Modified, ProcessStepStatusId ProcessStepStatusId, IEnumerable? ScheduleStepTypeIds, IEnumerable? SkipStepTypeIds, string? ProcessMessage); + record InitializationResult(bool Modified, IEnumerable? ScheduleStepTypeIds); - ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds); - ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId); + record StepExecutionResult(bool Modified, ProcessStepStatusId ProcessStepStatusId, IEnumerable? ScheduleStepTypeIds, IEnumerable? SkipStepTypeIds, string? ProcessMessage); + + ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds); + ValueTask IsLockRequested(TProcessStepTypeId processStepTypeId); /// /// tbd @@ -36,8 +39,9 @@ record StepExecutionResult(bool Modified, ProcessStepStatusId ProcessStepStatusI /// /// /// - ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken); - bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId); - ProcessTypeId GetProcessTypeId(); - IEnumerable GetExecutableStepTypeIds(); + ValueTask ExecuteProcessStep(TProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken); + + bool IsExecutableStepTypeId(TProcessStepTypeId processStepTypeId); + TProcessTypeId GetProcessTypeId(); + IEnumerable GetExecutableStepTypeIds(); } diff --git a/src/processes/Processes.Worker.Library/ProcessExecutionService.cs b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionService.cs similarity index 79% rename from src/processes/Processes.Worker.Library/ProcessExecutionService.cs rename to src/framework/Framework.Processes.Worker.Library/ProcessExecutionService.cs index 03aae8ac07..f48f491501 100644 --- a/src/processes/Processes.Worker.Library/ProcessExecutionService.cs +++ b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionService.cs @@ -23,23 +23,24 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; using System.Runtime.CompilerServices; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; /// /// Service that reads all open/pending processSteps of a checklist and triggers their execution. /// -public class ProcessExecutionService +public class ProcessExecutionService + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IDateTimeProvider _dateTimeProvider; private readonly TimeSpan _lockExpiryTime; - private readonly ILogger _logger; + private readonly ILogger> _logger; /// /// Creates a new instance of @@ -52,7 +53,7 @@ public ProcessExecutionService( IServiceScopeFactory serviceScopeFactory, IDateTimeProvider dateTimeProvider, IOptions options, - ILogger logger) + ILogger> logger) { _serviceScopeFactory = serviceScopeFactory; _dateTimeProvider = dateTimeProvider; @@ -69,16 +70,16 @@ public async Task ExecuteAsync(CancellationToken stoppingToken) try { using var processServiceScope = _serviceScopeFactory.CreateScope(); - var executorRepositories = processServiceScope.ServiceProvider.GetRequiredService(); - var processExecutor = processServiceScope.ServiceProvider.GetRequiredService(); + var executorRepositories = processServiceScope.ServiceProvider.GetRequiredService>(); + var processExecutor = processServiceScope.ServiceProvider.GetRequiredService>(); var processIdentityDataDetermination = processServiceScope.ServiceProvider.GetRequiredService(); //call processIdentityDataDetermination.GetIdentityData() once to initialize IdentityService IdentityData for synchronous use: await processIdentityDataDetermination.GetIdentityData().ConfigureAwait(ConfigureAwaitOptions.None); using var outerLoopScope = _serviceScopeFactory.CreateScope(); - var outerLoopRepositories = outerLoopScope.ServiceProvider.GetRequiredService(); + var outerLoopRepositories = outerLoopScope.ServiceProvider.GetRequiredService>(); - var activeProcesses = outerLoopRepositories.GetInstance().GetActiveProcesses(processExecutor.GetRegisteredProcessTypeIds(), processExecutor.GetExecutableStepTypeIds(), _dateTimeProvider.OffsetNow); + var activeProcesses = outerLoopRepositories.GetInstance>().GetActiveProcesses(processExecutor.GetRegisteredProcessTypeIds(), processExecutor.GetExecutableStepTypeIds(), _dateTimeProvider.OffsetNow); await foreach (var process in activeProcesses.WithCancellation(stoppingToken).ConfigureAwait(false)) { try @@ -88,14 +89,15 @@ public async Task ExecuteAsync(CancellationToken stoppingToken) _logger.LogInformation("skipping locked process {processId} type {processType}, lock expires at {lockExpireDate}", process.Id, process.ProcessTypeId, process.LockExpiryDate); continue; } - _logger.LogInformation("start processing process {processId} type {processType}", process.Id, process.ProcessTypeId); + _logger.LogInformation("start processing process {processId} type {processType}", process.Id, process.ProcessTypeId); await foreach (var hasChanged in ExecuteProcess(processExecutor, process, stoppingToken).ConfigureAwait(false)) { if (hasChanged) { await executorRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); } + executorRepositories.Clear(); } @@ -104,6 +106,7 @@ public async Task ExecuteAsync(CancellationToken stoppingToken) await executorRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); executorRepositories.Clear(); } + _logger.LogInformation("finished processing process {processId}", process.Id); } catch (Exception ex) when (ex is not SystemException) @@ -120,14 +123,14 @@ public async Task ExecuteAsync(CancellationToken stoppingToken) } } - private async IAsyncEnumerable ExecuteProcess(IProcessExecutor processExecutor, Process process, [EnumeratorCancellation] CancellationToken cancellationToken) + private async IAsyncEnumerable ExecuteProcess(IProcessExecutor processExecutor, Process process, [EnumeratorCancellation] CancellationToken cancellationToken) { await foreach (var executionResult in processExecutor.ExecuteProcess(process.Id, process.ProcessTypeId, cancellationToken).ConfigureAwait(false)) { yield return executionResult switch { - IProcessExecutor.ProcessExecutionResult.LockRequested => EnsureLock(process), - IProcessExecutor.ProcessExecutionResult.SaveRequested => UpdateVersion(process), + IProcessExecutor.ProcessExecutionResult.LockRequested => EnsureLock(process), + IProcessExecutor.ProcessExecutionResult.SaveRequested => UpdateVersion(process), _ => false }; } @@ -139,10 +142,12 @@ private bool EnsureLock(ILockableEntity entity) { return false; } + if (!entity.TryLock(_dateTimeProvider.OffsetNow.Add(_lockExpiryTime))) { throw new UnexpectedConditionException("process TryLock should never fail here"); } + return true; } @@ -152,6 +157,7 @@ private static bool UpdateVersion(ILockableEntity entity) { entity.UpdateVersion(); } + return true; } } diff --git a/src/processes/Processes.Worker.Library/ProcessExecutionServiceExtensions.cs b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceExtensions.cs similarity index 55% rename from src/processes/Processes.Worker.Library/ProcessExecutionServiceExtensions.cs rename to src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceExtensions.cs index 529cd42442..7bfc98d120 100644 --- a/src/processes/Processes.Worker.Library/ProcessExecutionServiceExtensions.cs +++ b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceExtensions.cs @@ -1,5 +1,4 @@ /******************************************************************************** - * Copyright (c) 2022 BMW Group AG * Copyright (c) 2022 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -21,17 +20,24 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Validation; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; public static class ProcessExecutionServiceExtensions { - public static IServiceCollection AddProcessExecutionService(this IServiceCollection services, IConfigurationSection section) + public static IServiceCollection AddProcessExecutionService(this IServiceCollection services, IConfigurationSection section) + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { - services.AddOptions().Bind(section); + services.AddOptions() + .Bind(section) + .EnvironmentalValidation(section); services - .AddTransient() - .AddTransient() + .AddScoped, ProcessRepositories>() + .AddTransient>() + .AddTransient, ProcessExecutor>() .AddTransient(); return services; } diff --git a/src/processes/Processes.Worker.Library/ProcessExecutionServiceSettings.cs b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceSettings.cs similarity index 93% rename from src/processes/Processes.Worker.Library/ProcessExecutionServiceSettings.cs rename to src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceSettings.cs index e099f30ecc..0ac86abe33 100644 --- a/src/processes/Processes.Worker.Library/ProcessExecutionServiceSettings.cs +++ b/src/framework/Framework.Processes.Worker.Library/ProcessExecutionServiceSettings.cs @@ -20,7 +20,7 @@ using System.ComponentModel.DataAnnotations; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; public class ProcessExecutionServiceSettings { diff --git a/src/processes/Processes.Worker.Library/ProcessExecutor.cs b/src/framework/Framework.Processes.Worker.Library/ProcessExecutor.cs similarity index 62% rename from src/processes/Processes.Worker.Library/ProcessExecutor.cs rename to src/framework/Framework.Processes.Worker.Library/ProcessExecutor.cs index 0a1f9a1cbd..0ca0bf2b83 100644 --- a/src/processes/Processes.Worker.Library/ProcessExecutor.cs +++ b/src/framework/Framework.Processes.Worker.Library/ProcessExecutor.cs @@ -21,31 +21,32 @@ using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using System.Collections.Immutable; using System.Runtime.CompilerServices; -namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; -public class ProcessExecutor : IProcessExecutor +public class ProcessExecutor : IProcessExecutor + where TProcessTypeId : struct, IConvertible + where TProcessStepTypeId : struct, IConvertible { - private readonly ImmutableDictionary _executors; - private readonly IProcessStepRepository _processStepRepository; - private readonly ILogger _logger; + private readonly ImmutableDictionary> _executors; + private readonly IProcessStepRepository _processStepRepository; + private readonly ILogger> _logger; - public ProcessExecutor(IEnumerable executors, IPortalRepositories portalRepositories, ILogger logger) + public ProcessExecutor(IEnumerable> executors, IProcessRepositories processRepositories, ILogger> logger) { - _processStepRepository = portalRepositories.GetInstance(); + _processStepRepository = processRepositories.GetInstance>(); _executors = executors.ToImmutableDictionary(executor => executor.GetProcessTypeId()); _logger = logger; } - public IEnumerable GetRegisteredProcessTypeIds() => _executors.Keys; - public IEnumerable GetExecutableStepTypeIds() => _executors.Values.SelectMany(executor => executor.GetExecutableStepTypeIds()); + public IEnumerable GetRegisteredProcessTypeIds() => _executors.Keys; + public IEnumerable GetExecutableStepTypeIds() => _executors.Values.SelectMany(executor => executor.GetExecutableStepTypeIds()); - public async IAsyncEnumerable ExecuteProcess(Guid processId, ProcessTypeId processTypeId, [EnumeratorCancellation] CancellationToken cancellationToken) + public async IAsyncEnumerable.ProcessExecutionResult> ExecuteProcess(Guid processId, TProcessTypeId processTypeId, [EnumeratorCancellation] CancellationToken cancellationToken) { if (!_executors.TryGetValue(processTypeId, out var executor)) { @@ -69,18 +70,19 @@ public ProcessExecutor(IEnumerable executors, IPortalRepos modified |= ScheduleProcessStepTypeIds(initialStepTypeIds, context); yield return modified - ? IProcessExecutor.ProcessExecutionResult.SaveRequested - : IProcessExecutor.ProcessExecutionResult.Unmodified; + ? IProcessExecutor.ProcessExecutionResult.SaveRequested + : IProcessExecutor.ProcessExecutionResult.Unmodified; while (context.ExecutableStepTypeIds.TryGetNext(out var stepTypeId)) { if (await executor.IsLockRequested(stepTypeId).ConfigureAwait(false)) { - yield return IProcessExecutor.ProcessExecutionResult.LockRequested; + yield return IProcessExecutor.ProcessExecutionResult.LockRequested; } + ProcessStepStatusId resultStepStatusId; - IEnumerable? scheduleStepTypeIds; - IEnumerable? skipStepTypeIds; + IEnumerable? scheduleStepTypeIds; + IEnumerable? skipStepTypeIds; string? processMessage; bool success; try @@ -97,21 +99,23 @@ public ProcessExecutor(IEnumerable executors, IPortalRepos modified = false; success = false; } + if (!success) { - yield return IProcessExecutor.ProcessExecutionResult.Unmodified; + yield return IProcessExecutor.ProcessExecutionResult.Unmodified; } + modified |= SetProcessStepStatus(stepTypeId, resultStepStatusId, context, processMessage); modified |= SkipProcessStepTypeIds(skipStepTypeIds, context); modified |= ScheduleProcessStepTypeIds(scheduleStepTypeIds, context); yield return modified - ? IProcessExecutor.ProcessExecutionResult.SaveRequested - : IProcessExecutor.ProcessExecutionResult.Unmodified; + ? IProcessExecutor.ProcessExecutionResult.SaveRequested + : IProcessExecutor.ProcessExecutionResult.Unmodified; } } - private bool ScheduleProcessStepTypeIds(IEnumerable? scheduleStepTypeIds, ProcessContext context) + private bool ScheduleProcessStepTypeIds(IEnumerable? scheduleStepTypeIds, ProcessContext context) { if (scheduleStepTypeIds == null || !scheduleStepTypeIds.Any()) { @@ -123,23 +127,27 @@ private bool ScheduleProcessStepTypeIds(IEnumerable? schedule { return false; } + foreach (var newStep in _processStepRepository.CreateProcessStepRange(newStepTypeIds.Select(stepTypeId => (stepTypeId, ProcessStepStatusId.TODO, context.ProcessId)))) { - context.AllSteps.Add(newStep.ProcessStepTypeId, new[] { newStep.Id }); - if (context.Executor.IsExecutableStepTypeId(newStep.ProcessStepTypeId)) + var processStepTypeId = newStep.ProcessStepTypeId; + context.AllSteps.Add(processStepTypeId, new[] { newStep.Id }); + if (context.Executor.IsExecutableStepTypeId(processStepTypeId)) { - context.ExecutableStepTypeIds.Add(newStep.ProcessStepTypeId); + context.ExecutableStepTypeIds.Add(processStepTypeId); } } + return true; } - private bool SkipProcessStepTypeIds(IEnumerable? skipStepTypeIds, ProcessContext context) + private bool SkipProcessStepTypeIds(IEnumerable? skipStepTypeIds, ProcessContext context) { if (skipStepTypeIds == null || !skipStepTypeIds.Any()) { return false; } + var modified = false; foreach (var skipStepTypeId in skipStepTypeIds) { @@ -151,10 +159,11 @@ private bool SkipProcessStepTypeIds(IEnumerable? skipStepType modified |= skippedStep; } + return modified; } - private bool SetProcessStepStatus(ProcessStepTypeId stepTypeId, ProcessStepStatusId stepStatusId, ProcessContext context, string? processMessage) + private bool SetProcessStepStatus(TProcessStepTypeId stepTypeId, ProcessStepStatusId stepStatusId, ProcessContext context, string? processMessage) { if ((stepStatusId == ProcessStepStatusId.TODO && processMessage == null) || !context.AllSteps.Remove(stepTypeId, out var stepIds)) { @@ -171,30 +180,27 @@ private bool SetProcessStepStatus(ProcessStepTypeId stepTypeId, ProcessStepStatu }); isFirst = false; } + if (context.Executor.IsExecutableStepTypeId(stepTypeId)) { context.ExecutableStepTypeIds.Remove(stepTypeId); } + return true; } private sealed record ProcessContext( Guid ProcessId, - IDictionary> AllSteps, + IDictionary> AllSteps, ProcessStepTypeSet ExecutableStepTypeIds, - IProcessTypeExecutor Executor + IProcessTypeExecutor Executor ); - private sealed class ProcessStepTypeSet + private sealed class ProcessStepTypeSet(IEnumerable items) { - private readonly HashSet _items; - - public ProcessStepTypeSet(IEnumerable items) - { - _items = new HashSet(items); - } + private readonly HashSet _items = [.. items]; - public bool TryGetNext(out ProcessStepTypeId item) + public bool TryGetNext(out TProcessStepTypeId item) { using var enumerator = _items.GetEnumerator(); if (!enumerator.MoveNext()) @@ -207,8 +213,8 @@ public bool TryGetNext(out ProcessStepTypeId item) return true; } - public void Add(ProcessStepTypeId item) => _items.Add(item); + public void Add(TProcessStepTypeId item) => _items.Add(item); - public void Remove(ProcessStepTypeId item) => _items.Remove(item); + public void Remove(TProcessStepTypeId item) => _items.Remove(item); } } diff --git a/src/framework/Framework.Processes.Worker.Library/README.md b/src/framework/Framework.Processes.Worker.Library/README.md new file mode 100644 index 0000000000..9ecd8c7c3d --- /dev/null +++ b/src/framework/Framework.Processes.Worker.Library/README.md @@ -0,0 +1,22 @@ +# Catena-X Portal Backend Framework Processes Worker Library + +The Catena-X Portal Backend Framework Processes Worker Library provides some base models. + +This content is produced and maintained by the Eclipse Tractus-X project. + +* Project home: https://projects.eclipse.org/projects/automotive.tractusx + +## Installation + +dotnet add package Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library + +## Source Code + +The project maintains the following source code repositories in the GitHub organization https://github.com/eclipse-tractusx: + +- https://github.com/eclipse-tractusx/portal-backend + + +## License + +Distributed under the Apache 2.0 License. diff --git a/src/framework/Framework.Seeding/Directory.Build.props b/src/framework/Framework.Seeding/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Seeding/Directory.Build.props +++ b/src/framework/Framework.Seeding/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Swagger/Directory.Build.props b/src/framework/Framework.Swagger/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Swagger/Directory.Build.props +++ b/src/framework/Framework.Swagger/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Token/Directory.Build.props b/src/framework/Framework.Token/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Token/Directory.Build.props +++ b/src/framework/Framework.Token/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Web/Directory.Build.props b/src/framework/Framework.Web/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Web/Directory.Build.props +++ b/src/framework/Framework.Web/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/maintenance/Maintenance.App/Maintenance.App.csproj b/src/maintenance/Maintenance.App/Maintenance.App.csproj index 2c5b5a2ec1..d0a1310a26 100644 --- a/src/maintenance/Maintenance.App/Maintenance.App.csproj +++ b/src/maintenance/Maintenance.App/Maintenance.App.csproj @@ -48,6 +48,7 @@ + diff --git a/src/maintenance/Maintenance.App/Services/MaintenanceService.cs b/src/maintenance/Maintenance.App/Services/MaintenanceService.cs index 7fd7262bec..a1b157e9fe 100644 --- a/src/maintenance/Maintenance.App/Services/MaintenanceService.cs +++ b/src/maintenance/Maintenance.App/Services/MaintenanceService.cs @@ -1,5 +1,4 @@ /******************************************************************************** - * Copyright (c) 2022 BMW Group AG * Copyright (c) 2022 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -19,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.BusinessLogic; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; namespace Org.Eclipse.TractusX.Portal.Backend.Maintenance.App.Services; diff --git a/src/marketplace/Apps.Service/Apps.Service.csproj b/src/marketplace/Apps.Service/Apps.Service.csproj index e14f3b28ca..b9b6dfd300 100644 --- a/src/marketplace/Apps.Service/Apps.Service.csproj +++ b/src/marketplace/Apps.Service/Apps.Service.csproj @@ -48,6 +48,7 @@ + diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppChangeBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppChangeBusinessLogic.cs index 760f57d7e8..d861a2c47b 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppChangeBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppChangeBusinessLogic.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; @@ -35,7 +36,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using System.Text.Json; diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs index 26cb8b75de..0ec9e7faf5 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs @@ -21,6 +21,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -30,7 +31,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs index 557a2ee413..ce54b2539c 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -29,7 +30,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; diff --git a/src/marketplace/Offers.Library.Web/OfferDocumentService.cs b/src/marketplace/Offers.Library.Web/OfferDocumentService.cs index e7d3cc106e..6825779a7b 100644 --- a/src/marketplace/Offers.Library.Web/OfferDocumentService.cs +++ b/src/marketplace/Offers.Library.Web/OfferDocumentService.cs @@ -20,13 +20,13 @@ using Microsoft.AspNetCore.Http; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Web; diff --git a/src/marketplace/Offers.Library.Web/Offers.Library.Web.csproj b/src/marketplace/Offers.Library.Web/Offers.Library.Web.csproj index 2b59a4b30d..54e43fabb3 100644 --- a/src/marketplace/Offers.Library.Web/Offers.Library.Web.csproj +++ b/src/marketplace/Offers.Library.Web/Offers.Library.Web.csproj @@ -28,6 +28,7 @@ + diff --git a/src/marketplace/Offers.Library/Extensions/ProcessStepExtensions.cs b/src/marketplace/Offers.Library/Extensions/ProcessStepExtensions.cs index cfad02d7b4..1749571878 100644 --- a/src/marketplace/Offers.Library/Extensions/ProcessStepExtensions.cs +++ b/src/marketplace/Offers.Library/Extensions/ProcessStepExtensions.cs @@ -18,13 +18,14 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Extensions; public static class ProcessStepExtensions { - public static ProcessStepTypeId? GetProcessStepTypeId(this IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId)> processSteps, Guid offerId) + public static ProcessStepTypeId? GetProcessStepTypeId(this IEnumerable<(ProcessStepTypeId ProcessStepTypeId, Framework.Processes.Library.Enums.ProcessStepStatusId ProcessStepStatusId)> processSteps, Guid offerId) { try { diff --git a/src/marketplace/Offers.Library/Offers.Library.csproj b/src/marketplace/Offers.Library/Offers.Library.csproj index 2579426200..7dee2e3b02 100644 --- a/src/marketplace/Offers.Library/Offers.Library.csproj +++ b/src/marketplace/Offers.Library/Offers.Library.csproj @@ -30,7 +30,9 @@ + + diff --git a/src/marketplace/Offers.Library/Service/IOfferSetupService.cs b/src/marketplace/Offers.Library/Service/IOfferSetupService.cs index b1c385a6cf..50ece474cc 100644 --- a/src/marketplace/Offers.Library/Service/IOfferSetupService.cs +++ b/src/marketplace/Offers.Library/Service/IOfferSetupService.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/marketplace/Offers.Library/Service/OfferService.cs b/src/marketplace/Offers.Library/Service/OfferService.cs index d57b49ce3d..d3638f27da 100644 --- a/src/marketplace/Offers.Library/Service/OfferService.cs +++ b/src/marketplace/Offers.Library/Service/OfferService.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; @@ -31,7 +32,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using System.Text.Json; diff --git a/src/marketplace/Offers.Library/Service/OfferSetupService.cs b/src/marketplace/Offers.Library/Service/OfferSetupService.cs index 5a813f6bc6..9dd5fa6760 100644 --- a/src/marketplace/Offers.Library/Service/OfferSetupService.cs +++ b/src/marketplace/Offers.Library/Service/OfferSetupService.cs @@ -21,15 +21,16 @@ using Org.Eclipse.TractusX.Portal.Backend.Dim.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; diff --git a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs index 84e5bdf706..12f7cecc94 100644 --- a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs +++ b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs @@ -19,15 +19,17 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using System.Collections.Immutable; using System.Text.Json; @@ -105,7 +107,7 @@ await _mailingProcessCreation.RoleBaseSendMail( private void CreateProcessSteps(OfferSubscription offerSubscription) { - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); var process = processStepRepository.CreateProcess(ProcessTypeId.OFFER_SUBSCRIPTION); offerSubscription.ProcessId = process.Id; processStepRepository.CreateProcessStepRange(new (ProcessStepTypeId, ProcessStepStatusId, Guid)[] { (ProcessStepTypeId.TRIGGER_PROVIDER, ProcessStepStatusId.TODO, process.Id) }); diff --git a/src/marketplace/Services.Service/BusinessLogic/ServiceBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/ServiceBusinessLogic.cs index 61efd833d1..802d35a8bc 100644 --- a/src/marketplace/Services.Service/BusinessLogic/ServiceBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/ServiceBusinessLogic.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -27,7 +28,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; namespace Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; diff --git a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs index 1c0be97985..f87a36f87b 100644 --- a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; @@ -28,7 +29,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; namespace Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; diff --git a/src/marketplace/Services.Service/Services.Service.csproj b/src/marketplace/Services.Service/Services.Service.csproj index 1dea012342..4e96568a0c 100644 --- a/src/marketplace/Services.Service/Services.Service.csproj +++ b/src/marketplace/Services.Service/Services.Service.csproj @@ -44,6 +44,7 @@ + diff --git a/src/notifications/Notifications.Service/BusinessLogic/NotificationBusinessLogic.cs b/src/notifications/Notifications.Service/BusinessLogic/NotificationBusinessLogic.cs index 2288315ee0..90fb99e407 100644 --- a/src/notifications/Notifications.Service/BusinessLogic/NotificationBusinessLogic.cs +++ b/src/notifications/Notifications.Service/BusinessLogic/NotificationBusinessLogic.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.Models; @@ -26,7 +27,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.BusinessLogic; diff --git a/src/notifications/Notifications.Service/Notifications.Service.csproj b/src/notifications/Notifications.Service/Notifications.Service.csproj index f438ae6657..3a5277f3ad 100644 --- a/src/notifications/Notifications.Service/Notifications.Service.csproj +++ b/src/notifications/Notifications.Service/Notifications.Service.csproj @@ -42,6 +42,7 @@ + diff --git a/src/portalbackend/PortalBackend.DBAccess/IPortalRepositories.cs b/src/portalbackend/PortalBackend.DBAccess/IPortalRepositories.cs index ce8dee5ef4..9873e73091 100644 --- a/src/portalbackend/PortalBackend.DBAccess/IPortalRepositories.cs +++ b/src/portalbackend/PortalBackend.DBAccess/IPortalRepositories.cs @@ -17,36 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; - -public interface IPortalRepositories -{ - /// - /// Attaches the given Entity to the database - /// - /// the entity that should be attached to the database - /// Type of the entity - /// Returns the attached entity - TEntity Attach(TEntity entity, Action? setOptionalParameters = null) - where TEntity : class; - - void AttachRange(IEnumerable entities, Action setOptionalParameters) where TEntity : class; - - IEnumerable AttachRange(IEnumerable entities) where TEntity : class; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; - /// - /// Removes the given entity from the database - /// - /// the entity that should be removed to the database - /// Type of the entity - /// Returns the attached entity - TEntity Remove(TEntity entity) - where TEntity : class; - - void RemoveRange(IEnumerable entities) where TEntity : class; - - public T GetInstance(); +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; - public Task SaveAsync(); - void Clear(); -} +public interface IPortalRepositories : IProcessRepositories; diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/CompanySubscriptionStatusData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/CompanySubscriptionStatusData.cs index 088e72b66e..1590186da6 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/CompanySubscriptionStatusData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/CompanySubscriptionStatusData.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs index f7b8ca48d4..4f0037a5d6 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Text.Json.Serialization; diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/ProcessStepData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/ProcessStepData.cs index a8b26ffa47..c4a090f078 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/ProcessStepData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/ProcessStepData.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/VerifyChecklistData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/VerifyChecklistData.cs index a7995098b7..34b386774e 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/VerifyChecklistData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/VerifyChecklistData.cs @@ -18,13 +18,13 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; public record VerifyChecklistData( bool IsSubmitted, - Process? Process, + Process? Process, IEnumerable<(ApplicationChecklistEntryTypeId TypeId, ApplicationChecklistEntryStatusId StatusId, string? Comment)>? Checklist, - IEnumerable? ProcessSteps); + IEnumerable>? ProcessSteps); diff --git a/src/portalbackend/PortalBackend.DBAccess/PortalBackend.DBAccess.csproj b/src/portalbackend/PortalBackend.DBAccess/PortalBackend.DBAccess.csproj index f7812e68e9..865f8bae64 100644 --- a/src/portalbackend/PortalBackend.DBAccess/PortalBackend.DBAccess.csproj +++ b/src/portalbackend/PortalBackend.DBAccess/PortalBackend.DBAccess.csproj @@ -27,7 +27,9 @@ + + diff --git a/src/portalbackend/PortalBackend.DBAccess/PortalRepositories.cs b/src/portalbackend/PortalBackend.DBAccess/PortalRepositories.cs index 72b78d47a1..a218f54072 100644 --- a/src/portalbackend/PortalBackend.DBAccess/PortalRepositories.cs +++ b/src/portalbackend/PortalBackend.DBAccess/PortalRepositories.cs @@ -17,18 +17,17 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Microsoft.EntityFrameworkCore; -using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -public class PortalRepositories : IPortalRepositories +public class PortalRepositories(PortalDbContext portalDbContext) + : ProcessRepositories(portalDbContext), IPortalRepositories { - private readonly PortalDbContext _dbContext; - private static KeyValuePair> CreateTypeEntry(Func createFunc) => KeyValuePair.Create(typeof(T), createFunc); private static readonly IReadOnlyDictionary> RepositoryTypes = ImmutableDictionary.CreateRange(new[] @@ -56,7 +55,7 @@ public class PortalRepositories : IPortalRepositories CreateTypeEntry(context => new NetworkRepository(context)), CreateTypeEntry(context => new OfferRepository(context)), CreateTypeEntry(context => new OfferSubscriptionsRepository(context)), - CreateTypeEntry(context => new ProcessStepRepository(context)), + CreateTypeEntry>(context => new ProcessStepRepository(context)), CreateTypeEntry(context => new ServiceAccountRepository(context)), CreateTypeEntry(context => new StaticDataRepository(context)), CreateTypeEntry(context => new TechnicalUserProfileRepository(context)), @@ -66,64 +65,14 @@ public class PortalRepositories : IPortalRepositories CreateTypeEntry(context => new CompanyCertificateRepository(context)), }); - public PortalRepositories(PortalDbContext portalDbContext) - { - _dbContext = portalDbContext; - } - public RepositoryType GetInstance() { object? repository = default; if (RepositoryTypes.TryGetValue(typeof(RepositoryType), out var createFunc)) { - repository = createFunc(_dbContext); + repository = createFunc(portalDbContext); } return (RepositoryType)(repository ?? throw new ArgumentException($"unexpected type {typeof(RepositoryType).Name}", nameof(RepositoryType))); } - - /// - public TEntity Attach(TEntity entity, Action? setOptionalParameters = null) where TEntity : class - { - var attachedEntity = _dbContext.Attach(entity).Entity; - setOptionalParameters?.Invoke(attachedEntity); - - return attachedEntity; - } - - public void AttachRange(IEnumerable entities, Action setOptionalParameters) where TEntity : class - { - foreach (var attachedEntity in entities.Select(entity => _dbContext.Attach(entity).Entity)) - { - setOptionalParameters.Invoke(attachedEntity); - } - } - - public IEnumerable AttachRange(IEnumerable entities) where TEntity : class - { - foreach (var entity in entities) - { - yield return _dbContext.Attach(entity).Entity; - } - } - - /// - public TEntity Remove(TEntity entity) where TEntity : class - => _dbContext.Remove(entity).Entity; - - public void RemoveRange(IEnumerable entities) where TEntity : class - => _dbContext.RemoveRange(entities); - - public Task SaveAsync() - { - try - { - return _dbContext.SaveChangesAsync(); - } - catch (DbUpdateConcurrencyException e) - { - throw new ConflictException("while processing a concurrent update was saved to the database (reason could also be data to be deleted is no longer existing)", e); - } - } - public void Clear() => _dbContext.ChangeTracker.Clear(); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationChecklistRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationChecklistRepository.cs index c14797340d..d8403e6a67 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationChecklistRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationChecklistRepository.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -52,15 +53,15 @@ public ApplicationChecklistEntry AttachAndModifyApplicationChecklist(Guid applic } public Task<(bool IsValidProcessId, Guid ApplicationId, CompanyApplicationStatusId ApplicationStatusId, IEnumerable<(ApplicationChecklistEntryTypeId EntryTypeId, ApplicationChecklistEntryStatusId EntryStatusId)> Checklist)> GetChecklistData(Guid processId) => - dbContext.Processes + dbContext.CompanyApplications .AsNoTracking() - .Where(process => process.Id == processId) - .Select(process => + .Where(ca => ca.ChecklistProcessId == processId) + .Select(ca => new ValueTuple>( true, - process.CompanyApplication!.Id, - process.CompanyApplication.ApplicationStatusId, - process.CompanyApplication.ApplicationChecklistEntries.Select(entry => new ValueTuple( + ca!.Id, + ca.ApplicationStatusId, + ca.ApplicationChecklistEntries.Select(entry => new ValueTuple( entry.ApplicationChecklistEntryTypeId, entry.ApplicationChecklistEntryStatusId )) diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs index fe7a37738a..7b20b313e1 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs @@ -19,6 +19,8 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs index 137494b729..82f7a05aae 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs index 9c70f4d97b..2718669d73 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IIdentityRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IIdentityRepository.cs index 20d88e1366..8b9e14e5b7 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IIdentityRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IIdentityRepository.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/INetworkRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/INetworkRepository.cs index 7cfcbba379..4cda172d5b 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/INetworkRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/INetworkRepository.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -28,7 +29,7 @@ public interface INetworkRepository NetworkRegistration CreateNetworkRegistration(string externalId, Guid companyId, Guid processId, Guid ospId, Guid applicationId); Task CheckExternalIdExists(string externalId, Guid onboardingServiceProviderId); Task GetNetworkRegistrationDataForProcessIdAsync(Guid processId); - Task<(bool RegistrationIdExists, VerifyProcessData processData)> IsValidRegistration(string externalId, IEnumerable processStepTypeIds); + Task<(bool RegistrationIdExists, VerifyProcessData processData)> IsValidRegistration(string externalId, IEnumerable processStepTypeIds); Task<(bool Exists, IEnumerable<(Guid CompanyApplicationId, CompanyApplicationStatusId CompanyApplicationStatusId, string? CallbackUrl)> CompanyApplications, IEnumerable<(CompanyRoleId CompanyRoleId, IEnumerable AgreementIds)> CompanyRoleAgreementIds, Guid? ProcessId)> GetSubmitData(Guid companyId); Task<(OspDetails? OspDetails, string ExternalId, string? Bpn, Guid ApplicationId, IEnumerable Comments)> GetCallbackData(Guid networkRegistrationId, ProcessStepTypeId processStepTypeId); Task GetOspCompanyName(Guid networkRegistrationId); @@ -40,6 +41,6 @@ public interface INetworkRepository ( (CompanyStatusId CompanyStatusId, IEnumerable<(Guid IdentityId, UserStatusId UserStatus)> Identities) CompanyData, IEnumerable<(Guid InvitationId, InvitationStatusId StatusId)> InvitationData, - VerifyProcessData ProcessData + VerifyProcessData ProcessData )? Data)> GetDeclineDataForApplicationId(Guid applicationId, CompanyApplicationTypeId validTypeId, IEnumerable validStatusIds, Guid companyId); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs index ba49f924f5..37926e7203 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -156,7 +157,7 @@ public interface IOfferSubscriptionsRepository Task GetTriggerProviderInformation(Guid offerSubscriptionId); Task GetSubscriptionActivationDataByIdAsync(Guid offerSubscriptionId); Task<(bool IsValidSubscriptionId, bool IsActive)> IsActiveOfferSubscription(Guid offerSubscriptionId); - Task GetProcessStepData(Guid offerSubscriptionId, IEnumerable processStepTypeIds); + Task?> GetProcessStepData(Guid offerSubscriptionId, IEnumerable processStepTypeIds); Task GetClientCreationData(Guid offerSubscriptionId); Task GetTechnicalUserCreationData(Guid offerSubscriptionId); Task<(IEnumerable<(Guid TechnicalUserId, string? TechnicalClientId, CompanyServiceAccountKindId CompanyServiceAccountKindId)> ServiceAccounts, string? ClientId, string? CallbackUrl, OfferSubscriptionStatusId Status)> GetTriggerProviderCallbackInformation(Guid offerSubscriptionId); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IProcessStepRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IProcessStepRepository.cs deleted file mode 100644 index ae4390b5f2..0000000000 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IProcessStepRepository.cs +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; - -/// -/// Repository for accessing and creating processSteps on persistence layer. -/// -public interface IProcessStepRepository -{ - Process CreateProcess(ProcessTypeId processTypeId); - IEnumerable CreateProcessRange(IEnumerable processTypeIds); - ProcessStep CreateProcessStep(ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId); - IEnumerable CreateProcessStepRange(IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus); - void AttachAndModifyProcessStep(Guid processStepId, Action? initialize, Action modify); - void AttachAndModifyProcessSteps(IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdsInitializeModifyData); - IAsyncEnumerable GetActiveProcesses(IEnumerable processTypeIds, IEnumerable processStepTypeIds, DateTimeOffset lockExpiryDate); - IAsyncEnumerable<(Guid ProcessStepId, ProcessStepTypeId ProcessStepTypeId)> GetProcessStepData(Guid processId); - public Task<(bool ProcessExists, VerifyProcessData ProcessData)> IsValidProcess(Guid processId, ProcessTypeId processTypeId, IEnumerable processStepTypeIds); - Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId, Guid? ServiceAccountVersion)> GetProcessDataForServiceAccountCallback(Guid processId, IEnumerable processStepTypeIds); - Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId)> GetProcessDataForServiceAccountDeletionCallback(Guid processId, IEnumerable? processStepTypeIds); -} diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs index 8cb40a1ee8..b025577a4b 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -45,4 +46,6 @@ CompanyServiceAccount CreateCompanyServiceAccount(Guid identityId, void CreateDimUserCreationData(Guid serviceAccountId, Guid processId); Task<(bool IsValid, string? Bpn, string Name)> GetDimServiceAccountData(Guid dimServiceAccountId); Task GetDimServiceAccountIdForProcess(Guid processId); + Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId, Guid? ServiceAccountVersion)> GetProcessDataForServiceAccountCallback(Guid processId, IEnumerable processStepTypeIds); + Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId)> GetProcessDataForServiceAccountDeletionCallback(Guid processId, IEnumerable? processStepTypeIds); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs index 7e258ce840..acf5c5f7d8 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IdentityRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IdentityRepository.cs index 56365ed7cd..fa5998c37e 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IdentityRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IdentityRepository.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/NetworkRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/NetworkRepository.cs index ea9bdab2a2..0bbfbc71e3 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/NetworkRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/NetworkRepository.cs @@ -18,6 +18,8 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -51,12 +53,12 @@ public Task GetNetworkRegistrationDataForProcessIdAsync(Guid processId) => .Select(nr => nr.Id) .SingleOrDefaultAsync(); - public Task<(bool RegistrationIdExists, VerifyProcessData processData)> IsValidRegistration(string externalId, IEnumerable processStepTypeIds) => + public Task<(bool RegistrationIdExists, VerifyProcessData processData)> IsValidRegistration(string externalId, IEnumerable processStepTypeIds) => _context.NetworkRegistrations .Where(x => x.ExternalId == externalId) - .Select(x => new ValueTuple( + .Select(x => new ValueTuple>( true, - new VerifyProcessData( + new VerifyProcessData( x.Process, x.Process!.ProcessSteps .Where(step => @@ -123,7 +125,7 @@ public Task GetNetworkRegistrationDataForProcessIdAsync(Guid processId) => ( (CompanyStatusId CompanyStatusId, IEnumerable<(Guid IdentityId, UserStatusId UserStatus)> Identities) CompanyData, IEnumerable<(Guid InvitationId, InvitationStatusId StatusId)> InvitationData, - VerifyProcessData ProcessData + VerifyProcessData ProcessData )? Data)> GetDeclineDataForApplicationId(Guid applicationId, CompanyApplicationTypeId validTypeId, IEnumerable validStatusIds, Guid companyId) => _context.NetworkRegistrations .AsSplitQuery() @@ -145,7 +147,7 @@ VerifyProcessData ProcessData ValueTuple< ValueTuple>>, IEnumerable>, - VerifyProcessData + VerifyProcessData >?>( true, x.IsValidType, @@ -155,14 +157,14 @@ VerifyProcessData ProcessData ? new ValueTuple< ValueTuple>>, IEnumerable>, - VerifyProcessData>( + VerifyProcessData>( new ValueTuple>>( x.Company!.CompanyStatusId, x.Company.Identities.Select(i => new ValueTuple(i.Id, i.UserStatusId))), x.Invitations.Select(i => new ValueTuple( i.Id, i.InvitationStatusId)), - new VerifyProcessData( + new VerifyProcessData( x.Process, x.Process!.ProcessSteps.Where(ps => ps.ProcessStepStatusId == ProcessStepStatusId.TODO))) : null diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs index bfd2be9d68..2e46dc2ecf 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs @@ -19,7 +19,10 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -409,11 +412,11 @@ public Task GetOfferSubscriptionDataForProcessIdAsync(Guid processId) => .SingleOrDefaultAsync(); /// - public Task GetProcessStepData(Guid offerSubscriptionId, IEnumerable processStepTypeIds) => + public Task?> GetProcessStepData(Guid offerSubscriptionId, IEnumerable processStepTypeIds) => dbContext.OfferSubscriptions .AsNoTracking() .Where(os => os.Id == offerSubscriptionId) - .Select(x => new VerifyProcessData( + .Select(x => new VerifyProcessData( x.Process, x.Process!.ProcessSteps .Where(step => diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs deleted file mode 100644 index 7c53f6d24d..0000000000 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Microsoft.EntityFrameworkCore; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using System.Collections.Immutable; - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; - -public class ProcessStepRepository(PortalDbContext dbContext) : IProcessStepRepository -{ - public Process CreateProcess(ProcessTypeId processTypeId) => - dbContext.Add(new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid())).Entity; - - public IEnumerable CreateProcessRange(IEnumerable processTypeIds) - { - var processes = processTypeIds.Select(x => new Process(Guid.NewGuid(), x, Guid.NewGuid())).ToImmutableList(); - dbContext.AddRange(processes); - return processes; - } - - public ProcessStep CreateProcessStep(ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId) => - dbContext.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)).Entity; - - public IEnumerable CreateProcessStepRange(IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) - { - var processSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); - dbContext.AddRange(processSteps); - return processSteps; - } - - public void AttachAndModifyProcessStep(Guid processStepId, Action? initialize, Action modify) - { - var step = new ProcessStep(processStepId, default, default, Guid.Empty, default); - initialize?.Invoke(step); - dbContext.Attach(step); - step.DateLastChanged = DateTimeOffset.UtcNow; - modify(step); - } - - public void AttachAndModifyProcessSteps(IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdsInitializeModifyData) - { - var stepModifyData = processStepIdsInitializeModifyData.Select(data => - { - var step = new ProcessStep(data.ProcessStepId, default, default, Guid.Empty, default); - data.Initialize?.Invoke(step); - return (Step: step, data.Modify); - }).ToImmutableList(); - dbContext.AttachRange(stepModifyData.Select(data => data.Step)); - stepModifyData.ForEach(data => - { - data.Step.DateLastChanged = DateTimeOffset.UtcNow; - data.Modify(data.Step); - }); - } - - public IAsyncEnumerable GetActiveProcesses(IEnumerable processTypeIds, IEnumerable processStepTypeIds, DateTimeOffset lockExpiryDate) => - dbContext.Processes - .AsNoTracking() - .Where(process => - processTypeIds.Contains(process.ProcessTypeId) && - process.ProcessSteps.Any(step => processStepTypeIds.Contains(step.ProcessStepTypeId) && step.ProcessStepStatusId == ProcessStepStatusId.TODO) && - (process.LockExpiryDate == null || process.LockExpiryDate < lockExpiryDate)) - .AsAsyncEnumerable(); - - public IAsyncEnumerable<(Guid ProcessStepId, ProcessStepTypeId ProcessStepTypeId)> GetProcessStepData(Guid processId) => - dbContext.ProcessSteps - .Where(step => - step.ProcessId == processId && - step.ProcessStepStatusId == ProcessStepStatusId.TODO) - .OrderBy(step => step.ProcessStepTypeId) - .Select(step => - new ValueTuple( - step.Id, - step.ProcessStepTypeId)) - .AsAsyncEnumerable(); - - public Task<(bool ProcessExists, VerifyProcessData ProcessData)> IsValidProcess(Guid processId, ProcessTypeId processTypeId, IEnumerable processStepTypeIds) => - dbContext.Processes - .Where(x => x.Id == processId && x.ProcessTypeId == processTypeId) - .Select(x => new ValueTuple( - true, - new VerifyProcessData( - x, - x.ProcessSteps - .Where(step => - processStepTypeIds.Contains(step.ProcessStepTypeId) && - step.ProcessStepStatusId == ProcessStepStatusId.TODO)) - )) - .SingleOrDefaultAsync(); - - public Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId, Guid? ServiceAccountVersion)> GetProcessDataForServiceAccountCallback(Guid processId, IEnumerable processStepTypeIds) => - dbContext.Processes - .Where(x => x.Id == processId) - .Select(x => new ValueTuple( - x.ProcessTypeId, - new VerifyProcessData( - x, - x.ProcessSteps - .Where(step => - processStepTypeIds.Contains(step.ProcessStepTypeId) && - step.ProcessStepStatusId == ProcessStepStatusId.TODO)), - x.DimUserCreationData!.ServiceAccountId, - x.DimUserCreationData.ServiceAccount!.Version) - ) - .SingleOrDefaultAsync(); - - public Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId)> GetProcessDataForServiceAccountDeletionCallback(Guid processId, IEnumerable? processStepTypeIds) => - dbContext.Processes - .Where(x => x.Id == processId && x.ProcessTypeId == ProcessTypeId.DIM_TECHNICAL_USER) - .Select(x => new ValueTuple( - x.ProcessTypeId, - new VerifyProcessData( - x, - x.ProcessSteps - .Where(step => - (processStepTypeIds == null || processStepTypeIds.Contains(step.ProcessStepTypeId)) && - step.ProcessStepStatusId == ProcessStepStatusId.TODO)), - x.DimUserCreationData!.ServiceAccountId) - ) - .SingleOrDefaultAsync(); -} diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs index 9458d35cf4..ca11a18bbb 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs @@ -19,7 +19,10 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -256,4 +259,35 @@ public Task GetDimServiceAccountIdForProcess(Guid processId) => .Where(x => x.ProcessId == processId) .Select(x => x.Id) .SingleOrDefaultAsync(); + + public Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId, Guid? ServiceAccountVersion)> GetProcessDataForServiceAccountCallback(Guid processId, IEnumerable processStepTypeIds) => + portalDbContext.DimUserCreationData + .Where(x => x.ProcessId == processId) + .Select(x => new ValueTuple, Guid?, Guid?>( + x.Process!.ProcessTypeId, + new VerifyProcessData( + x.Process, + x.Process!.ProcessSteps + .Where(step => + processStepTypeIds.Contains(step.ProcessStepTypeId) && + step.ProcessStepStatusId == ProcessStepStatusId.TODO)), + x.ServiceAccountId, + x.ServiceAccount!.Version) + ) + .SingleOrDefaultAsync(); + + public Task<(ProcessTypeId ProcessTypeId, VerifyProcessData ProcessData, Guid? ServiceAccountId)> GetProcessDataForServiceAccountDeletionCallback(Guid processId, IEnumerable? processStepTypeIds) => + portalDbContext.DimUserCreationData + .Where(x => x.ProcessId == processId && x.Process!.ProcessTypeId == ProcessTypeId.DIM_TECHNICAL_USER) + .Select(x => new ValueTuple, Guid?>( + x.Process!.ProcessTypeId, + new VerifyProcessData( + x.Process, + x.Process!.ProcessSteps + .Where(step => + (processStepTypeIds == null || processStepTypeIds.Contains(step.ProcessStepTypeId)) && + step.ProcessStepStatusId == ProcessStepStatusId.TODO)), + x.ServiceAccountId) + ) + .SingleOrDefaultAsync(); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs index 52c6e3195e..c3b081f4b0 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRolesRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRolesRepository.cs index c054419fb7..a6e775a0ed 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRolesRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRolesRepository.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.Designer.cs new file mode 100644 index 0000000000..2f3da2c8fa --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.Designer.cs @@ -0,0 +1,9754 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + [DbContext(typeof(PortalDbContext))] + [Migration("20240913115133_CreateProcessPackage")] + partial class CreateProcessPackage + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("portal") + .UseCollation("en_US.utf8") + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LockExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("lock_expiry_date"); + + b.Property("ProcessTypeId") + .HasColumnType("integer") + .HasColumnName("process_type_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_processes"); + + b.HasIndex("ProcessTypeId") + .HasDatabaseName("ix_processes_process_type_id"); + + b.ToTable("processes", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStep", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Message") + .HasColumnType("text") + .HasColumnName("message"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("ProcessStepStatusId") + .HasColumnType("integer") + .HasColumnName("process_step_status_id"); + + b.Property("ProcessStepTypeId") + .HasColumnType("integer") + .HasColumnName("process_step_type_id"); + + b.HasKey("Id") + .HasName("pk_process_steps"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_process_steps_process_id"); + + b.HasIndex("ProcessStepStatusId") + .HasDatabaseName("ix_process_steps_process_step_status_id"); + + b.HasIndex("ProcessStepTypeId") + .HasDatabaseName("ix_process_steps_process_step_type_id"); + + b.ToTable("process_steps", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_step_statuses"); + + b.ToTable("process_step_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TODO" + }, + new + { + Id = 2, + Label = "DONE" + }, + new + { + Id = 3, + Label = "SKIPPED" + }, + new + { + Id = 4, + Label = "FAILED" + }, + new + { + Id = 5, + Label = "DUPLICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditAppSubscriptionDetail20221118", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("AppSubscriptionUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("app_subscription_url"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_app_subscription_detail20221118"); + + b.ToTable("audit_app_subscription_detail20221118", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditAppSubscriptionDetail20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("AppSubscriptionUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("app_subscription_url"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_app_subscription_detail20231115"); + + b.ToTable("audit_app_subscription_detail20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCertificateManagement20240416", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyCertificateStatusId") + .HasColumnType("integer") + .HasColumnName("company_certificate_status_id"); + + b.Property("CompanyCertificateTypeId") + .HasColumnType("integer") + .HasColumnName("company_certificate_type_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExternalCertificateNumber") + .HasColumnType("text") + .HasColumnName("external_certificate_number"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Issuer") + .HasColumnType("text") + .HasColumnName("issuer"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("TrustLevel") + .HasColumnType("text") + .HasColumnName("trust_level"); + + b.Property("ValidFrom") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_from"); + + b.Property("ValidTill") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_till"); + + b.Property("Validator") + .HasColumnType("text") + .HasColumnName("validator"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_certificate_management20240416"); + + b.ToTable("audit_certificate_management20240416", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20221005", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("ApplicationStatusId") + .HasColumnType("integer") + .HasColumnName("application_status_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_application20221005"); + + b.ToTable("audit_company_application20221005", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20230214", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("ApplicationStatusId") + .HasColumnType("integer") + .HasColumnName("application_status_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ChecklistProcessId") + .HasColumnType("uuid") + .HasColumnName("checklist_process_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_application20230214"); + + b.ToTable("audit_company_application20230214", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20230824", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("ApplicationStatusId") + .HasColumnType("integer") + .HasColumnName("application_status_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ChecklistProcessId") + .HasColumnType("uuid") + .HasColumnName("checklist_process_id"); + + b.Property("CompanyApplicationTypeId") + .HasColumnType("integer") + .HasColumnName("company_application_type_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OnboardingServiceProviderId") + .HasColumnType("uuid") + .HasColumnName("onboarding_service_provider_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_application20230824"); + + b.ToTable("audit_company_application20230824", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("ApplicationStatusId") + .HasColumnType("integer") + .HasColumnName("application_status_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ChecklistProcessId") + .HasColumnType("uuid") + .HasColumnName("checklist_process_id"); + + b.Property("CompanyApplicationTypeId") + .HasColumnType("integer") + .HasColumnName("company_application_type_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OnboardingServiceProviderId") + .HasColumnType("uuid") + .HasColumnName("onboarding_service_provider_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_application20231115"); + + b.ToTable("audit_company_application20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyAssignedRole2023316", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_assigned_role2023316"); + + b.ToTable("audit_company_assigned_role2023316", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUser20221005", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyUserStatusId") + .HasColumnType("integer") + .HasColumnName("company_user_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("Firstname") + .HasColumnType("text") + .HasColumnName("firstname"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Lastlogin") + .HasColumnType("bytea") + .HasColumnName("lastlogin"); + + b.Property("Lastname") + .HasColumnType("text") + .HasColumnName("lastname"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_user20221005"); + + b.ToTable("audit_company_user20221005", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUser20230522", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("Firstname") + .HasColumnType("text") + .HasColumnName("firstname"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Lastlogin") + .HasColumnType("bytea") + .HasColumnName("lastlogin"); + + b.Property("Lastname") + .HasColumnType("text") + .HasColumnName("lastname"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_user20230523"); + + b.ToTable("audit_company_user20230523", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUserAssignedRole20221018", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_user_assigned_role20221018"); + + b.ToTable("audit_company_user_assigned_role20221018", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20230405", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("DapsRegistrationSuccessful") + .HasColumnType("boolean") + .HasColumnName("daps_registration_successful"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("character varying(2)") + .HasColumnName("location_id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_connector20230405"); + + b.ToTable("audit_connector20230405", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20230503", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("DapsRegistrationSuccessful") + .HasColumnType("boolean") + .HasColumnName("daps_registration_successful"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("character varying(2)") + .HasColumnName("location_id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_connector20230503"); + + b.ToTable("audit_connector20230503", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20230803", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("character varying(2)") + .HasColumnName("location_id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_connector20230803"); + + b.ToTable("audit_connector20230803", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .HasColumnType("text") + .HasColumnName("connector_url"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .HasColumnType("text") + .HasColumnName("location_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_connector20231115"); + + b.ToTable("audit_connector20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20240814", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .HasColumnType("text") + .HasColumnName("connector_url"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .HasColumnType("text") + .HasColumnName("location_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SdCreationProcessId") + .HasColumnType("uuid") + .HasColumnName("sd_creation_process_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_connector20240814"); + + b.ToTable("audit_connector20240814", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConsent20230412", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("ConsentStatusId") + .HasColumnType("integer") + .HasColumnName("consent_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Target") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("target"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_consent20230412"); + + b.ToTable("audit_consent20230412", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConsent20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("ConsentStatusId") + .HasColumnType("integer") + .HasColumnName("consent_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Target") + .HasColumnType("text") + .HasColumnName("target"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_consent20231115"); + + b.ToTable("audit_consent20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditDocument20231108", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_document20231108"); + + b.ToTable("audit_document20231108", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditDocument20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .HasColumnType("text") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_document20231115"); + + b.ToTable("audit_document20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditIdentity20230526", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("IdentityTypeId") + .HasColumnType("integer") + .HasColumnName("identity_type_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("UserEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("user_entity_id"); + + b.Property("UserStatusId") + .HasColumnType("integer") + .HasColumnName("user_status_id") + .HasAnnotation("Relational:JsonPropertyName", "user_status_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_identity20230526"); + + b.ToTable("audit_identity20230526", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditIdentity20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("IdentityTypeId") + .HasColumnType("integer") + .HasColumnName("identity_type_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("UserEntityId") + .HasColumnType("text") + .HasColumnName("user_entity_id"); + + b.Property("UserStatusId") + .HasColumnType("integer") + .HasColumnName("user_status_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_identity20231115"); + + b.ToTable("audit_identity20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditIdentityAssignedRole20230522", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("IdentityId") + .HasColumnType("uuid") + .HasColumnName("identity_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_identity_assigned_role20230522"); + + b.ToTable("audit_identity_assigned_role20230522", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOffer20230119", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("ContactNumber") + .HasColumnType("text") + .HasColumnName("contact_number"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DateReleased") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_released"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("MarketingUrl") + .HasColumnType("text") + .HasColumnName("marketing_url"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("OfferStatusId") + .HasColumnType("integer") + .HasColumnName("offer_status_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("Provider") + .IsRequired() + .HasColumnType("text") + .HasColumnName("provider"); + + b.Property("ProviderCompanyId") + .HasColumnType("uuid") + .HasColumnName("provider_company_id"); + + b.Property("SalesManagerId") + .HasColumnType("uuid") + .HasColumnName("sales_manager_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer20230119"); + + b.ToTable("audit_offer20230119", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOffer20230406", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("ContactNumber") + .HasColumnType("text") + .HasColumnName("contact_number"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DateReleased") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_released"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LicenseTypeId") + .HasColumnType("integer") + .HasColumnName("license_type_id"); + + b.Property("MarketingUrl") + .HasColumnType("text") + .HasColumnName("marketing_url"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("OfferStatusId") + .HasColumnType("integer") + .HasColumnName("offer_status_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("Provider") + .IsRequired() + .HasColumnType("text") + .HasColumnName("provider"); + + b.Property("ProviderCompanyId") + .HasColumnType("uuid") + .HasColumnName("provider_company_id"); + + b.Property("SalesManagerId") + .HasColumnType("uuid") + .HasColumnName("sales_manager_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer20230406"); + + b.ToTable("audit_offer20230406", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOffer20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("ContactNumber") + .HasColumnType("text") + .HasColumnName("contact_number"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DateReleased") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_released"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LicenseTypeId") + .HasColumnType("integer") + .HasColumnName("license_type_id"); + + b.Property("MarketingUrl") + .HasColumnType("text") + .HasColumnName("marketing_url"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("OfferStatusId") + .HasColumnType("integer") + .HasColumnName("offer_status_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("Provider") + .HasColumnType("text") + .HasColumnName("provider"); + + b.Property("ProviderCompanyId") + .HasColumnType("uuid") + .HasColumnName("provider_company_id"); + + b.Property("SalesManagerId") + .HasColumnType("uuid") + .HasColumnName("sales_manager_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer20231115"); + + b.ToTable("audit_offer20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOffer20240911", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("ContactNumber") + .HasColumnType("text") + .HasColumnName("contact_number"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DateReleased") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_released"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LicenseTypeId") + .HasColumnType("integer") + .HasColumnName("license_type_id"); + + b.Property("MarketingUrl") + .HasColumnType("text") + .HasColumnName("marketing_url"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("OfferStatusId") + .HasColumnType("integer") + .HasColumnName("offer_status_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("ProviderCompanyId") + .HasColumnType("uuid") + .HasColumnName("provider_company_id"); + + b.Property("SalesManagerId") + .HasColumnType("uuid") + .HasColumnName("sales_manager_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer20240911"); + + b.ToTable("audit_offer20240911", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOfferSubscription20221005", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisplayName") + .HasColumnType("text") + .HasColumnName("display_name"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferSubscriptionStatusId") + .HasColumnType("integer") + .HasColumnName("offer_subscription_status_id"); + + b.Property("RequesterId") + .HasColumnType("uuid") + .HasColumnName("requester_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer_subscription20221005"); + + b.ToTable("audit_offer_subscription20221005", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOfferSubscription20230317", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisplayName") + .HasColumnType("text") + .HasColumnName("display_name"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferSubscriptionStatusId") + .HasColumnType("integer") + .HasColumnName("offer_subscription_status_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("RequesterId") + .HasColumnType("uuid") + .HasColumnName("requester_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer_subscription20230317"); + + b.ToTable("audit_offer_subscription20230317", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOfferSubscription20231013", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisplayName") + .HasColumnType("text") + .HasColumnName("display_name"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferSubscriptionStatusId") + .HasColumnType("integer") + .HasColumnName("offer_subscription_status_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("RequesterId") + .HasColumnType("uuid") + .HasColumnName("requester_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer_subscription20231013"); + + b.ToTable("audit_offer_subscription20231013", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOfferSubscription20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisplayName") + .HasColumnType("text") + .HasColumnName("display_name"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferSubscriptionStatusId") + .HasColumnType("integer") + .HasColumnName("offer_subscription_status_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("RequesterId") + .HasColumnType("uuid") + .HasColumnName("requester_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_offer_subscription20231115"); + + b.ToTable("audit_offer_subscription20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditProviderCompanyDetail20230614", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("AutoSetupCallbackUrl") + .HasColumnType("text") + .HasColumnName("auto_setup_callback_url"); + + b.Property("AutoSetupUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("auto_setup_url"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_provider_company_detail20230614"); + + b.ToTable("audit_provider_company_detail20230614", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditProviderCompanyDetail20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("AutoSetupCallbackUrl") + .HasColumnType("text") + .HasColumnName("auto_setup_callback_url"); + + b.Property("AutoSetupUrl") + .HasColumnType("text") + .HasColumnName("auto_setup_url"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_provider_company_detail20231115"); + + b.ToTable("audit_provider_company_detail20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditUserRole20221017", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("UserRoleText") + .IsRequired() + .HasColumnType("text") + .HasColumnName("user_role"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_user_role20221017"); + + b.ToTable("audit_user_role20221017", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditUserRole20231115", b => + { + b.Property("AuditV1Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("audit_v1id"); + + b.Property("AuditV1DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("audit_v1date_last_changed"); + + b.Property("AuditV1LastEditorId") + .HasColumnType("uuid") + .HasColumnName("audit_v1last_editor_id"); + + b.Property("AuditV1OperationId") + .HasColumnType("integer") + .HasColumnName("audit_v1operation_id"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("UserRoleText") + .HasColumnType("text") + .HasColumnName("user_role"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_user_role20231115"); + + b.ToTable("audit_user_role20231115", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("City") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("city"); + + b.Property("CountryAlpha2Code") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("country_alpha2code") + .HasAnnotation("Relational:JsonPropertyName", "country_alpha2code"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Region") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("region"); + + b.Property("Streetadditional") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("streetadditional"); + + b.Property("Streetname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("streetname"); + + b.Property("Streetnumber") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("streetnumber"); + + b.Property("Zipcode") + .HasMaxLength(12) + .HasColumnType("character varying(12)") + .HasColumnName("zipcode"); + + b.HasKey("Id") + .HasName("pk_addresses"); + + b.HasIndex("CountryAlpha2Code") + .HasDatabaseName("ix_addresses_country_alpha2code"); + + b.ToTable("addresses", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AgreementCategoryId") + .HasColumnType("integer") + .HasColumnName("agreement_category_id"); + + b.Property("AgreementLink") + .HasColumnType("text") + .HasColumnName("agreement_link"); + + b.Property("AgreementStatusId") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1) + .HasColumnName("agreement_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("IssuerCompanyId") + .HasColumnType("uuid") + .HasColumnName("issuer_company_id"); + + b.Property("Mandatory") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("mandatory"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("Id") + .HasName("pk_agreements"); + + b.HasIndex("AgreementCategoryId") + .HasDatabaseName("ix_agreements_agreement_category_id"); + + b.HasIndex("AgreementStatusId") + .HasDatabaseName("ix_agreements_agreement_status_id"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_agreements_document_id"); + + b.HasIndex("IssuerCompanyId") + .HasDatabaseName("ix_agreements_issuer_company_id"); + + b.HasIndex("UseCaseId") + .HasDatabaseName("ix_agreements_use_case_id"); + + b.ToTable("agreements", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedCompanyRole", b => + { + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.HasKey("AgreementId", "CompanyRoleId") + .HasName("pk_agreement_assigned_company_roles"); + + b.HasIndex("CompanyRoleId") + .HasDatabaseName("ix_agreement_assigned_company_roles_company_role_id"); + + b.ToTable("agreement_assigned_company_roles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOffer", b => + { + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.HasKey("AgreementId", "OfferId") + .HasName("pk_agreement_assigned_offers"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_agreement_assigned_offers_offer_id"); + + b.ToTable("agreement_assigned_offers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOfferType", b => + { + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.HasKey("AgreementId", "OfferTypeId") + .HasName("pk_agreement_assigned_offer_types"); + + b.HasIndex("OfferTypeId") + .HasDatabaseName("ix_agreement_assigned_offer_types_offer_type_id"); + + b.ToTable("agreement_assigned_offer_types", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementCategory", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_agreement_categories"); + + b.ToTable("agreement_categories", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "CX_FRAME_CONTRACT" + }, + new + { + Id = 2, + Label = "APP_CONTRACT" + }, + new + { + Id = 3, + Label = "DATA_CONTRACT" + }, + new + { + Id = 4, + Label = "SERVICE_CONTRACT" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_agreement_statuses"); + + b.ToTable("agreement_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE" + }, + new + { + Id = 2, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppAssignedUseCase", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("AppId", "UseCaseId") + .HasName("pk_app_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .HasDatabaseName("ix_app_assigned_use_cases_use_case_id"); + + b.ToTable("app_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("IamClientId") + .HasColumnType("uuid") + .HasColumnName("iam_client_id"); + + b.HasKey("Id") + .HasName("pk_app_instances"); + + b.HasIndex("AppId") + .HasDatabaseName("ix_app_instances_app_id"); + + b.HasIndex("IamClientId") + .HasDatabaseName("ix_app_instances_iam_client_id"); + + b.ToTable("app_instances", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.HasKey("AppInstanceId", "CompanyServiceAccountId") + .HasName("pk_app_instance_assigned_service_accounts"); + + b.HasIndex("CompanyServiceAccountId") + .HasDatabaseName("ix_app_instance_assigned_service_accounts_company_service_acco"); + + b.ToTable("app_instance_assigned_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("InstanceUrl") + .HasColumnType("text") + .HasColumnName("instance_url"); + + b.Property("IsSingleInstance") + .HasColumnType("boolean") + .HasColumnName("is_single_instance"); + + b.HasKey("Id") + .HasName("pk_app_instance_setups"); + + b.HasIndex("AppId") + .IsUnique() + .HasDatabaseName("ix_app_instance_setups_app_id"); + + b.ToTable("app_instance_setups", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.HasKey("AppId", "LanguageShortName") + .HasName("pk_app_languages"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_app_languages_language_short_name"); + + b.ToTable("app_languages", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppSubscriptionDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("AppSubscriptionUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("app_subscription_url"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.HasKey("Id") + .HasName("pk_app_subscription_details"); + + b.HasIndex("AppInstanceId") + .HasDatabaseName("ix_app_subscription_details_app_instance_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_app_subscription_details_last_editor_id"); + + b.HasIndex("OfferSubscriptionId") + .IsUnique() + .HasDatabaseName("ix_app_subscription_details_offer_subscription_id"); + + b.ToTable("app_subscription_details", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_app_subscription_detail20231115\" (\"id\", \"offer_subscription_id\", \"app_instance_id\", \"app_subscription_url\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"offer_subscription_id\", \r\n NEW.\"app_instance_id\", \r\n NEW.\"app_subscription_url\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL AFTER INSERT\r\nON \"portal\".\"app_subscription_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_APPSUBSCRIPTIONDETAIL\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_app_subscription_detail20231115\" (\"id\", \"offer_subscription_id\", \"app_instance_id\", \"app_subscription_url\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"offer_subscription_id\", \r\n NEW.\"app_instance_id\", \r\n NEW.\"app_subscription_url\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL AFTER UPDATE\r\nON \"portal\".\"app_subscription_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_APPSUBSCRIPTIONDETAIL\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntry", b => + { + b.Property("ApplicationId") + .HasColumnType("uuid") + .HasColumnName("application_id"); + + b.Property("ApplicationChecklistEntryTypeId") + .HasColumnType("integer") + .HasColumnName("application_checklist_entry_type_id"); + + b.Property("ApplicationChecklistEntryStatusId") + .HasColumnType("integer") + .HasColumnName("application_checklist_entry_status_id"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.HasKey("ApplicationId", "ApplicationChecklistEntryTypeId") + .HasName("pk_application_checklist"); + + b.HasIndex("ApplicationChecklistEntryStatusId") + .HasDatabaseName("ix_application_checklist_application_checklist_entry_status_id"); + + b.HasIndex("ApplicationChecklistEntryTypeId") + .HasDatabaseName("ix_application_checklist_application_checklist_entry_type_id"); + + b.ToTable("application_checklist", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_application_checklist_statuses"); + + b.ToTable("application_checklist_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TO_DO" + }, + new + { + Id = 2, + Label = "IN_PROGRESS" + }, + new + { + Id = 3, + Label = "DONE" + }, + new + { + Id = 4, + Label = "FAILED" + }, + new + { + Id = 5, + Label = "SKIPPED" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_application_checklist_types"); + + b.ToTable("application_checklist_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "REGISTRATION_VERIFICATION" + }, + new + { + Id = 2, + Label = "BUSINESS_PARTNER_NUMBER" + }, + new + { + Id = 3, + Label = "IDENTITY_WALLET" + }, + new + { + Id = 4, + Label = "BPNL_CREDENTIAL" + }, + new + { + Id = 5, + Label = "MEMBERSHIP_CREDENTIAL" + }, + new + { + Id = 6, + Label = "CLEARING_HOUSE" + }, + new + { + Id = 7, + Label = "SELF_DESCRIPTION_LP" + }, + new + { + Id = 8, + Label = "APPLICATION_ACTIVATION" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AuditOperation", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_audit_operation"); + + b.ToTable("audit_operation", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INSERT" + }, + new + { + Id = 2, + Label = "UPDATE" + }, + new + { + Id = 3, + Label = "DELETE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.BpdmIdentifier", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_bpdm_identifiers"); + + b.ToTable("bpdm_identifiers", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "EU_VAT_ID_DE" + }, + new + { + Id = 2, + Label = "CH_UID" + }, + new + { + Id = 3, + Label = "EU_VAT_ID_FR" + }, + new + { + Id = 4, + Label = "FR_SIREN" + }, + new + { + Id = 5, + Label = "EU_VAT_ID_AT" + }, + new + { + Id = 6, + Label = "DE_BNUM" + }, + new + { + Id = 7, + Label = "CZ_ICO" + }, + new + { + Id = 8, + Label = "EU_VAT_ID_CZ" + }, + new + { + Id = 9, + Label = "EU_VAT_ID_PL" + }, + new + { + Id = 10, + Label = "EU_VAT_ID_BE" + }, + new + { + Id = 11, + Label = "EU_VAT_ID_CH" + }, + new + { + Id = 12, + Label = "EU_VAT_ID_DK" + }, + new + { + Id = 13, + Label = "EU_VAT_ID_ES" + }, + new + { + Id = 14, + Label = "EU_VAT_ID_GB" + }, + new + { + Id = 15, + Label = "EU_VAT_ID_NO" + }, + new + { + Id = 16, + Label = "BE_ENT_NO" + }, + new + { + Id = 17, + Label = "CVR_DK" + }, + new + { + Id = 18, + Label = "ID_CRN" + }, + new + { + Id = 19, + Label = "NO_ORGID" + }, + new + { + Id = 20, + Label = "LEI_ID" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AddressId") + .HasColumnType("uuid") + .HasColumnName("address_id"); + + b.Property("BusinessPartnerNumber") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("business_partner_number"); + + b.Property("CompanyStatusId") + .HasColumnType("integer") + .HasColumnName("company_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DidDocumentLocation") + .HasColumnType("text") + .HasColumnName("did_document_location"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("SdCreationProcessId") + .HasColumnType("uuid") + .HasColumnName("sd_creation_process_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("Shortname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("shortname"); + + b.HasKey("Id") + .HasName("pk_companies"); + + b.HasIndex("AddressId") + .HasDatabaseName("ix_companies_address_id"); + + b.HasIndex("CompanyStatusId") + .HasDatabaseName("ix_companies_company_status_id"); + + b.HasIndex("SdCreationProcessId") + .IsUnique() + .HasDatabaseName("ix_companies_sd_creation_process_id"); + + b.HasIndex("SelfDescriptionDocumentId") + .HasDatabaseName("ix_companies_self_description_document_id"); + + b.ToTable("companies", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ApplicationStatusId") + .HasColumnType("integer") + .HasColumnName("application_status_id"); + + b.Property("ChecklistProcessId") + .HasColumnType("uuid") + .HasColumnName("checklist_process_id"); + + b.Property("CompanyApplicationTypeId") + .HasColumnType("integer") + .HasColumnName("company_application_type_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OnboardingServiceProviderId") + .HasColumnType("uuid") + .HasColumnName("onboarding_service_provider_id"); + + b.HasKey("Id") + .HasName("pk_company_applications"); + + b.HasIndex("ApplicationStatusId") + .HasDatabaseName("ix_company_applications_application_status_id"); + + b.HasIndex("ChecklistProcessId") + .HasDatabaseName("ix_company_applications_checklist_process_id"); + + b.HasIndex("CompanyApplicationTypeId") + .HasDatabaseName("ix_company_applications_company_application_type_id"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_company_applications_company_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_applications_last_editor_id"); + + b.HasIndex("OnboardingServiceProviderId") + .HasDatabaseName("ix_company_applications_onboarding_service_provider_id"); + + b.ToTable("company_applications", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_application20231115\" (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_id\", \"company_application_type_id\", \"onboarding_service_provider_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"application_status_id\", \r\n NEW.\"company_id\", \r\n NEW.\"checklist_process_id\", \r\n NEW.\"company_application_type_id\", \r\n NEW.\"onboarding_service_provider_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION AFTER INSERT\r\nON \"portal\".\"company_applications\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYAPPLICATION\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_application20231115\" (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_id\", \"company_application_type_id\", \"onboarding_service_provider_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"application_status_id\", \r\n NEW.\"company_id\", \r\n NEW.\"checklist_process_id\", \r\n NEW.\"company_application_type_id\", \r\n NEW.\"onboarding_service_provider_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION AFTER UPDATE\r\nON \"portal\".\"company_applications\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYAPPLICATION\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_application_statuses"); + + b.ToTable("company_application_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "CREATED" + }, + new + { + Id = 2, + Label = "ADD_COMPANY_DATA" + }, + new + { + Id = 3, + Label = "INVITE_USER" + }, + new + { + Id = 4, + Label = "SELECT_COMPANY_ROLE" + }, + new + { + Id = 5, + Label = "UPLOAD_DOCUMENTS" + }, + new + { + Id = 6, + Label = "VERIFY" + }, + new + { + Id = 7, + Label = "SUBMITTED" + }, + new + { + Id = 8, + Label = "CONFIRMED" + }, + new + { + Id = 9, + Label = "DECLINED" + }, + new + { + Id = 10, + Label = "CANCELLED_BY_CUSTOMER" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_application_types"); + + b.ToTable("company_application_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INTERNAL" + }, + new + { + Id = 2, + Label = "EXTERNAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyAssignedRole", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("CompanyId", "CompanyRoleId") + .HasName("pk_company_assigned_roles"); + + b.HasIndex("CompanyRoleId") + .HasDatabaseName("ix_company_assigned_roles_company_role_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_assigned_roles_last_editor_id"); + + b.ToTable("company_assigned_roles", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_assigned_role2023316\" (\"company_id\", \"company_role_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"company_id\", \r\n NEW.\"company_role_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE AFTER INSERT\r\nON \"portal\".\"company_assigned_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYASSIGNEDROLE\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_assigned_role2023316\" (\"company_id\", \"company_role_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"company_id\", \r\n NEW.\"company_role_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE AFTER UPDATE\r\nON \"portal\".\"company_assigned_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYASSIGNEDROLE\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyAssignedUseCase", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("CompanyId", "UseCaseId") + .HasName("pk_company_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .HasDatabaseName("ix_company_assigned_use_cases_use_case_id"); + + b.ToTable("company_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyCertificateStatusId") + .HasColumnType("integer") + .HasColumnName("company_certificate_status_id"); + + b.Property("CompanyCertificateTypeId") + .HasColumnType("integer") + .HasColumnName("company_certificate_type_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExternalCertificateNumber") + .HasColumnType("text") + .HasColumnName("external_certificate_number"); + + b.Property("Issuer") + .HasColumnType("text") + .HasColumnName("issuer"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("TrustLevel") + .HasColumnType("text") + .HasColumnName("trust_level"); + + b.Property("ValidFrom") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_from"); + + b.Property("ValidTill") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_till"); + + b.Property("Validator") + .HasColumnType("text") + .HasColumnName("validator"); + + b.HasKey("Id") + .HasName("pk_company_certificates"); + + b.HasIndex("CompanyCertificateStatusId") + .HasDatabaseName("ix_company_certificates_company_certificate_status_id"); + + b.HasIndex("CompanyCertificateTypeId") + .HasDatabaseName("ix_company_certificates_company_certificate_type_id"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_company_certificates_company_id"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_company_certificates_document_id"); + + b.ToTable("company_certificates", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_certificate_management20240416\" (\"id\", \"valid_from\", \"valid_till\", \"company_certificate_type_id\", \"company_certificate_status_id\", \"company_id\", \"document_id\", \"external_certificate_number\", \"issuer\", \"trust_level\", \"validator\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"valid_from\", \r\n NEW.\"valid_till\", \r\n NEW.\"company_certificate_type_id\", \r\n NEW.\"company_certificate_status_id\", \r\n NEW.\"company_id\", \r\n NEW.\"document_id\", \r\n NEW.\"external_certificate_number\", \r\n NEW.\"issuer\", \r\n NEW.\"trust_level\", \r\n NEW.\"validator\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE AFTER INSERT\r\nON \"portal\".\"company_certificates\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYCERTIFICATE\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_certificate_management20240416\" (\"id\", \"valid_from\", \"valid_till\", \"company_certificate_type_id\", \"company_certificate_status_id\", \"company_id\", \"document_id\", \"external_certificate_number\", \"issuer\", \"trust_level\", \"validator\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"valid_from\", \r\n NEW.\"valid_till\", \r\n NEW.\"company_certificate_type_id\", \r\n NEW.\"company_certificate_status_id\", \r\n NEW.\"company_id\", \r\n NEW.\"document_id\", \r\n NEW.\"external_certificate_number\", \r\n NEW.\"issuer\", \r\n NEW.\"trust_level\", \r\n NEW.\"validator\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE AFTER UPDATE\r\nON \"portal\".\"company_certificates\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYCERTIFICATE\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateAssignedSite", b => + { + b.Property("CompanyCertificateId") + .HasColumnType("uuid") + .HasColumnName("company_certificate_id"); + + b.Property("Site") + .HasColumnType("text") + .HasColumnName("site"); + + b.HasKey("CompanyCertificateId", "Site") + .HasName("pk_company_certificate_assigned_sites"); + + b.ToTable("company_certificate_assigned_sites", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_certificate_statuses"); + + b.ToTable("company_certificate_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE" + }, + new + { + Id = 2, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_certificate_types"); + + b.ToTable("company_certificate_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "AEO_CTPAT_Security_Declaration" + }, + new + { + Id = 2, + Label = "ISO_9001" + }, + new + { + Id = 3, + Label = "IATF_16949" + }, + new + { + Id = 4, + Label = "ISO_14001_EMAS_or_national_certification" + }, + new + { + Id = 5, + Label = "ISO_45001_OHSAS_18001_or_national_certification" + }, + new + { + Id = 6, + Label = "ISO_IEC_27001" + }, + new + { + Id = 7, + Label = "ISO_50001_or_national_certification" + }, + new + { + Id = 8, + Label = "ISO_IEC_17025" + }, + new + { + Id = 9, + Label = "ISO_15504_SPICE" + }, + new + { + Id = 10, + Label = "B_BBEE_Certificate_of_South_Africa" + }, + new + { + Id = 11, + Label = "IATF" + }, + new + { + Id = 12, + Label = "TISAX" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeAssignedStatus", b => + { + b.Property("CompanyCertificateTypeId") + .HasColumnType("integer") + .HasColumnName("company_certificate_type_id"); + + b.Property("CompanyCertificateTypeStatusId") + .HasColumnType("integer") + .HasColumnName("company_certificate_type_status_id"); + + b.HasKey("CompanyCertificateTypeId") + .HasName("pk_company_certificate_type_assigned_statuses"); + + b.HasIndex("CompanyCertificateTypeStatusId") + .HasDatabaseName("ix_company_certificate_type_assigned_statuses_company_certific"); + + b.ToTable("company_certificate_type_assigned_statuses", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeDescription", b => + { + b.Property("CompanyCertificateTypeId") + .HasColumnType("integer") + .HasColumnName("company_certificate_type_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasColumnName("description"); + + b.HasKey("CompanyCertificateTypeId", "LanguageShortName") + .HasName("pk_company_certificate_type_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_company_certificate_type_descriptions_language_short_name"); + + b.ToTable("company_certificate_type_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_certificate_type_statuses"); + + b.ToTable("company_certificate_type_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE" + }, + new + { + Id = 2, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyIdentifier", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("UniqueIdentifierId") + .HasColumnType("integer") + .HasColumnName("unique_identifier_id"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("CompanyId", "UniqueIdentifierId") + .HasName("pk_company_identifiers"); + + b.HasIndex("UniqueIdentifierId") + .HasDatabaseName("ix_company_identifiers_unique_identifier_id"); + + b.ToTable("company_identifiers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyIdentityProvider", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("IdentityProviderId") + .HasColumnType("uuid") + .HasColumnName("identity_provider_id"); + + b.HasKey("CompanyId", "IdentityProviderId") + .HasName("pk_company_identity_providers"); + + b.HasIndex("IdentityProviderId") + .HasDatabaseName("ix_company_identity_providers_identity_provider_id"); + + b.ToTable("company_identity_providers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ApplicationId") + .HasColumnType("uuid") + .HasColumnName("application_id"); + + b.Property("ClientId") + .HasColumnType("text") + .HasColumnName("client_id"); + + b.Property("ClientSecret") + .HasColumnType("bytea") + .HasColumnName("client_secret"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("IdpName") + .HasColumnType("text") + .HasColumnName("idp_name"); + + b.Property("InitializationVector") + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("OrganisationName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("organisation_name"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("ServiceAccountUserId") + .HasColumnType("text") + .HasColumnName("service_account_user_id"); + + b.Property("UserName") + .HasColumnType("text") + .HasColumnName("user_name"); + + b.HasKey("Id") + .HasName("pk_company_invitations"); + + b.HasIndex("ApplicationId") + .IsUnique() + .HasDatabaseName("ix_company_invitations_application_id"); + + b.HasIndex("ProcessId") + .IsUnique() + .HasDatabaseName("ix_company_invitations_process_id"); + + b.ToTable("company_invitations", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_roles"); + + b.ToTable("company_roles", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE_PARTICIPANT" + }, + new + { + Id = 2, + Label = "APP_PROVIDER" + }, + new + { + Id = 3, + Label = "SERVICE_PROVIDER" + }, + new + { + Id = 4, + Label = "OPERATOR" + }, + new + { + Id = 5, + Label = "ONBOARDING_SERVICE_PROVIDER" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("UserRoleCollectionId") + .HasColumnType("uuid") + .HasColumnName("user_role_collection_id"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_assigned_role_collections"); + + b.HasIndex("UserRoleCollectionId") + .IsUnique() + .HasDatabaseName("ix_company_role_assigned_role_collections_user_role_collection"); + + b.ToTable("company_role_assigned_role_collections", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleDescription", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.HasKey("CompanyRoleId", "LanguageShortName") + .HasName("pk_company_role_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_company_role_descriptions_language_short_name"); + + b.ToTable("company_role_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("IsRegistrationRole") + .HasColumnType("boolean") + .HasColumnName("is_registration_role"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_registration_data"); + + b.ToTable("company_role_registration_data", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_id"); + + b.Property("CompanyServiceAccountKindId") + .HasColumnType("integer") + .HasColumnName("company_service_account_kind_id"); + + b.Property("CompanyServiceAccountTypeId") + .HasColumnType("integer") + .HasColumnName("company_service_account_type_id"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_company_service_accounts"); + + b.HasIndex("ClientClientId") + .HasDatabaseName("ix_company_service_accounts_client_client_id") + .HasFilter("client_client_id is not null AND company_service_account_kind_id = 1"); + + b.HasIndex("CompanyServiceAccountKindId") + .HasDatabaseName("ix_company_service_accounts_company_service_account_kind_id"); + + b.HasIndex("CompanyServiceAccountTypeId") + .HasDatabaseName("ix_company_service_accounts_company_service_account_type_id"); + + b.HasIndex("OfferSubscriptionId") + .HasDatabaseName("ix_company_service_accounts_offer_subscription_id"); + + b.ToTable("company_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountKind", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_service_account_kindes"); + + b.ToTable("company_service_account_kindes", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INTERNAL" + }, + new + { + Id = 2, + Label = "EXTERNAL" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_service_account_types"); + + b.ToTable("company_service_account_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "MANAGED" + }, + new + { + Id = 2, + Label = "OWN" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_company_statuses"); + + b.ToTable("company_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "ACTIVE" + }, + new + { + Id = 3, + Label = "REJECTED" + }, + new + { + Id = 4, + Label = "INACTIVE" + }, + new + { + Id = 5, + Label = "DELETED" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email"); + + b.Property("Firstname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("firstname"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Lastlogin") + .HasColumnType("bytea") + .HasColumnName("lastlogin"); + + b.Property("Lastname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("lastname"); + + b.HasKey("Id") + .HasName("pk_company_users"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_users_last_editor_id"); + + b.ToTable("company_users", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_COMPANYUSER"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_COMPANYUSER"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYUSER", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYUSER\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYUSER$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_user20230523\" (\"id\", \"email\", \"firstname\", \"lastlogin\", \"lastname\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"email\", \r\n NEW.\"firstname\", \r\n NEW.\"lastlogin\", \r\n NEW.\"lastname\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYUSER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYUSER AFTER INSERT\r\nON \"portal\".\"company_users\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_COMPANYUSER\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYUSER", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYUSER\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYUSER$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_company_user20230523\" (\"id\", \"email\", \"firstname\", \"lastlogin\", \"lastname\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"email\", \r\n NEW.\"firstname\", \r\n NEW.\"lastlogin\", \r\n NEW.\"lastname\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYUSER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYUSER AFTER UPDATE\r\nON \"portal\".\"company_users\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_COMPANYUSER\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedAppFavourite", b => + { + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.HasKey("CompanyUserId", "AppId") + .HasName("pk_company_user_assigned_app_favourites"); + + b.HasIndex("AppId") + .HasDatabaseName("ix_company_user_assigned_app_favourites_app_id"); + + b.ToTable("company_user_assigned_app_favourites", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedBusinessPartner", b => + { + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("BusinessPartnerNumber") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("business_partner_number"); + + b.HasKey("CompanyUserId", "BusinessPartnerNumber") + .HasName("pk_company_user_assigned_business_partners"); + + b.ToTable("company_user_assigned_business_partners", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedIdentityProvider", b => + { + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("IdentityProviderId") + .HasColumnType("uuid") + .HasColumnName("identity_provider_id"); + + b.Property("ProviderId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("provider_id"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("user_name"); + + b.HasKey("CompanyUserId", "IdentityProviderId") + .HasName("pk_company_user_assigned_identity_providers"); + + b.HasIndex("IdentityProviderId") + .HasDatabaseName("ix_company_user_assigned_identity_providers_identity_provider_"); + + b.ToTable("company_user_assigned_identity_providers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedProcess", b => + { + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.HasKey("CompanyUserId", "ProcessId") + .HasName("pk_company_user_assigned_processes"); + + b.HasIndex("CompanyUserId") + .IsUnique() + .HasDatabaseName("ix_company_user_assigned_processes_company_user_id"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_company_user_assigned_processes_process_id"); + + b.ToTable("company_user_assigned_processes", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyWalletData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AuthenticationServiceUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("authentication_service_url"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("client_id"); + + b.Property("ClientSecret") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("client_secret"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("Did") + .IsRequired() + .HasColumnType("text") + .HasColumnName("did"); + + b.Property("DidDocument") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("did_document"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("InitializationVector") + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.HasKey("Id") + .HasName("pk_company_wallet_datas"); + + b.HasIndex("CompanyId") + .IsUnique() + .HasDatabaseName("ix_company_wallet_datas_company_id"); + + b.ToTable("company_wallet_datas", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("HostId") + .HasColumnType("uuid") + .HasColumnName("host_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LocationId") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("location_id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("ProviderId") + .HasColumnType("uuid") + .HasColumnName("provider_id"); + + b.Property("SdCreationProcessId") + .HasColumnType("uuid") + .HasColumnName("sd_creation_process_id"); + + b.Property("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("Id") + .HasName("pk_connectors"); + + b.HasIndex("CompanyServiceAccountId") + .IsUnique() + .HasDatabaseName("ix_connectors_company_service_account_id"); + + b.HasIndex("HostId") + .HasDatabaseName("ix_connectors_host_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_connectors_last_editor_id"); + + b.HasIndex("LocationId") + .HasDatabaseName("ix_connectors_location_id"); + + b.HasIndex("ProviderId") + .HasDatabaseName("ix_connectors_provider_id"); + + b.HasIndex("SdCreationProcessId") + .IsUnique() + .HasDatabaseName("ix_connectors_sd_creation_process_id"); + + b.HasIndex("SelfDescriptionDocumentId") + .IsUnique() + .HasDatabaseName("ix_connectors_self_description_document_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("ix_connectors_status_id"); + + b.HasIndex("TypeId") + .HasDatabaseName("ix_connectors_type_id"); + + b.ToTable("connectors", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_CONNECTOR"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_CONNECTOR"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_CONNECTOR", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONNECTOR\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_connector20240814\" (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"sd_creation_process_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"name\", \r\n NEW.\"connector_url\", \r\n NEW.\"type_id\", \r\n NEW.\"status_id\", \r\n NEW.\"provider_id\", \r\n NEW.\"host_id\", \r\n NEW.\"self_description_document_id\", \r\n NEW.\"location_id\", \r\n NEW.\"self_description_message\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"company_service_account_id\", \r\n NEW.\"sd_creation_process_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON \"portal\".\"connectors\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONNECTOR\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_CONNECTOR", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONNECTOR\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_connector20240814\" (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"sd_creation_process_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"name\", \r\n NEW.\"connector_url\", \r\n NEW.\"type_id\", \r\n NEW.\"status_id\", \r\n NEW.\"provider_id\", \r\n NEW.\"host_id\", \r\n NEW.\"self_description_document_id\", \r\n NEW.\"location_id\", \r\n NEW.\"self_description_message\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"company_service_account_id\", \r\n NEW.\"sd_creation_process_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_CONNECTOR AFTER UPDATE\r\nON \"portal\".\"connectors\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONNECTOR\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorAssignedOfferSubscription", b => + { + b.Property("ConnectorId") + .HasColumnType("uuid") + .HasColumnName("connector_id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.HasKey("ConnectorId", "OfferSubscriptionId") + .HasName("pk_connector_assigned_offer_subscriptions"); + + b.HasIndex("OfferSubscriptionId") + .HasDatabaseName("ix_connector_assigned_offer_subscriptions_offer_subscription_id"); + + b.ToTable("connector_assigned_offer_subscriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_connector_statuses"); + + b.ToTable("connector_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "ACTIVE" + }, + new + { + Id = 3, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_connector_types"); + + b.ToTable("connector_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMPANY_CONNECTOR" + }, + new + { + Id = 2, + Label = "CONNECTOR_AS_A_SERVICE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Consent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("ConsentStatusId") + .HasColumnType("integer") + .HasColumnName("consent_status_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("Target") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("target"); + + b.HasKey("Id") + .HasName("pk_consents"); + + b.HasIndex("AgreementId") + .HasDatabaseName("ix_consents_agreement_id"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_consents_company_id"); + + b.HasIndex("CompanyUserId") + .HasDatabaseName("ix_consents_company_user_id"); + + b.HasIndex("ConsentStatusId") + .HasDatabaseName("ix_consents_consent_status_id"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_consents_document_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_consents_last_editor_id"); + + b.ToTable("consents", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_CONSENT"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_CONSENT"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_CONSENT", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONSENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONSENT$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_consent20231115\" (\"id\", \"date_created\", \"comment\", \"consent_status_id\", \"target\", \"agreement_id\", \"company_id\", \"document_id\", \"company_user_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"comment\", \r\n NEW.\"consent_status_id\", \r\n NEW.\"target\", \r\n NEW.\"agreement_id\", \r\n NEW.\"company_id\", \r\n NEW.\"document_id\", \r\n NEW.\"company_user_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONSENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONSENT AFTER INSERT\r\nON \"portal\".\"consents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONSENT\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_CONSENT", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONSENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_CONSENT$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_consent20231115\" (\"id\", \"date_created\", \"comment\", \"consent_status_id\", \"target\", \"agreement_id\", \"company_id\", \"document_id\", \"company_user_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"comment\", \r\n NEW.\"consent_status_id\", \r\n NEW.\"target\", \r\n NEW.\"agreement_id\", \r\n NEW.\"company_id\", \r\n NEW.\"document_id\", \r\n NEW.\"company_user_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_CONSENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_CONSENT AFTER UPDATE\r\nON \"portal\".\"consents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONSENT\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentAssignedOffer", b => + { + b.Property("ConsentId") + .HasColumnType("uuid") + .HasColumnName("consent_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.HasKey("ConsentId", "OfferId") + .HasName("pk_consent_assigned_offers"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_consent_assigned_offers_offer_id"); + + b.ToTable("consent_assigned_offers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentAssignedOfferSubscription", b => + { + b.Property("ConsentId") + .HasColumnType("uuid") + .HasColumnName("consent_id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.HasKey("ConsentId", "OfferSubscriptionId") + .HasName("pk_consent_assigned_offer_subscriptions"); + + b.HasIndex("OfferSubscriptionId") + .HasDatabaseName("ix_consent_assigned_offer_subscriptions_offer_subscription_id"); + + b.ToTable("consent_assigned_offer_subscriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_consent_statuses"); + + b.ToTable("consent_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE" + }, + new + { + Id = 2, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", b => + { + b.Property("Alpha2Code") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("alpha2code") + .IsFixedLength() + .HasAnnotation("Relational:JsonPropertyName", "alpha2code"); + + b.Property("Alpha3Code") + .HasMaxLength(3) + .HasColumnType("character(3)") + .HasColumnName("alpha3code") + .IsFixedLength() + .HasAnnotation("Relational:JsonPropertyName", "alpha3code"); + + b.HasKey("Alpha2Code") + .HasName("pk_countries"); + + b.ToTable("countries", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CountryAssignedIdentifier", b => + { + b.Property("CountryAlpha2Code") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("country_alpha2code") + .HasAnnotation("Relational:JsonPropertyName", "country_alpha2code"); + + b.Property("UniqueIdentifierId") + .HasColumnType("integer") + .HasColumnName("unique_identifier_id"); + + b.Property("BpdmIdentifierId") + .HasColumnType("integer") + .HasColumnName("bpdm_identifier_id"); + + b.HasKey("CountryAlpha2Code", "UniqueIdentifierId") + .HasName("pk_country_assigned_identifiers"); + + b.HasIndex("BpdmIdentifierId") + .HasDatabaseName("ix_country_assigned_identifiers_bpdm_identifier_id"); + + b.HasIndex("UniqueIdentifierId") + .HasDatabaseName("ix_country_assigned_identifiers_unique_identifier_id"); + + b.ToTable("country_assigned_identifiers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CountryLongName", b => + { + b.Property("Alpha2Code") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("alpha2code") + .HasAnnotation("Relational:JsonPropertyName", "alpha2code"); + + b.Property("ShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("short_name"); + + b.Property("LongName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("long_name"); + + b.HasKey("Alpha2Code", "ShortName") + .HasName("pk_country_long_names"); + + b.HasIndex("ShortName") + .HasDatabaseName("ix_country_long_names_short_name"); + + b.ToTable("country_long_names", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimCompanyServiceAccount", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AuthenticationServiceUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("authentication_service_url"); + + b.Property("ClientSecret") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("client_secret"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("InitializationVector") + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.HasKey("Id") + .HasName("pk_dim_company_service_accounts"); + + b.ToTable("dim_company_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("ServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("service_account_id"); + + b.HasKey("Id") + .HasName("pk_dim_user_creation_data"); + + b.HasIndex("ProcessId") + .IsUnique() + .HasDatabaseName("ix_dim_user_creation_data_process_id"); + + b.HasIndex("ServiceAccountId") + .IsUnique() + .HasDatabaseName("ix_dim_user_creation_data_service_account_id"); + + b.ToTable("dim_user_creation_data", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DocumentContent") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_content"); + + b.Property("DocumentHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("document_hash"); + + b.Property("DocumentName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("document_name"); + + b.Property("DocumentStatusId") + .HasColumnType("integer") + .HasColumnName("document_status_id"); + + b.Property("DocumentTypeId") + .HasColumnType("integer") + .HasColumnName("document_type_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("MediaTypeId") + .HasColumnType("integer") + .HasColumnName("media_type_id"); + + b.HasKey("Id") + .HasName("pk_documents"); + + b.HasIndex("CompanyUserId") + .HasDatabaseName("ix_documents_company_user_id"); + + b.HasIndex("DocumentStatusId") + .HasDatabaseName("ix_documents_document_status_id"); + + b.HasIndex("DocumentTypeId") + .HasDatabaseName("ix_documents_document_type_id"); + + b.HasIndex("MediaTypeId") + .HasDatabaseName("ix_documents_media_type_id"); + + b.ToTable("documents", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_DOCUMENT"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_DOCUMENT"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_DOCUMENT", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_DOCUMENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_DOCUMENT$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_document20231115\" (\"id\", \"date_created\", \"document_hash\", \"document_content\", \"document_name\", \"media_type_id\", \"document_type_id\", \"document_status_id\", \"company_user_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"document_hash\", \r\n NEW.\"document_content\", \r\n NEW.\"document_name\", \r\n NEW.\"media_type_id\", \r\n NEW.\"document_type_id\", \r\n NEW.\"document_status_id\", \r\n NEW.\"company_user_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_DOCUMENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_DOCUMENT AFTER INSERT\r\nON \"portal\".\"documents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_DOCUMENT\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_DOCUMENT", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_DOCUMENT\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_DOCUMENT$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_document20231115\" (\"id\", \"date_created\", \"document_hash\", \"document_content\", \"document_name\", \"media_type_id\", \"document_type_id\", \"document_status_id\", \"company_user_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"document_hash\", \r\n NEW.\"document_content\", \r\n NEW.\"document_name\", \r\n NEW.\"media_type_id\", \r\n NEW.\"document_type_id\", \r\n NEW.\"document_status_id\", \r\n NEW.\"company_user_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_DOCUMENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_DOCUMENT AFTER UPDATE\r\nON \"portal\".\"documents\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_DOCUMENT\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_document_status"); + + b.ToTable("document_status", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "LOCKED" + }, + new + { + Id = 3, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_document_types"); + + b.ToTable("document_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "CX_FRAME_CONTRACT" + }, + new + { + Id = 2, + Label = "COMMERCIAL_REGISTER_EXTRACT" + }, + new + { + Id = 3, + Label = "APP_CONTRACT" + }, + new + { + Id = 4, + Label = "CONFORMITY_APPROVAL_REGISTRATION" + }, + new + { + Id = 5, + Label = "ADDITIONAL_DETAILS" + }, + new + { + Id = 6, + Label = "APP_LEADIMAGE" + }, + new + { + Id = 7, + Label = "APP_IMAGE" + }, + new + { + Id = 8, + Label = "SELF_DESCRIPTION" + }, + new + { + Id = 9, + Label = "APP_TECHNICAL_INFORMATION" + }, + new + { + Id = 10, + Label = "CONFORMITY_APPROVAL_CONNECTOR" + }, + new + { + Id = 11, + Label = "CONFORMITY_APPROVAL_BUSINESS_APPS" + }, + new + { + Id = 12, + Label = "CONFORMITY_APPROVAL_SERVICES" + }, + new + { + Id = 13, + Label = "SERVICE_LEADIMAGE" + }, + new + { + Id = 14, + Label = "PRESENTATION" + }, + new + { + Id = 15, + Label = "COMPANY_CERTIFICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_id"); + + b.HasKey("Id") + .HasName("pk_iam_clients"); + + b.HasIndex("ClientClientId") + .IsUnique() + .HasDatabaseName("ix_iam_clients_client_client_id"); + + b.ToTable("iam_clients", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => + { + b.Property("IamIdpAlias") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("iam_idp_alias"); + + b.Property("IdentityProviderId") + .HasColumnType("uuid") + .HasColumnName("identity_provider_id"); + + b.Property("MetadataUrl") + .HasColumnType("text") + .HasColumnName("metadata_url"); + + b.HasKey("IamIdpAlias") + .HasName("pk_iam_identity_providers"); + + b.HasIndex("IdentityProviderId") + .IsUnique() + .HasDatabaseName("ix_iam_identity_providers_identity_provider_id"); + + b.ToTable("iam_identity_providers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("IdentityTypeId") + .HasColumnType("integer") + .HasColumnName("identity_type_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("UserEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("user_entity_id"); + + b.Property("UserStatusId") + .HasColumnType("integer") + .HasColumnName("user_status_id") + .HasAnnotation("Relational:JsonPropertyName", "user_status_id"); + + b.HasKey("Id") + .HasName("pk_identities"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_identities_company_id"); + + b.HasIndex("IdentityTypeId") + .HasDatabaseName("ix_identities_identity_type_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_identities_last_editor_id"); + + b.HasIndex("UserEntityId") + .IsUnique() + .HasDatabaseName("ix_identities_user_entity_id"); + + b.HasIndex("UserStatusId") + .HasDatabaseName("ix_identities_user_status_id"); + + b.ToTable("identities", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_IDENTITY"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_IDENTITY"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_IDENTITY", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_IDENTITY\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_IDENTITY$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_identity20231115\" (\"id\", \"date_created\", \"company_id\", \"user_status_id\", \"user_entity_id\", \"identity_type_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"company_id\", \r\n NEW.\"user_status_id\", \r\n NEW.\"user_entity_id\", \r\n NEW.\"identity_type_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_IDENTITY$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_IDENTITY AFTER INSERT\r\nON \"portal\".\"identities\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_IDENTITY\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_IDENTITY", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_IDENTITY\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_IDENTITY$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_identity20231115\" (\"id\", \"date_created\", \"company_id\", \"user_status_id\", \"user_entity_id\", \"identity_type_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"company_id\", \r\n NEW.\"user_status_id\", \r\n NEW.\"user_entity_id\", \r\n NEW.\"identity_type_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_IDENTITY$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_IDENTITY AFTER UPDATE\r\nON \"portal\".\"identities\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_IDENTITY\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityAssignedRole", b => + { + b.Property("IdentityId") + .HasColumnType("uuid") + .HasColumnName("identity_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("IdentityId", "UserRoleId") + .HasName("pk_identity_assigned_roles"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_identity_assigned_roles_last_editor_id"); + + b.HasIndex("UserRoleId") + .HasDatabaseName("ix_identity_assigned_roles_user_role_id"); + + b.ToTable("identity_assigned_roles", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_identity_assigned_role20230522\" (\"identity_id\", \"user_role_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"identity_id\", \r\n NEW.\"user_role_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE AFTER INSERT\r\nON \"portal\".\"identity_assigned_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_IDENTITYASSIGNEDROLE\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_identity_assigned_role20230522\" (\"identity_id\", \"user_role_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"identity_id\", \r\n NEW.\"user_role_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE AFTER UPDATE\r\nON \"portal\".\"identity_assigned_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_IDENTITYASSIGNEDROLE\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("IdentityProviderCategoryId") + .HasColumnType("integer") + .HasColumnName("identity_provider_category_id"); + + b.Property("IdentityProviderTypeId") + .HasColumnType("integer") + .HasColumnName("identity_provider_type_id"); + + b.Property("OwnerId") + .HasColumnType("uuid") + .HasColumnName("owner_id"); + + b.HasKey("Id") + .HasName("pk_identity_providers"); + + b.HasIndex("IdentityProviderCategoryId") + .HasDatabaseName("ix_identity_providers_identity_provider_category_id"); + + b.HasIndex("IdentityProviderTypeId") + .HasDatabaseName("ix_identity_providers_identity_provider_type_id"); + + b.HasIndex("OwnerId") + .HasDatabaseName("ix_identity_providers_owner_id"); + + b.ToTable("identity_providers", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderAssignedProcess", b => + { + b.Property("IdentityProviderId") + .HasColumnType("uuid") + .HasColumnName("identity_provider_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.HasKey("IdentityProviderId", "ProcessId") + .HasName("pk_identity_provider_assigned_processes"); + + b.HasIndex("IdentityProviderId") + .IsUnique() + .HasDatabaseName("ix_identity_provider_assigned_processes_identity_provider_id"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_identity_provider_assigned_processes_process_id"); + + b.ToTable("identity_provider_assigned_processes", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderCategory", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_identity_provider_categories"); + + b.ToTable("identity_provider_categories", "portal"); + + b.HasData( + new + { + Id = 2, + Label = "KEYCLOAK_OIDC" + }, + new + { + Id = 3, + Label = "KEYCLOAK_SAML" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_identity_provider_types"); + + b.ToTable("identity_provider_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "OWN" + }, + new + { + Id = 2, + Label = "MANAGED" + }, + new + { + Id = 3, + Label = "SHARED" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_identity_type"); + + b.ToTable("identity_type", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMPANY_USER" + }, + new + { + Id = 2, + Label = "COMPANY_SERVICE_ACCOUNT" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_identity_user_statuses"); + + b.ToTable("identity_user_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "ACTIVE" + }, + new + { + Id = 2, + Label = "INACTIVE" + }, + new + { + Id = 3, + Label = "DELETED" + }, + new + { + Id = 4, + Label = "PENDING" + }, + new + { + Id = 5, + Label = "PENDING_DELETION" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Invitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyApplicationId") + .HasColumnType("uuid") + .HasColumnName("company_application_id"); + + b.Property("CompanyUserId") + .HasColumnType("uuid") + .HasColumnName("company_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("InvitationStatusId") + .HasColumnType("integer") + .HasColumnName("invitation_status_id"); + + b.HasKey("Id") + .HasName("pk_invitations"); + + b.HasIndex("CompanyApplicationId") + .HasDatabaseName("ix_invitations_company_application_id"); + + b.HasIndex("CompanyUserId") + .HasDatabaseName("ix_invitations_company_user_id"); + + b.HasIndex("InvitationStatusId") + .HasDatabaseName("ix_invitations_invitation_status_id"); + + b.ToTable("invitations", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.InvitationStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_invitation_statuses"); + + b.ToTable("invitation_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "CREATED" + }, + new + { + Id = 2, + Label = "PENDING" + }, + new + { + Id = 3, + Label = "ACCEPTED" + }, + new + { + Id = 4, + Label = "DECLINED" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", b => + { + b.Property("ShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("short_name") + .IsFixedLength(); + + b.HasKey("ShortName") + .HasName("pk_languages"); + + b.ToTable("languages", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.LanguageLongName", b => + { + b.Property("ShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("short_name") + .IsFixedLength(); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name") + .IsFixedLength(); + + b.Property("LongName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("long_name"); + + b.HasKey("ShortName", "LanguageShortName") + .HasName("pk_language_long_names"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_language_long_names_language_short_name"); + + b.ToTable("language_long_names", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.LicenseType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_license_types"); + + b.ToTable("license_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COTS" + }, + new + { + Id = 2, + Label = "FOSS" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingInformation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("InitializationVector") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.Property("MailParameters") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("mail_parameters"); + + b.Property("MailingStatusId") + .HasColumnType("integer") + .HasColumnName("mailing_status_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("Template") + .IsRequired() + .HasColumnType("text") + .HasColumnName("template"); + + b.HasKey("Id") + .HasName("pk_mailing_informations"); + + b.HasIndex("MailingStatusId") + .HasDatabaseName("ix_mailing_informations_mailing_status_id"); + + b.HasIndex("ProcessId") + .IsUnique() + .HasDatabaseName("ix_mailing_informations_process_id"); + + b.ToTable("mailing_informations", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_mailing_statuses"); + + b.ToTable("mailing_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "SENT" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_media_types"); + + b.ToTable("media_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "JPEG" + }, + new + { + Id = 2, + Label = "GIF" + }, + new + { + Id = 3, + Label = "PNG" + }, + new + { + Id = 4, + Label = "SVG" + }, + new + { + Id = 5, + Label = "TIFF" + }, + new + { + Id = 6, + Label = "PDF" + }, + new + { + Id = 7, + Label = "JSON" + }, + new + { + Id = 8, + Label = "PEM" + }, + new + { + Id = 9, + Label = "CA_CERT" + }, + new + { + Id = 10, + Label = "PKX_CER" + }, + new + { + Id = 11, + Label = "OCTET" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ApplicationId") + .HasColumnType("uuid") + .HasColumnName("application_id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("ExternalId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("external_id"); + + b.Property("OnboardingServiceProviderId") + .HasColumnType("uuid") + .HasColumnName("onboarding_service_provider_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.HasKey("Id") + .HasName("pk_network_registrations"); + + b.HasIndex("ApplicationId") + .IsUnique() + .HasDatabaseName("ix_network_registrations_application_id"); + + b.HasIndex("CompanyId") + .IsUnique() + .HasDatabaseName("ix_network_registrations_company_id"); + + b.HasIndex("OnboardingServiceProviderId") + .HasDatabaseName("ix_network_registrations_onboarding_service_provider_id"); + + b.HasIndex("ProcessId") + .IsUnique() + .HasDatabaseName("ix_network_registrations_process_id"); + + b.HasIndex("ExternalId", "OnboardingServiceProviderId") + .IsUnique() + .HasDatabaseName("ix_network_registrations_external_id_onboarding_service_provid"); + + b.ToTable("network_registrations", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_user_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("Done") + .HasColumnType("boolean") + .HasColumnName("done"); + + b.Property("DueDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("due_date"); + + b.Property("IsRead") + .HasColumnType("boolean") + .HasColumnName("is_read"); + + b.Property("NotificationTypeId") + .HasColumnType("integer") + .HasColumnName("notification_type_id"); + + b.Property("ReceiverUserId") + .HasColumnType("uuid") + .HasColumnName("receiver_user_id"); + + b.HasKey("Id") + .HasName("pk_notifications"); + + b.HasIndex("CreatorUserId") + .HasDatabaseName("ix_notifications_creator_user_id"); + + b.HasIndex("NotificationTypeId") + .HasDatabaseName("ix_notifications_notification_type_id"); + + b.HasIndex("ReceiverUserId") + .HasDatabaseName("ix_notifications_receiver_user_id"); + + b.ToTable("notifications", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_notification_topic"); + + b.ToTable("notification_topic", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INFO" + }, + new + { + Id = 2, + Label = "ACTION" + }, + new + { + Id = 3, + Label = "OFFER" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_notification_type"); + + b.ToTable("notification_type", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INFO" + }, + new + { + Id = 2, + Label = "ACTION" + }, + new + { + Id = 3, + Label = "WELCOME" + }, + new + { + Id = 4, + Label = "WELCOME_USE_CASES" + }, + new + { + Id = 5, + Label = "WELCOME_SERVICE_PROVIDER" + }, + new + { + Id = 6, + Label = "WELCOME_CONNECTOR_REGISTRATION" + }, + new + { + Id = 7, + Label = "WELCOME_APP_MARKETPLACE" + }, + new + { + Id = 8, + Label = "APP_SUBSCRIPTION_REQUEST" + }, + new + { + Id = 9, + Label = "APP_SUBSCRIPTION_ACTIVATION" + }, + new + { + Id = 10, + Label = "CONNECTOR_REGISTERED" + }, + new + { + Id = 11, + Label = "APP_RELEASE_REQUEST" + }, + new + { + Id = 12, + Label = "TECHNICAL_USER_CREATION" + }, + new + { + Id = 13, + Label = "SERVICE_REQUEST" + }, + new + { + Id = 14, + Label = "SERVICE_ACTIVATION" + }, + new + { + Id = 15, + Label = "APP_ROLE_ADDED" + }, + new + { + Id = 16, + Label = "APP_RELEASE_APPROVAL" + }, + new + { + Id = 17, + Label = "SERVICE_RELEASE_REQUEST" + }, + new + { + Id = 18, + Label = "SERVICE_RELEASE_APPROVAL" + }, + new + { + Id = 19, + Label = "APP_RELEASE_REJECTION" + }, + new + { + Id = 20, + Label = "SERVICE_RELEASE_REJECTION" + }, + new + { + Id = 21, + Label = "ROLE_UPDATE_CORE_OFFER" + }, + new + { + Id = 22, + Label = "ROLE_UPDATE_APP_OFFER" + }, + new + { + Id = 23, + Label = "SUBSCRIPTION_URL_UPDATE" + }, + new + { + Id = 24, + Label = "CREDENTIAL_APPROVAL" + }, + new + { + Id = 25, + Label = "CREDENTIAL_REJECTED" + }, + new + { + Id = 26, + Label = "CREDENTIAL_EXPIRY" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTypeAssignedTopic", b => + { + b.Property("NotificationTypeId") + .HasColumnType("integer") + .HasColumnName("notification_type_id"); + + b.Property("NotificationTopicId") + .HasColumnType("integer") + .HasColumnName("notification_topic_id"); + + b.HasKey("NotificationTypeId", "NotificationTopicId") + .HasName("pk_notification_type_assigned_topics"); + + b.HasIndex("NotificationTopicId") + .HasDatabaseName("ix_notification_type_assigned_topics_notification_topic_id"); + + b.HasIndex("NotificationTypeId") + .IsUnique() + .HasDatabaseName("ix_notification_type_assigned_topics_notification_type_id"); + + b.ToTable("notification_type_assigned_topics", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ContactEmail") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("contact_email"); + + b.Property("ContactNumber") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("contact_number"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("DateReleased") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_released"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("LicenseTypeId") + .HasColumnType("integer") + .HasColumnName("license_type_id"); + + b.Property("MarketingUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("marketing_url"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("OfferStatusId") + .HasColumnType("integer") + .HasColumnName("offer_status_id"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("ProviderCompanyId") + .HasColumnType("uuid") + .HasColumnName("provider_company_id"); + + b.Property("SalesManagerId") + .HasColumnType("uuid") + .HasColumnName("sales_manager_id"); + + b.HasKey("Id") + .HasName("pk_offers"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_offers_last_editor_id"); + + b.HasIndex("LicenseTypeId") + .HasDatabaseName("ix_offers_license_type_id"); + + b.HasIndex("OfferStatusId") + .HasDatabaseName("ix_offers_offer_status_id"); + + b.HasIndex("OfferTypeId") + .HasDatabaseName("ix_offers_offer_type_id"); + + b.HasIndex("ProviderCompanyId") + .HasDatabaseName("ix_offers_provider_company_id"); + + b.HasIndex("SalesManagerId") + .HasDatabaseName("ix_offers_sales_manager_id"); + + b.ToTable("offers", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_OFFER"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_OFFER"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_OFFER", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_OFFER\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_OFFER$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_offer20240911\" (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"offer_type_id\", \"sales_manager_id\", \"provider_company_id\", \"offer_status_id\", \"license_type_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"name\", \r\n NEW.\"date_created\", \r\n NEW.\"date_released\", \r\n NEW.\"marketing_url\", \r\n NEW.\"contact_email\", \r\n NEW.\"contact_number\", \r\n NEW.\"offer_type_id\", \r\n NEW.\"sales_manager_id\", \r\n NEW.\"provider_company_id\", \r\n NEW.\"offer_status_id\", \r\n NEW.\"license_type_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_OFFER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_OFFER AFTER INSERT\r\nON \"portal\".\"offers\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_OFFER\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_OFFER", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_OFFER\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_OFFER$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_offer20240911\" (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"offer_type_id\", \"sales_manager_id\", \"provider_company_id\", \"offer_status_id\", \"license_type_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"name\", \r\n NEW.\"date_created\", \r\n NEW.\"date_released\", \r\n NEW.\"marketing_url\", \r\n NEW.\"contact_email\", \r\n NEW.\"contact_number\", \r\n NEW.\"offer_type_id\", \r\n NEW.\"sales_manager_id\", \r\n NEW.\"provider_company_id\", \r\n NEW.\"offer_status_id\", \r\n NEW.\"license_type_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_OFFER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_OFFER AFTER UPDATE\r\nON \"portal\".\"offers\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_OFFER\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedDocument", b => + { + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.HasKey("OfferId", "DocumentId") + .HasName("pk_offer_assigned_documents"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_offer_assigned_documents_document_id"); + + b.ToTable("offer_assigned_documents", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedLicense", b => + { + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferLicenseId") + .HasColumnType("uuid") + .HasColumnName("offer_license_id"); + + b.HasKey("OfferId", "OfferLicenseId") + .HasName("pk_offer_assigned_licenses"); + + b.HasIndex("OfferLicenseId") + .HasDatabaseName("ix_offer_assigned_licenses_offer_license_id"); + + b.ToTable("offer_assigned_licenses", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedPrivacyPolicy", b => + { + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("PrivacyPolicyId") + .HasColumnType("integer") + .HasColumnName("privacy_policy_id"); + + b.HasKey("OfferId", "PrivacyPolicyId") + .HasName("pk_offer_assigned_privacy_policies"); + + b.HasIndex("PrivacyPolicyId") + .HasDatabaseName("ix_offer_assigned_privacy_policies_privacy_policy_id"); + + b.ToTable("offer_assigned_privacy_policies", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferDescription", b => + { + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("DescriptionLong") + .IsRequired() + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("description_long"); + + b.Property("DescriptionShort") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description_short"); + + b.HasKey("OfferId", "LanguageShortName") + .HasName("pk_offer_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_offer_descriptions_language_short_name"); + + b.ToTable("offer_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferLicense", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Licensetext") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("licensetext"); + + b.HasKey("Id") + .HasName("pk_offer_licenses"); + + b.ToTable("offer_licenses", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_offer_statuses"); + + b.ToTable("offer_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "CREATED" + }, + new + { + Id = 2, + Label = "IN_REVIEW" + }, + new + { + Id = 3, + Label = "ACTIVE" + }, + new + { + Id = 4, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("Description") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("description"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("display_name"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("OfferSubscriptionStatusId") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1) + .HasColumnName("offer_subscription_status_id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("RequesterId") + .HasColumnType("uuid") + .HasColumnName("requester_id"); + + b.HasKey("Id") + .HasName("pk_offer_subscriptions"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_offer_subscriptions_company_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_offer_subscriptions_last_editor_id"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_offer_subscriptions_offer_id"); + + b.HasIndex("OfferSubscriptionStatusId") + .HasDatabaseName("ix_offer_subscriptions_offer_subscription_status_id"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_offer_subscriptions_process_id"); + + b.HasIndex("RequesterId") + .HasDatabaseName("ix_offer_subscriptions_requester_id"); + + b.ToTable("offer_subscriptions", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_offer_subscription20231115\" (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"date_created\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"company_id\", \r\n NEW.\"offer_id\", \r\n NEW.\"offer_subscription_status_id\", \r\n NEW.\"display_name\", \r\n NEW.\"description\", \r\n NEW.\"requester_id\", \r\n NEW.\"last_editor_id\", \r\n NEW.\"process_id\", \r\n NEW.\"date_created\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION AFTER INSERT\r\nON \"portal\".\"offer_subscriptions\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_OFFERSUBSCRIPTION\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_offer_subscription20231115\" (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"date_created\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"company_id\", \r\n NEW.\"offer_id\", \r\n NEW.\"offer_subscription_status_id\", \r\n NEW.\"display_name\", \r\n NEW.\"description\", \r\n NEW.\"requester_id\", \r\n NEW.\"last_editor_id\", \r\n NEW.\"process_id\", \r\n NEW.\"date_created\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION AFTER UPDATE\r\nON \"portal\".\"offer_subscriptions\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_OFFERSUBSCRIPTION\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionProcessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.Property("OfferUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("offer_url"); + + b.HasKey("Id") + .HasName("pk_offer_subscriptions_process_datas"); + + b.HasIndex("OfferSubscriptionId") + .IsUnique() + .HasDatabaseName("ix_offer_subscriptions_process_datas_offer_subscription_id"); + + b.ToTable("offer_subscriptions_process_datas", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_offer_subscription_statuses"); + + b.ToTable("offer_subscription_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "PENDING" + }, + new + { + Id = 2, + Label = "ACTIVE" + }, + new + { + Id = 3, + Label = "INACTIVE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferTag", b => + { + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("tag_name") + .HasAnnotation("Relational:JsonPropertyName", "tag_name"); + + b.HasKey("OfferId", "Name") + .HasName("pk_offer_tags"); + + b.ToTable("offer_tags", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_offer_types"); + + b.ToTable("offer_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "APP" + }, + new + { + Id = 2, + Label = "CORE_COMPONENT" + }, + new + { + Id = 3, + Label = "SERVICE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OnboardingServiceProviderDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AuthUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("auth_url"); + + b.Property("CallbackUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("callback_url"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("client_id"); + + b.Property("ClientSecret") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("client_secret"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("EncryptionMode") + .HasColumnType("integer") + .HasColumnName("encryption_mode"); + + b.Property("InitializationVector") + .HasColumnType("bytea") + .HasColumnName("initialization_vector"); + + b.HasKey("Id") + .HasName("pk_onboarding_service_provider_details"); + + b.HasIndex("CompanyId") + .IsUnique() + .HasDatabaseName("ix_onboarding_service_provider_details_company_id"); + + b.ToTable("onboarding_service_provider_details", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_privacy_policies"); + + b.ToTable("privacy_policies", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMPANY_DATA" + }, + new + { + Id = 2, + Label = "USER_DATA" + }, + new + { + Id = 3, + Label = "LOCATION" + }, + new + { + Id = 4, + Label = "BROWSER_HISTORY" + }, + new + { + Id = 5, + Label = "NONE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_step_types"); + + b.ToTable("process_step_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "MANUAL_VERIFY_REGISTRATION" + }, + new + { + Id = 2, + Label = "CREATE_BUSINESS_PARTNER_NUMBER_PUSH" + }, + new + { + Id = 3, + Label = "CREATE_BUSINESS_PARTNER_NUMBER_PULL" + }, + new + { + Id = 4, + Label = "CREATE_BUSINESS_PARTNER_NUMBER_MANUAL" + }, + new + { + Id = 5, + Label = "CREATE_IDENTITY_WALLET" + }, + new + { + Id = 6, + Label = "RETRIGGER_IDENTITY_WALLET" + }, + new + { + Id = 7, + Label = "START_CLEARING_HOUSE" + }, + new + { + Id = 8, + Label = "RETRIGGER_CLEARING_HOUSE" + }, + new + { + Id = 9, + Label = "AWAIT_CLEARING_HOUSE_RESPONSE" + }, + new + { + Id = 10, + Label = "START_SELF_DESCRIPTION_LP" + }, + new + { + Id = 11, + Label = "RETRIGGER_SELF_DESCRIPTION_LP" + }, + new + { + Id = 12, + Label = "ACTIVATE_APPLICATION" + }, + new + { + Id = 13, + Label = "RETRIGGER_BUSINESS_PARTNER_NUMBER_PUSH" + }, + new + { + Id = 14, + Label = "RETRIGGER_BUSINESS_PARTNER_NUMBER_PULL" + }, + new + { + Id = 16, + Label = "MANUAL_TRIGGER_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 17, + Label = "START_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 18, + Label = "AWAIT_SELF_DESCRIPTION_LP_RESPONSE" + }, + new + { + Id = 19, + Label = "MANUAL_DECLINE_APPLICATION" + }, + new + { + Id = 20, + Label = "CREATE_DIM_WALLET" + }, + new + { + Id = 21, + Label = "AWAIT_DIM_RESPONSE_RESPONSE" + }, + new + { + Id = 22, + Label = "RETRIGGER_CREATE_DIM_WALLET" + }, + new + { + Id = 23, + Label = "VALIDATE_DID_DOCUMENT" + }, + new + { + Id = 24, + Label = "RETRIGGER_VALIDATE_DID_DOCUMENT" + }, + new + { + Id = 25, + Label = "REQUEST_BPN_CREDENTIAL" + }, + new + { + Id = 26, + Label = "AWAIT_BPN_CREDENTIAL_RESPONSE" + }, + new + { + Id = 27, + Label = "REQUEST_MEMBERSHIP_CREDENTIAL" + }, + new + { + Id = 28, + Label = "AWAIT_MEMBERSHIP_CREDENTIAL_RESPONSE" + }, + new + { + Id = 29, + Label = "TRANSMIT_BPN_DID" + }, + new + { + Id = 30, + Label = "RETRIGGER_TRANSMIT_DID_BPN" + }, + new + { + Id = 31, + Label = "RETRIGGER_REQUEST_BPN_CREDENTIAL" + }, + new + { + Id = 32, + Label = "RETRIGGER_REQUEST_MEMBERSHIP_CREDENTIAL" + }, + new + { + Id = 100, + Label = "TRIGGER_PROVIDER" + }, + new + { + Id = 101, + Label = "AWAIT_START_AUTOSETUP" + }, + new + { + Id = 102, + Label = "OFFERSUBSCRIPTION_CLIENT_CREATION" + }, + new + { + Id = 103, + Label = "SINGLE_INSTANCE_SUBSCRIPTION_DETAILS_CREATION" + }, + new + { + Id = 104, + Label = "OFFERSUBSCRIPTION_TECHNICALUSER_CREATION" + }, + new + { + Id = 105, + Label = "ACTIVATE_SUBSCRIPTION" + }, + new + { + Id = 106, + Label = "TRIGGER_PROVIDER_CALLBACK" + }, + new + { + Id = 107, + Label = "RETRIGGER_PROVIDER" + }, + new + { + Id = 108, + Label = "RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION" + }, + new + { + Id = 109, + Label = "RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION" + }, + new + { + Id = 110, + Label = "RETRIGGER_PROVIDER_CALLBACK" + }, + new + { + Id = 111, + Label = "MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION" + }, + new + { + Id = 112, + Label = "OFFERSUBSCRIPTION_CREATE_DIM_TECHNICAL_USER" + }, + new + { + Id = 113, + Label = "RETRIGGER_OFFERSUBSCRIPTION_CREATE_DIM_TECHNICAL_USER" + }, + new + { + Id = 200, + Label = "SYNCHRONIZE_USER" + }, + new + { + Id = 201, + Label = "RETRIGGER_SYNCHRONIZE_USER" + }, + new + { + Id = 202, + Label = "TRIGGER_CALLBACK_OSP_SUBMITTED" + }, + new + { + Id = 203, + Label = "TRIGGER_CALLBACK_OSP_APPROVED" + }, + new + { + Id = 204, + Label = "TRIGGER_CALLBACK_OSP_DECLINED" + }, + new + { + Id = 205, + Label = "RETRIGGER_CALLBACK_OSP_SUBMITTED" + }, + new + { + Id = 206, + Label = "RETRIGGER_CALLBACK_OSP_APPROVED" + }, + new + { + Id = 207, + Label = "RETRIGGER_CALLBACK_OSP_DECLINED" + }, + new + { + Id = 208, + Label = "MANUAL_DECLINE_OSP" + }, + new + { + Id = 209, + Label = "REMOVE_KEYCLOAK_USERS" + }, + new + { + Id = 210, + Label = "RETRIGGER_REMOVE_KEYCLOAK_USERS" + }, + new + { + Id = 301, + Label = "SEND_MAIL" + }, + new + { + Id = 302, + Label = "RETRIGGER_SEND_MAIL" + }, + new + { + Id = 400, + Label = "INVITATION_CREATE_CENTRAL_IDP" + }, + new + { + Id = 401, + Label = "INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT" + }, + new + { + Id = 402, + Label = "INVITATION_ADD_REALM_ROLE" + }, + new + { + Id = 403, + Label = "INVITATION_CREATE_SHARED_REALM" + }, + new + { + Id = 404, + Label = "INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER" + }, + new + { + Id = 405, + Label = "INVITATION_UPDATE_CENTRAL_IDP_URLS" + }, + new + { + Id = 406, + Label = "INVITATION_CREATE_SHARED_CLIENT" + }, + new + { + Id = 407, + Label = "INVITATION_ENABLE_CENTRAL_IDP" + }, + new + { + Id = 408, + Label = "INVITATION_CREATE_DATABASE_IDP" + }, + new + { + Id = 409, + Label = "INVITATION_CREATE_USER" + }, + new + { + Id = 410, + Label = "RETRIGGER_INVITATION_CREATE_CENTRAL_IDP" + }, + new + { + Id = 411, + Label = "RETRIGGER_INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT" + }, + new + { + Id = 412, + Label = "RETRIGGER_INVITATION_ADD_REALM_ROLE" + }, + new + { + Id = 413, + Label = "RETRIGGER_INVITATION_CREATE_SHARED_REALM" + }, + new + { + Id = 414, + Label = "RETRIGGER_INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER" + }, + new + { + Id = 415, + Label = "RETRIGGER_INVITATION_UPDATE_CENTRAL_IDP_URLS" + }, + new + { + Id = 416, + Label = "RETRIGGER_INVITATION_CREATE_SHARED_CLIENT" + }, + new + { + Id = 417, + Label = "RETRIGGER_INVITATION_ENABLE_CENTRAL_IDP" + }, + new + { + Id = 418, + Label = "RETRIGGER_INVITATION_CREATE_USER" + }, + new + { + Id = 419, + Label = "RETRIGGER_INVITATION_CREATE_DATABASE_IDP" + }, + new + { + Id = 500, + Label = "CREATE_DIM_TECHNICAL_USER" + }, + new + { + Id = 501, + Label = "RETRIGGER_CREATE_DIM_TECHNICAL_USER" + }, + new + { + Id = 502, + Label = "AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE" + }, + new + { + Id = 504, + Label = "DELETE_DIM_TECHNICAL_USER" + }, + new + { + Id = 505, + Label = "AWAIT_DELETE_DIM_TECHNICAL_USER_RESPONSE" + }, + new + { + Id = 506, + Label = "RETRIGGER_DELETE_DIM_TECHNICAL_USER" + }, + new + { + Id = 600, + Label = "DELETE_CENTRAL_USER" + }, + new + { + Id = 601, + Label = "RETRIGGER_DELETE_CENTRAL_USER" + }, + new + { + Id = 602, + Label = "DELETE_COMPANYUSER_ASSIGNED_PROCESS" + }, + new + { + Id = 700, + Label = "DELETE_IDP_SHARED_REALM" + }, + new + { + Id = 701, + Label = "RETRIGGER_DELETE_IDP_SHARED_REALM" + }, + new + { + Id = 702, + Label = "DELETE_IDP_SHARED_SERVICEACCOUNT" + }, + new + { + Id = 703, + Label = "RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT" + }, + new + { + Id = 704, + Label = "DELETE_CENTRAL_IDENTITY_PROVIDER" + }, + new + { + Id = 705, + Label = "RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER" + }, + new + { + Id = 706, + Label = "DELETE_IDENTITY_PROVIDER" + }, + new + { + Id = 800, + Label = "SELF_DESCRIPTION_CONNECTOR_CREATION" + }, + new + { + Id = 801, + Label = "SELF_DESCRIPTION_COMPANY_CREATION" + }, + new + { + Id = 802, + Label = "RETRIGGER_SELF_DESCRIPTION_CONNECTOR_CREATION" + }, + new + { + Id = 803, + Label = "RETRIGGER_SELF_DESCRIPTION_COMPANY_CREATION" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_types"); + + b.ToTable("process_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "APPLICATION_CHECKLIST" + }, + new + { + Id = 3, + Label = "OFFER_SUBSCRIPTION" + }, + new + { + Id = 4, + Label = "PARTNER_REGISTRATION" + }, + new + { + Id = 5, + Label = "MAILING" + }, + new + { + Id = 6, + Label = "INVITATION" + }, + new + { + Id = 7, + Label = "DIM_TECHNICAL_USER" + }, + new + { + Id = 8, + Label = "USER_PROVISIONING" + }, + new + { + Id = 9, + Label = "IDENTITYPROVIDER_PROVISIONING" + }, + new + { + Id = 10, + Label = "SELF_DESCRIPTION_CREATION" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProviderCompanyDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AutoSetupCallbackUrl") + .HasColumnType("text") + .HasColumnName("auto_setup_callback_url"); + + b.Property("AutoSetupUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("auto_setup_url"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.HasKey("Id") + .HasName("pk_provider_company_details"); + + b.HasIndex("CompanyId") + .IsUnique() + .HasDatabaseName("ix_provider_company_details_company_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_provider_company_details_last_editor_id"); + + b.ToTable("provider_company_details", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_provider_company_detail20231115\" (\"id\", \"date_created\", \"auto_setup_url\", \"auto_setup_callback_url\", \"company_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"auto_setup_url\", \r\n NEW.\"auto_setup_callback_url\", \r\n NEW.\"company_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL AFTER INSERT\r\nON \"portal\".\"provider_company_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_PROVIDERCOMPANYDETAIL\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_provider_company_detail20231115\" (\"id\", \"date_created\", \"auto_setup_url\", \"auto_setup_callback_url\", \"company_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"date_created\", \r\n NEW.\"auto_setup_url\", \r\n NEW.\"auto_setup_callback_url\", \r\n NEW.\"company_id\", \r\n NEW.\"date_last_changed\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL AFTER UPDATE\r\nON \"portal\".\"provider_company_details\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_PROVIDERCOMPANYDETAIL\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceDetail", b => + { + b.Property("ServiceId") + .HasColumnType("uuid") + .HasColumnName("service_id"); + + b.Property("ServiceTypeId") + .HasColumnType("integer") + .HasColumnName("service_type_id"); + + b.HasKey("ServiceId", "ServiceTypeId") + .HasName("pk_service_details"); + + b.HasIndex("ServiceTypeId") + .HasDatabaseName("ix_service_details_service_type_id"); + + b.ToTable("service_details", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_service_types"); + + b.ToTable("service_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "DATASPACE_SERVICE" + }, + new + { + Id = 2, + Label = "CONSULTANCY_SERVICE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.HasKey("Id") + .HasName("pk_technical_user_profiles"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_technical_user_profiles_offer_id"); + + b.ToTable("technical_user_profiles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => + { + b.Property("TechnicalUserProfileId") + .HasColumnType("uuid") + .HasColumnName("technical_user_profile_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.HasKey("TechnicalUserProfileId", "UserRoleId") + .HasName("pk_technical_user_profile_assigned_user_roles"); + + b.HasIndex("UserRoleId") + .HasDatabaseName("ix_technical_user_profile_assigned_user_roles_user_role_id"); + + b.ToTable("technical_user_profile_assigned_user_roles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_unique_identifiers"); + + b.ToTable("unique_identifiers", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMMERCIAL_REG_NUMBER" + }, + new + { + Id = 2, + Label = "VAT_ID" + }, + new + { + Id = 3, + Label = "LEI_CODE" + }, + new + { + Id = 4, + Label = "VIES" + }, + new + { + Id = 5, + Label = "EORI" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Shortname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("shortname"); + + b.HasKey("Id") + .HasName("pk_use_cases"); + + b.ToTable("use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCaseDescription", b => + { + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasColumnName("description"); + + b.HasKey("UseCaseId", "LanguageShortName") + .HasName("pk_use_case_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_use_case_descriptions_language_short_name"); + + b.ToTable("use_case_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("UserRoleText") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_role") + .HasAnnotation("Relational:JsonPropertyName", "user_role"); + + b.HasKey("Id") + .HasName("pk_user_roles"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_user_roles_last_editor_id"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_user_roles_offer_id"); + + b.ToTable("user_roles", "portal", t => + { + t.HasTrigger("LC_TRIGGER_AFTER_INSERT_USERROLE"); + + t.HasTrigger("LC_TRIGGER_AFTER_UPDATE_USERROLE"); + }); + + b + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_USERROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_USERROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_USERROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_user_role20231115\" (\"id\", \"user_role\", \"offer_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"user_role\", \r\n NEW.\"offer_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_USERROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_USERROLE AFTER INSERT\r\nON \"portal\".\"user_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_INSERT_USERROLE\"();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_USERROLE", "CREATE FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_USERROLE\"() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_USERROLE$\r\nBEGIN\r\n INSERT INTO \"portal\".\"audit_user_role20231115\" (\"id\", \"user_role\", \"offer_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.\"id\", \r\n NEW.\"user_role\", \r\n NEW.\"offer_id\", \r\n NEW.\"last_editor_id\", \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_TIMESTAMP, \r\n NEW.\"last_editor_id\";\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_USERROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_USERROLE AFTER UPDATE\r\nON \"portal\".\"user_roles\"\r\nFOR EACH ROW EXECUTE PROCEDURE \"portal\".\"LC_TRIGGER_AFTER_UPDATE_USERROLE\"();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleAssignedCollection", b => + { + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.Property("UserRoleCollectionId") + .HasColumnType("uuid") + .HasColumnName("user_role_collection_id"); + + b.HasKey("UserRoleId", "UserRoleCollectionId") + .HasName("pk_user_role_assigned_collections"); + + b.HasIndex("UserRoleCollectionId") + .HasDatabaseName("ix_user_role_assigned_collections_user_role_collection_id"); + + b.ToTable("user_role_assigned_collections", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("Id") + .HasName("pk_user_role_collections"); + + b.ToTable("user_role_collections", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollectionDescription", b => + { + b.Property("UserRoleCollectionId") + .HasColumnType("uuid") + .HasColumnName("user_role_collection_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.HasKey("UserRoleCollectionId", "LanguageShortName") + .HasName("pk_user_role_collection_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_user_role_collection_descriptions_language_short_name"); + + b.ToTable("user_role_collection_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleDescription", b => + { + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.HasKey("UserRoleId", "LanguageShortName") + .HasName("pk_user_role_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_user_role_descriptions_language_short_name"); + + b.ToTable("user_role_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.AgreementView", b => + { + b.Property("AgreementCompanyRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("agreement_company_role"); + + b.Property("AgreementId") + .HasColumnType("uuid") + .HasColumnName("agreement_id"); + + b.Property("AgreementName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("agreement_name"); + + b.Property("AgreementStatus") + .IsRequired() + .HasColumnType("text") + .HasColumnName("agreement_status"); + + b.Property("Mandatory") + .HasColumnType("boolean") + .HasColumnName("mandatory"); + + b.ToTable((string)null); + + b.ToView("agreement_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.Property("ServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("service_account_id"); + + b.Property("Owners") + .HasColumnType("uuid") + .HasColumnName("owners"); + + b.Property("Provider") + .HasColumnType("uuid") + .HasColumnName("provider"); + + b.HasKey("ServiceAccountId"); + + b.ToTable((string)null); + + b.ToView("company_linked_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompanyConnectorView", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("company_name"); + + b.Property("ConnectorStatus") + .IsRequired() + .HasColumnType("text") + .HasColumnName("connector_status"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("connector_url"); + + b.ToTable((string)null); + + b.ToView("company_connector_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompanyIdpView", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("company_name"); + + b.Property("IdpAlias") + .IsRequired() + .HasColumnType("text") + .HasColumnName("idp_alias"); + + b.ToTable((string)null); + + b.ToView("company_idp_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompanyRoleCollectionRolesView", b => + { + b.Property("ClientName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("client_name"); + + b.Property("CollectionName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("collection_name"); + + b.Property("UserRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("user_role"); + + b.ToTable((string)null); + + b.ToView("companyrole_collectionroles_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompanyUsersView", b => + { + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("company_name"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("UserEmail") + .HasColumnType("text") + .HasColumnName("user_email"); + + b.Property("UserStatus") + .IsRequired() + .HasColumnType("text") + .HasColumnName("user_status"); + + b.ToTable((string)null); + + b.ToView("company_users_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.OfferSubscriptionView", b => + { + b.Property("AppInstance") + .HasColumnType("uuid") + .HasColumnName("app_instance"); + + b.Property("Connector") + .HasColumnType("uuid") + .HasColumnName("connector"); + + b.Property("OfferTypeId") + .HasColumnType("integer") + .HasColumnName("offer_type_id"); + + b.Property("SubscriptionId") + .HasColumnType("uuid") + .HasColumnName("subscription_id"); + + b.Property("TechnicalUser") + .HasColumnType("uuid") + .HasColumnName("technical_user"); + + b.ToTable((string)null); + + b.ToView("offer_subscription_view", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessType", null) + .WithMany("Processes") + .HasForeignKey("ProcessTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_processes_process_types_process_type_id"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStep", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany("ProcessSteps") + .HasForeignKey("ProcessId") + .IsRequired() + .HasConstraintName("fk_process_steps_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", null) + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_statuses_process_step_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", null) + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_types_process_step_type_id"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Country") + .WithMany("Addresses") + .HasForeignKey("CountryAlpha2Code") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_addresses_countries_country_alpha2code"); + + b.Navigation("Country"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementCategory", "AgreementCategory") + .WithMany("Agreements") + .HasForeignKey("AgreementCategoryId") + .IsRequired() + .HasConstraintName("fk_agreements_agreement_categories_agreement_category_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementStatus", null) + .WithMany("Agreements") + .HasForeignKey("AgreementStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_agreements_agreement_statuses_agreement_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithMany("Agreements") + .HasForeignKey("DocumentId") + .HasConstraintName("fk_agreements_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "IssuerCompany") + .WithMany("Agreements") + .HasForeignKey("IssuerCompanyId") + .IsRequired() + .HasConstraintName("fk_agreements_companies_issuer_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany("Agreements") + .HasForeignKey("UseCaseId") + .HasConstraintName("fk_agreements_use_cases_use_case_id"); + + b.Navigation("AgreementCategory"); + + b.Navigation("Document"); + + b.Navigation("IssuerCompany"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedCompanyRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("CompanyRoleId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_company_roles_company_role"); + + b.Navigation("Agreement"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOffer", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_offers_offer_id"); + + b.Navigation("Agreement"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOfferType", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", "OfferType") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("OfferTypeId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_offer_types_offer_type_id"); + + b.Navigation("Agreement"); + + b.Navigation("OfferType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany() + .HasForeignKey("UseCaseId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_use_cases_use_case_id"); + + b.Navigation("App"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany("AppInstances") + .HasForeignKey("AppId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", "IamClient") + .WithMany("AppInstances") + .HasForeignKey("IamClientId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_iam_clients_iam_client_id"); + + b.Navigation("App"); + + b.Navigation("IamClient"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", "AppInstance") + .WithMany("ServiceAccounts") + .HasForeignKey("AppInstanceId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_app_instances_app_in"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithMany("AppInstances") + .HasForeignKey("CompanyServiceAccountId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_company_service_acco"); + + b.Navigation("AppInstance"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithOne("AppInstanceSetup") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", "AppId") + .IsRequired() + .HasConstraintName("fk_app_instance_setups_offers_app_id"); + + b.Navigation("App"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_languages_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany() + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_app_languages_languages_language_short_name"); + + b.Navigation("App"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppSubscriptionDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", "AppInstance") + .WithMany("AppSubscriptionDetails") + .HasForeignKey("AppInstanceId") + .HasConstraintName("fk_app_subscription_details_app_instances_app_instance_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_app_subscription_details_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithOne("AppSubscriptionDetail") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppSubscriptionDetail", "OfferSubscriptionId") + .IsRequired() + .HasConstraintName("fk_app_subscription_details_offer_subscriptions_offer_subscrip"); + + b.Navigation("AppInstance"); + + b.Navigation("LastEditor"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntry", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryStatus", "ApplicationChecklistEntryStatus") + .WithMany("ApplicationChecklistEntries") + .HasForeignKey("ApplicationChecklistEntryStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_application_checklist_application_checklist_statuses_applic"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryType", "ApplicationChecklistEntryType") + .WithMany("ApplicationChecklistEntries") + .HasForeignKey("ApplicationChecklistEntryTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_application_checklist_application_checklist_types_applicati"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "Application") + .WithMany("ApplicationChecklistEntries") + .HasForeignKey("ApplicationId") + .IsRequired() + .HasConstraintName("fk_application_checklist_company_applications_application_id"); + + b.Navigation("Application"); + + b.Navigation("ApplicationChecklistEntryStatus"); + + b.Navigation("ApplicationChecklistEntryType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", "Address") + .WithMany("Companies") + .HasForeignKey("AddressId") + .HasConstraintName("fk_companies_addresses_address_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyStatus", "CompanyStatus") + .WithMany("Companies") + .HasForeignKey("CompanyStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_companies_company_statuses_company_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "SdCreationProcess") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "SdCreationProcessId") + .HasConstraintName("fk_companies_processes_sd_creation_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "SelfDescriptionDocument") + .WithMany("Companies") + .HasForeignKey("SelfDescriptionDocumentId") + .HasConstraintName("fk_companies_documents_self_description_document_id"); + + b.Navigation("Address"); + + b.Navigation("CompanyStatus"); + + b.Navigation("SdCreationProcess"); + + b.Navigation("SelfDescriptionDocument"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationStatus", "ApplicationStatus") + .WithMany("CompanyApplications") + .HasForeignKey("ApplicationStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_applications_company_application_statuses_applicati"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "ChecklistProcess") + .WithMany() + .HasForeignKey("ChecklistProcessId") + .HasConstraintName("fk_company_applications_processes_checklist_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationType", "CompanyApplicationType") + .WithMany("CompanyApplications") + .HasForeignKey("CompanyApplicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_applications_company_application_types_company_appl"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanyApplications") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_applications_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_company_applications_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "OnboardingServiceProvider") + .WithMany("ProvidedApplications") + .HasForeignKey("OnboardingServiceProviderId") + .HasConstraintName("fk_company_applications_companies_onboarding_service_provider_"); + + b.Navigation("ApplicationStatus"); + + b.Navigation("ChecklistProcess"); + + b.Navigation("Company"); + + b.Navigation("CompanyApplicationType"); + + b.Navigation("LastEditor"); + + b.Navigation("OnboardingServiceProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyAssignedRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanyAssignedRoles") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_assigned_roles_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithMany("CompanyAssignedRoles") + .HasForeignKey("CompanyRoleId") + .IsRequired() + .HasConstraintName("fk_company_assigned_roles_company_roles_company_role_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_company_assigned_roles_identities_last_editor_id"); + + b.Navigation("Company"); + + b.Navigation("CompanyRole"); + + b.Navigation("LastEditor"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanyAssignedUseCase") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_assigned_use_cases_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany("CompanyAssignedUseCase") + .HasForeignKey("UseCaseId") + .IsRequired() + .HasConstraintName("fk_company_assigned_use_cases_use_cases_use_case_id"); + + b.Navigation("Company"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificate", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateStatus", "CompanyCertificateStatus") + .WithMany("CompanyCertificates") + .HasForeignKey("CompanyCertificateStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_certificates_company_certificate_statuses_company_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateType", "CompanyCertificateType") + .WithMany("CompanyCertificates") + .HasForeignKey("CompanyCertificateTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_certificates_company_certificate_types_company_cert"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanyCertificates") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_certificates_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithMany("CompanyCertificates") + .HasForeignKey("DocumentId") + .IsRequired() + .HasConstraintName("fk_company_certificates_documents_document_id"); + + b.Navigation("Company"); + + b.Navigation("CompanyCertificateStatus"); + + b.Navigation("CompanyCertificateType"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateAssignedSite", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificate", "CompanyCertificate") + .WithMany("CompanyCertificateAssignedSites") + .HasForeignKey("CompanyCertificateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_certificate_assigned_sites_company_certificates_com"); + + b.Navigation("CompanyCertificate"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeAssignedStatus", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateType", "CompanyCertificateType") + .WithOne("CompanyCertificateTypeAssignedStatus") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeAssignedStatus", "CompanyCertificateTypeId") + .IsRequired() + .HasConstraintName("fk_company_certificate_type_assigned_statuses_company_certific"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeStatus", "CompanyCertificateTypeStatus") + .WithMany("CompanyCertificateTypeAssignedStatuses") + .HasForeignKey("CompanyCertificateTypeStatusId") + .IsRequired() + .HasConstraintName("fk_company_certificate_type_assigned_statuses_company_certific1"); + + b.Navigation("CompanyCertificateType"); + + b.Navigation("CompanyCertificateTypeStatus"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateType", "CompanyCertificateType") + .WithMany("CompanyCertificateTypeDescriptions") + .HasForeignKey("CompanyCertificateTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_certificate_type_descriptions_company_certificate_t"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("CompanyCertificateTypeDescriptions") + .HasForeignKey("LanguageShortName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_certificate_type_descriptions_languages_language_sh"); + + b.Navigation("CompanyCertificateType"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyIdentifier", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanyIdentifiers") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_identifiers_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", "UniqueIdentifier") + .WithMany("CompanyIdentifiers") + .HasForeignKey("UniqueIdentifierId") + .IsRequired() + .HasConstraintName("fk_company_identifiers_unique_identifiers_unique_identifier_id"); + + b.Navigation("Company"); + + b.Navigation("UniqueIdentifier"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyIdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany() + .HasForeignKey("CompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_identity_providers_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithMany("CompanyIdentityProviders") + .HasForeignKey("IdentityProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_identity_providers_identity_providers_identity_prov"); + + b.Navigation("Company"); + + b.Navigation("IdentityProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyInvitation", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "Application") + .WithOne("CompanyInvitation") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyInvitation", "ApplicationId") + .HasConstraintName("fk_company_invitations_company_applications_application_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyInvitation", "ProcessId") + .IsRequired() + .HasConstraintName("fk_company_invitations_processes_process_id"); + + b.Navigation("Application"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithOne("CompanyRoleAssignedRoleCollection") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", "CompanyRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_assigned_role_collections_company_roles_compan"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollection", "UserRoleCollection") + .WithOne("CompanyRoleAssignedRoleCollection") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", "UserRoleCollectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_assigned_role_collections_user_role_collection"); + + b.Navigation("CompanyRole"); + + b.Navigation("UserRoleCollection"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithMany("CompanyRoleDescriptions") + .HasForeignKey("CompanyRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_descriptions_company_roles_company_role_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("CompanyRoleDescriptions") + .HasForeignKey("LanguageShortName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_descriptions_languages_language_short_name"); + + b.Navigation("CompanyRole"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithOne("CompanyRoleRegistrationData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", "CompanyRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_registration_data_company_roles_company_role_id"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountKind", "CompanyServiceAccountKind") + .WithMany("CompanyServiceAccounts") + .HasForeignKey("CompanyServiceAccountKindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_service_accounts_company_service_account_kindes_com"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountType", "CompanyServiceAccountType") + .WithMany("CompanyServiceAccounts") + .HasForeignKey("CompanyServiceAccountTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_service_accounts_company_service_account_types_comp"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Identity") + .WithOne("CompanyServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_service_accounts_identities_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("CompanyServiceAccounts") + .HasForeignKey("OfferSubscriptionId") + .HasConstraintName("fk_company_service_accounts_offer_subscriptions_offer_subscrip"); + + b.Navigation("CompanyServiceAccountKind"); + + b.Navigation("CompanyServiceAccountType"); + + b.Navigation("Identity"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Identity") + .WithOne("CompanyUser") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_users_identities_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_company_users_identities_last_editor_id"); + + b.Navigation("Identity"); + + b.Navigation("LastEditor"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedAppFavourite", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_company_user_assigned_app_favourites_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany() + .HasForeignKey("CompanyUserId") + .IsRequired() + .HasConstraintName("fk_company_user_assigned_app_favourites_company_users_company_"); + + b.Navigation("App"); + + b.Navigation("CompanyUser"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedBusinessPartner", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("CompanyUserAssignedBusinessPartners") + .HasForeignKey("CompanyUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_user_assigned_business_partners_company_users_compa"); + + b.Navigation("CompanyUser"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedIdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("CompanyUserAssignedIdentityProviders") + .HasForeignKey("CompanyUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_user_assigned_identity_providers_company_users_comp"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithMany("CompanyUserAssignedIdentityProviders") + .HasForeignKey("IdentityProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_user_assigned_identity_providers_identity_providers"); + + b.Navigation("CompanyUser"); + + b.Navigation("IdentityProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedProcess", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithOne("CompanyUserAssignedProcess") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedProcess", "CompanyUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_user_assigned_processes_company_users_company_user_"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_user_assigned_processes_processes_process_id"); + + b.Navigation("CompanyUser"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyWalletData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithOne("CompanyWalletData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyWalletData", "CompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_wallet_datas_companies_company_id"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "CompanyServiceAccountId") + .HasConstraintName("fk_connectors_company_service_accounts_company_service_account"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Host") + .WithMany("HostedConnectors") + .HasForeignKey("HostId") + .HasConstraintName("fk_connectors_companies_host_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_connectors_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Location") + .WithMany("Connectors") + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_connectors_countries_location_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Provider") + .WithMany("ProvidedConnectors") + .HasForeignKey("ProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_connectors_companies_provider_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "SdCreationProcess") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SdCreationProcessId") + .HasConstraintName("fk_connectors_processes_sd_creation_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "SelfDescriptionDocument") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SelfDescriptionDocumentId") + .HasConstraintName("fk_connectors_documents_self_description_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", "Status") + .WithMany("Connectors") + .HasForeignKey("StatusId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_statuses_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", "Type") + .WithMany("Connectors") + .HasForeignKey("TypeId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_types_type_id"); + + b.Navigation("CompanyServiceAccount"); + + b.Navigation("Host"); + + b.Navigation("LastEditor"); + + b.Navigation("Location"); + + b.Navigation("Provider"); + + b.Navigation("SdCreationProcess"); + + b.Navigation("SelfDescriptionDocument"); + + b.Navigation("Status"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorAssignedOfferSubscription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("ConnectorId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_connectors_connector"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("OfferSubscriptionId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_offer_subscriptions_"); + + b.Navigation("Connector"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Consent", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("Consents") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_consents_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("Consents") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_consents_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("Consents") + .HasForeignKey("CompanyUserId") + .IsRequired() + .HasConstraintName("fk_consents_company_users_company_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentStatus", "ConsentStatus") + .WithMany("Consents") + .HasForeignKey("ConsentStatusId") + .IsRequired() + .HasConstraintName("fk_consents_consent_statuses_consent_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithMany("Consents") + .HasForeignKey("DocumentId") + .HasConstraintName("fk_consents_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_consents_identities_last_editor_id"); + + b.Navigation("Agreement"); + + b.Navigation("Company"); + + b.Navigation("CompanyUser"); + + b.Navigation("ConsentStatus"); + + b.Navigation("Document"); + + b.Navigation("LastEditor"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentAssignedOffer", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Consent", "Consent") + .WithMany("ConsentAssignedOffers") + .HasForeignKey("ConsentId") + .IsRequired() + .HasConstraintName("fk_consent_assigned_offers_consents_consent_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("ConsentAssignedOffers") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_consent_assigned_offers_offers_offer_id"); + + b.Navigation("Consent"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentAssignedOfferSubscription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Consent", "Consent") + .WithMany("ConsentAssignedOfferSubscriptions") + .HasForeignKey("ConsentId") + .IsRequired() + .HasConstraintName("fk_consent_assigned_offer_subscriptions_consents_consent_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("ConsentAssignedOfferSubscriptions") + .HasForeignKey("OfferSubscriptionId") + .IsRequired() + .HasConstraintName("fk_consent_assigned_offer_subscriptions_offer_subscriptions_of"); + + b.Navigation("Consent"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CountryAssignedIdentifier", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.BpdmIdentifier", "BpdmIdentifier") + .WithMany("CountryAssignedIdentifiers") + .HasForeignKey("BpdmIdentifierId") + .HasConstraintName("fk_country_assigned_identifiers_bpdm_identifiers_bpdm_identifi"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Country") + .WithMany("CountryAssignedIdentifiers") + .HasForeignKey("CountryAlpha2Code") + .IsRequired() + .HasConstraintName("fk_country_assigned_identifiers_countries_country_alpha2code"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", "UniqueIdentifier") + .WithMany("CountryAssignedIdentifiers") + .HasForeignKey("UniqueIdentifierId") + .IsRequired() + .HasConstraintName("fk_country_assigned_identifiers_unique_identifiers_unique_iden"); + + b.Navigation("BpdmIdentifier"); + + b.Navigation("Country"); + + b.Navigation("UniqueIdentifier"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CountryLongName", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Country") + .WithMany("CountryLongNames") + .HasForeignKey("Alpha2Code") + .IsRequired() + .HasConstraintName("fk_country_long_names_countries_alpha2code"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("CountryLongNames") + .HasForeignKey("ShortName") + .IsRequired() + .HasConstraintName("fk_country_long_names_languages_short_name"); + + b.Navigation("Country"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimCompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("DimCompanyServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimCompanyServiceAccount", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_dim_company_service_accounts_company_service_accounts_id"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "ProcessId") + .IsRequired() + .HasConstraintName("fk_dim_user_creation_data_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "ServiceAccount") + .WithOne("DimUserCreationData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "ServiceAccountId") + .IsRequired() + .HasConstraintName("fk_dim_user_creation_data_company_service_accounts_service_acc"); + + b.Navigation("Process"); + + b.Navigation("ServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("Documents") + .HasForeignKey("CompanyUserId") + .HasConstraintName("fk_documents_company_users_company_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", "DocumentStatus") + .WithMany("Documents") + .HasForeignKey("DocumentStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_status_document_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", "DocumentType") + .WithMany("Documents") + .HasForeignKey("DocumentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_types_document_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", "MediaType") + .WithMany("Documents") + .HasForeignKey("MediaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_media_types_media_type_id"); + + b.Navigation("CompanyUser"); + + b.Navigation("DocumentStatus"); + + b.Navigation("DocumentType"); + + b.Navigation("MediaType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithOne("IamIdentityProvider") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", "IdentityProviderId") + .IsRequired() + .HasConstraintName("fk_iam_identity_providers_identity_providers_identity_provider"); + + b.Navigation("IdentityProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("Identities") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_identities_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", "IdentityType") + .WithMany("Identities") + .HasForeignKey("IdentityTypeId") + .IsRequired() + .HasConstraintName("fk_identities_identity_type_identity_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_identities_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", "IdentityStatus") + .WithMany("Identities") + .HasForeignKey("UserStatusId") + .IsRequired() + .HasConstraintName("fk_identities_identity_user_statuses_user_status_id"); + + b.Navigation("Company"); + + b.Navigation("IdentityStatus"); + + b.Navigation("IdentityType"); + + b.Navigation("LastEditor"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityAssignedRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Identity") + .WithMany("IdentityAssignedRoles") + .HasForeignKey("IdentityId") + .IsRequired() + .HasConstraintName("fk_identity_assigned_roles_identities_identity_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_identity_assigned_roles_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") + .WithMany("IdentityAssignedRoles") + .HasForeignKey("UserRoleId") + .IsRequired() + .HasConstraintName("fk_identity_assigned_roles_user_roles_user_role_id"); + + b.Navigation("Identity"); + + b.Navigation("LastEditor"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderCategory", "IdentityProviderCategory") + .WithMany("IdentityProviders") + .HasForeignKey("IdentityProviderCategoryId") + .IsRequired() + .HasConstraintName("fk_identity_providers_identity_provider_categories_identity_pr"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderType", "IdentityProviderType") + .WithMany("IdentityProviders") + .HasForeignKey("IdentityProviderTypeId") + .IsRequired() + .HasConstraintName("fk_identity_providers_identity_provider_types_identity_provide"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Owner") + .WithMany("OwnedIdentityProviders") + .HasForeignKey("OwnerId") + .IsRequired() + .HasConstraintName("fk_identity_providers_companies_owner_id"); + + b.Navigation("IdentityProviderCategory"); + + b.Navigation("IdentityProviderType"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderAssignedProcess", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithOne("IdentityProviderAssignedProcess") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderAssignedProcess", "IdentityProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_identity_provider_assigned_processes_identity_providers_ide"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_identity_provider_assigned_processes_processes_process_id"); + + b.Navigation("IdentityProvider"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Invitation", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "CompanyApplication") + .WithMany("Invitations") + .HasForeignKey("CompanyApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_invitations_company_applications_company_application_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("Invitations") + .HasForeignKey("CompanyUserId") + .IsRequired() + .HasConstraintName("fk_invitations_company_users_company_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.InvitationStatus", "InvitationStatus") + .WithMany("Invitations") + .HasForeignKey("InvitationStatusId") + .IsRequired() + .HasConstraintName("fk_invitations_invitation_statuses_invitation_status_id"); + + b.Navigation("CompanyApplication"); + + b.Navigation("CompanyUser"); + + b.Navigation("InvitationStatus"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.LanguageLongName", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "LongNameLanguage") + .WithMany("LanguageLongNameLanguages") + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_language_long_names_languages_language_short_name"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("LanguageLongNames") + .HasForeignKey("ShortName") + .IsRequired() + .HasConstraintName("fk_language_long_names_languages_short_name"); + + b.Navigation("Language"); + + b.Navigation("LongNameLanguage"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingInformation", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingStatus", "MailingStatus") + .WithMany("MailingInformations") + .HasForeignKey("MailingStatusId") + .IsRequired() + .HasConstraintName("fk_mailing_informations_mailing_statuses_mailing_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingInformation", "ProcessId") + .IsRequired() + .HasConstraintName("fk_mailing_informations_processes_process_id"); + + b.Navigation("MailingStatus"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "CompanyApplication") + .WithOne("NetworkRegistration") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", "ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_network_registrations_company_applications_application_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithOne("NetworkRegistration") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", "CompanyId") + .IsRequired() + .HasConstraintName("fk_network_registrations_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "OnboardingServiceProvider") + .WithMany("OnboardedNetworkRegistrations") + .HasForeignKey("OnboardingServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_network_registrations_companies_onboarding_service_provider"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", "ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_network_registrations_processes_process_id"); + + b.Navigation("Company"); + + b.Navigation("CompanyApplication"); + + b.Navigation("OnboardingServiceProvider"); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Notification", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Creator") + .WithMany("CreatedNotifications") + .HasForeignKey("CreatorUserId") + .HasConstraintName("fk_notifications_identities_creator_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", "NotificationType") + .WithMany("Notifications") + .HasForeignKey("NotificationTypeId") + .IsRequired() + .HasConstraintName("fk_notifications_notification_type_notification_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "Receiver") + .WithMany("Notifications") + .HasForeignKey("ReceiverUserId") + .IsRequired() + .HasConstraintName("fk_notifications_company_users_receiver_user_id"); + + b.Navigation("Creator"); + + b.Navigation("NotificationType"); + + b.Navigation("Receiver"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTypeAssignedTopic", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", "NotificationTopic") + .WithMany("NotificationTypeAssignedTopics") + .HasForeignKey("NotificationTopicId") + .IsRequired() + .HasConstraintName("fk_notification_type_assigned_topics_notification_topic_notifi"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", "NotificationType") + .WithOne("NotificationTypeAssignedTopic") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTypeAssignedTopic", "NotificationTypeId") + .IsRequired() + .HasConstraintName("fk_notification_type_assigned_topics_notification_type_notific"); + + b.Navigation("NotificationTopic"); + + b.Navigation("NotificationType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_offers_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.LicenseType", "LicenseType") + .WithMany("Offers") + .HasForeignKey("LicenseTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_offers_license_types_license_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", "OfferStatus") + .WithMany("Offers") + .HasForeignKey("OfferStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_offers_offer_statuses_offer_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", "OfferType") + .WithMany("Offers") + .HasForeignKey("OfferTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_offers_offer_types_offer_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "ProviderCompany") + .WithMany("ProvidedOffers") + .HasForeignKey("ProviderCompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_offers_companies_provider_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "SalesManager") + .WithMany("SalesManagerOfOffers") + .HasForeignKey("SalesManagerId") + .HasConstraintName("fk_offers_company_users_sales_manager_id"); + + b.Navigation("LastEditor"); + + b.Navigation("LicenseType"); + + b.Navigation("OfferStatus"); + + b.Navigation("OfferType"); + + b.Navigation("ProviderCompany"); + + b.Navigation("SalesManager"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedDocument", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_documents_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany() + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_documents_offers_offer_id"); + + b.Navigation("Document"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedLicense", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany() + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_licenses_offers_offer_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferLicense", "OfferLicense") + .WithMany() + .HasForeignKey("OfferLicenseId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_licenses_offer_licenses_offer_license_id"); + + b.Navigation("Offer"); + + b.Navigation("OfferLicense"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferAssignedPrivacyPolicy", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("OfferAssignedPrivacyPolicies") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_privacy_policies_offers_offer_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", "PrivacyPolicy") + .WithMany("OfferAssignedPrivacyPolicies") + .HasForeignKey("PrivacyPolicyId") + .IsRequired() + .HasConstraintName("fk_offer_assigned_privacy_policies_privacy_policies_privacy_po"); + + b.Navigation("Offer"); + + b.Navigation("PrivacyPolicy"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("AppDescriptions") + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_offer_descriptions_languages_language_short_name"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("OfferDescriptions") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_descriptions_offers_offer_id"); + + b.Navigation("Language"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("OfferSubscriptions") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_offer_subscriptions_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_offer_subscriptions_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("OfferSubscriptions") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_subscriptions_offers_offer_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", "OfferSubscriptionStatus") + .WithMany("OfferSubscriptions") + .HasForeignKey("OfferSubscriptionStatusId") + .IsRequired() + .HasConstraintName("fk_offer_subscriptions_offer_subscription_statuses_offer_subsc"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") + .HasConstraintName("fk_offer_subscriptions_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "Requester") + .WithMany("RequestedSubscriptions") + .HasForeignKey("RequesterId") + .IsRequired() + .HasConstraintName("fk_offer_subscriptions_company_users_requester_id"); + + b.Navigation("Company"); + + b.Navigation("LastEditor"); + + b.Navigation("Offer"); + + b.Navigation("OfferSubscriptionStatus"); + + b.Navigation("Process"); + + b.Navigation("Requester"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionProcessData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithOne("OfferSubscriptionProcessData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionProcessData", "OfferSubscriptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_offer_subscriptions_process_datas_offer_subscriptions_offer"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferTag", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("Tags") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_offer_tags_offers_offer_id"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OnboardingServiceProviderDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithOne("OnboardingServiceProviderDetail") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OnboardingServiceProviderDetail", "CompanyId") + .IsRequired() + .HasConstraintName("fk_onboarding_service_provider_details_companies_company_id"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProviderCompanyDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithOne("ProviderCompanyDetail") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProviderCompanyDetail", "CompanyId") + .IsRequired() + .HasConstraintName("fk_provider_company_details_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_provider_company_details_identities_last_editor_id"); + + b.Navigation("Company"); + + b.Navigation("LastEditor"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Service") + .WithMany("ServiceDetails") + .HasForeignKey("ServiceId") + .IsRequired() + .HasConstraintName("fk_service_details_offers_service_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceType", "ServiceType") + .WithMany("ServiceDetails") + .HasForeignKey("ServiceTypeId") + .IsRequired() + .HasConstraintName("fk_service_details_service_types_service_type_id"); + + b.Navigation("Service"); + + b.Navigation("ServiceType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("TechnicalUserProfiles") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_technical_user_profiles_offers_offer_id"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", "TechnicalUserProfile") + .WithMany("TechnicalUserProfileAssignedUserRoles") + .HasForeignKey("TechnicalUserProfileId") + .IsRequired() + .HasConstraintName("fk_technical_user_profile_assigned_user_roles_technical_user_p"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") + .WithMany("TechnicalUserProfileAssignedUserRole") + .HasForeignKey("UserRoleId") + .IsRequired() + .HasConstraintName("fk_technical_user_profile_assigned_user_roles_user_roles_user_"); + + b.Navigation("TechnicalUserProfile"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCaseDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("UseCases") + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_use_case_descriptions_languages_language_short_name"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany("UseCaseDescriptions") + .HasForeignKey("UseCaseId") + .IsRequired() + .HasConstraintName("fk_use_case_descriptions_use_cases_use_case_id"); + + b.Navigation("Language"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_user_roles_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("UserRoles") + .HasForeignKey("OfferId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_roles_offers_offer_id"); + + b.Navigation("LastEditor"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleAssignedCollection", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollection", "UserRoleCollection") + .WithMany() + .HasForeignKey("UserRoleCollectionId") + .IsRequired() + .HasConstraintName("fk_user_role_assigned_collections_user_role_collections_user_r"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") + .WithMany() + .HasForeignKey("UserRoleId") + .IsRequired() + .HasConstraintName("fk_user_role_assigned_collections_user_roles_user_role_id"); + + b.Navigation("UserRole"); + + b.Navigation("UserRoleCollection"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollectionDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany() + .HasForeignKey("LanguageShortName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_role_collection_descriptions_languages_language_short_"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollection", "UserRoleCollection") + .WithMany("UserRoleCollectionDescriptions") + .HasForeignKey("UserRoleCollectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_role_collection_descriptions_user_role_collections_use"); + + b.Navigation("Language"); + + b.Navigation("UserRoleCollection"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleDescription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany("UserRoleDescriptions") + .HasForeignKey("LanguageShortName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_role_descriptions_languages_language_short_name"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") + .WithMany("UserRoleDescriptions") + .HasForeignKey("UserRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_role_descriptions_user_roles_user_role_id"); + + b.Navigation("Language"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("CompaniesLinkedServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => + { + b.Navigation("Companies"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", b => + { + b.Navigation("AgreementAssignedCompanyRoles"); + + b.Navigation("AgreementAssignedOfferTypes"); + + b.Navigation("AgreementAssignedOffers"); + + b.Navigation("Consents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementCategory", b => + { + b.Navigation("Agreements"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementStatus", b => + { + b.Navigation("Agreements"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.Navigation("AppSubscriptionDetails"); + + b.Navigation("ServiceAccounts"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryStatus", b => + { + b.Navigation("ApplicationChecklistEntries"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ApplicationChecklistEntryType", b => + { + b.Navigation("ApplicationChecklistEntries"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.BpdmIdentifier", b => + { + b.Navigation("CountryAssignedIdentifiers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", b => + { + b.Navigation("Agreements"); + + b.Navigation("CompanyApplications"); + + b.Navigation("CompanyAssignedRoles"); + + b.Navigation("CompanyAssignedUseCase"); + + b.Navigation("CompanyCertificates"); + + b.Navigation("CompanyIdentifiers"); + + b.Navigation("CompanyWalletData"); + + b.Navigation("Consents"); + + b.Navigation("HostedConnectors"); + + b.Navigation("Identities"); + + b.Navigation("NetworkRegistration"); + + b.Navigation("OfferSubscriptions"); + + b.Navigation("OnboardedNetworkRegistrations"); + + b.Navigation("OnboardingServiceProviderDetail"); + + b.Navigation("OwnedIdentityProviders"); + + b.Navigation("ProvidedApplications"); + + b.Navigation("ProvidedConnectors"); + + b.Navigation("ProvidedOffers"); + + b.Navigation("ProviderCompanyDetail"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", b => + { + b.Navigation("ApplicationChecklistEntries"); + + b.Navigation("CompanyInvitation"); + + b.Navigation("Invitations"); + + b.Navigation("NetworkRegistration"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationStatus", b => + { + b.Navigation("CompanyApplications"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationType", b => + { + b.Navigation("CompanyApplications"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificate", b => + { + b.Navigation("CompanyCertificateAssignedSites"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateStatus", b => + { + b.Navigation("CompanyCertificates"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateType", b => + { + b.Navigation("CompanyCertificateTypeAssignedStatus"); + + b.Navigation("CompanyCertificateTypeDescriptions"); + + b.Navigation("CompanyCertificates"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyCertificateTypeStatus", b => + { + b.Navigation("CompanyCertificateTypeAssignedStatuses"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", b => + { + b.Navigation("AgreementAssignedCompanyRoles"); + + b.Navigation("CompanyAssignedRoles"); + + b.Navigation("CompanyRoleAssignedRoleCollection"); + + b.Navigation("CompanyRoleDescriptions"); + + b.Navigation("CompanyRoleRegistrationData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Navigation("AppInstances"); + + b.Navigation("CompaniesLinkedServiceAccount"); + + b.Navigation("Connector"); + + b.Navigation("DimCompanyServiceAccount"); + + b.Navigation("DimUserCreationData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountKind", b => + { + b.Navigation("CompanyServiceAccounts"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccountType", b => + { + b.Navigation("CompanyServiceAccounts"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyStatus", b => + { + b.Navigation("Companies"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", b => + { + b.Navigation("CompanyUserAssignedBusinessPartners"); + + b.Navigation("CompanyUserAssignedIdentityProviders"); + + b.Navigation("CompanyUserAssignedProcess"); + + b.Navigation("Consents"); + + b.Navigation("Documents"); + + b.Navigation("Invitations"); + + b.Navigation("Notifications"); + + b.Navigation("RequestedSubscriptions"); + + b.Navigation("SalesManagerOfOffers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", b => + { + b.Navigation("ConnectorAssignedOfferSubscriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", b => + { + b.Navigation("Connectors"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", b => + { + b.Navigation("Connectors"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Consent", b => + { + b.Navigation("ConsentAssignedOfferSubscriptions"); + + b.Navigation("ConsentAssignedOffers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentStatus", b => + { + b.Navigation("Consents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", b => + { + b.Navigation("Addresses"); + + b.Navigation("Connectors"); + + b.Navigation("CountryAssignedIdentifiers"); + + b.Navigation("CountryLongNames"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => + { + b.Navigation("Agreements"); + + b.Navigation("Companies"); + + b.Navigation("CompanyCertificates"); + + b.Navigation("Connector"); + + b.Navigation("Consents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => + { + b.Navigation("AppInstances"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.Navigation("CompanyServiceAccount"); + + b.Navigation("CompanyUser"); + + b.Navigation("CreatedNotifications"); + + b.Navigation("IdentityAssignedRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => + { + b.Navigation("CompanyIdentityProviders"); + + b.Navigation("CompanyUserAssignedIdentityProviders"); + + b.Navigation("IamIdentityProvider"); + + b.Navigation("IdentityProviderAssignedProcess"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderCategory", b => + { + b.Navigation("IdentityProviders"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderType", b => + { + b.Navigation("IdentityProviders"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", b => + { + b.Navigation("Identities"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", b => + { + b.Navigation("Identities"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.InvitationStatus", b => + { + b.Navigation("Invitations"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", b => + { + b.Navigation("AppDescriptions"); + + b.Navigation("CompanyCertificateTypeDescriptions"); + + b.Navigation("CompanyRoleDescriptions"); + + b.Navigation("CountryLongNames"); + + b.Navigation("LanguageLongNameLanguages"); + + b.Navigation("LanguageLongNames"); + + b.Navigation("UseCases"); + + b.Navigation("UserRoleDescriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.LicenseType", b => + { + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingStatus", b => + { + b.Navigation("MailingInformations"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", b => + { + b.Navigation("NotificationTypeAssignedTopics"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", b => + { + b.Navigation("NotificationTypeAssignedTopic"); + + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => + { + b.Navigation("AgreementAssignedOffers"); + + b.Navigation("AppInstanceSetup"); + + b.Navigation("AppInstances"); + + b.Navigation("ConsentAssignedOffers"); + + b.Navigation("OfferAssignedPrivacyPolicies"); + + b.Navigation("OfferDescriptions"); + + b.Navigation("OfferSubscriptions"); + + b.Navigation("ServiceDetails"); + + b.Navigation("Tags"); + + b.Navigation("TechnicalUserProfiles"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", b => + { + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => + { + b.Navigation("AppSubscriptionDetail"); + + b.Navigation("CompanyServiceAccounts"); + + b.Navigation("ConnectorAssignedOfferSubscriptions"); + + b.Navigation("ConsentAssignedOfferSubscriptions"); + + b.Navigation("OfferSubscriptionProcessData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => + { + b.Navigation("OfferSubscriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", b => + { + b.Navigation("AgreementAssignedOfferTypes"); + + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", b => + { + b.Navigation("OfferAssignedPrivacyPolicies"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessType", b => + { + b.Navigation("Processes"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceType", b => + { + b.Navigation("ServiceDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.Navigation("TechnicalUserProfileAssignedUserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Navigation("CompanyIdentifiers"); + + b.Navigation("CountryAssignedIdentifiers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Navigation("Agreements"); + + b.Navigation("CompanyAssignedUseCase"); + + b.Navigation("UseCaseDescriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => + { + b.Navigation("IdentityAssignedRoles"); + + b.Navigation("TechnicalUserProfileAssignedUserRole"); + + b.Navigation("UserRoleDescriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRoleCollection", b => + { + b.Navigation("CompanyRoleAssignedRoleCollection"); + + b.Navigation("UserRoleCollectionDescriptions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.cs new file mode 100644 index 0000000000..771511211b --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20240913115133_CreateProcessPackage.cs @@ -0,0 +1,158 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + /// + public partial class CreateProcessPackage : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_processes_process_types_process_type_id", + schema: "portal", + table: "processes"); + + migrationBuilder.DropIndex( + name: "ix_offer_subscriptions_process_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropIndex( + name: "ix_identity_provider_assigned_processes_process_id", + schema: "portal", + table: "identity_provider_assigned_processes"); + + migrationBuilder.DropIndex( + name: "ix_company_user_assigned_processes_process_id", + schema: "portal", + table: "company_user_assigned_processes"); + + migrationBuilder.DropIndex( + name: "ix_company_applications_checklist_process_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.CreateIndex( + name: "ix_offer_subscriptions_process_id", + schema: "portal", + table: "offer_subscriptions", + column: "process_id"); + + migrationBuilder.CreateIndex( + name: "ix_identity_provider_assigned_processes_process_id", + schema: "portal", + table: "identity_provider_assigned_processes", + column: "process_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_user_assigned_processes_process_id", + schema: "portal", + table: "company_user_assigned_processes", + column: "process_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_applications_checklist_process_id", + schema: "portal", + table: "company_applications", + column: "checklist_process_id"); + + migrationBuilder.AddForeignKey( + name: "fk_processes_process_types_process_type_id", + schema: "portal", + table: "processes", + column: "process_type_id", + principalSchema: "portal", + principalTable: "process_types", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_processes_process_types_process_type_id", + schema: "portal", + table: "processes"); + + migrationBuilder.DropIndex( + name: "ix_offer_subscriptions_process_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropIndex( + name: "ix_identity_provider_assigned_processes_process_id", + schema: "portal", + table: "identity_provider_assigned_processes"); + + migrationBuilder.DropIndex( + name: "ix_company_user_assigned_processes_process_id", + schema: "portal", + table: "company_user_assigned_processes"); + + migrationBuilder.DropIndex( + name: "ix_company_applications_checklist_process_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.CreateIndex( + name: "ix_offer_subscriptions_process_id", + schema: "portal", + table: "offer_subscriptions", + column: "process_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_identity_provider_assigned_processes_process_id", + schema: "portal", + table: "identity_provider_assigned_processes", + column: "process_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_company_user_assigned_processes_process_id", + schema: "portal", + table: "company_user_assigned_processes", + column: "process_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_company_applications_checklist_process_id", + schema: "portal", + table: "company_applications", + column: "checklist_process_id", + unique: true); + + migrationBuilder.AddForeignKey( + name: "fk_processes_process_types_process_type_id", + schema: "portal", + table: "processes", + column: "process_type_id", + principalSchema: "portal", + principalTable: "process_types", + principalColumn: "id"); + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 618e062cb6..ce4ae30f93 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -41,6 +41,126 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LockExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("lock_expiry_date"); + + b.Property("ProcessTypeId") + .HasColumnType("integer") + .HasColumnName("process_type_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_processes"); + + b.HasIndex("ProcessTypeId") + .HasDatabaseName("ix_processes_process_type_id"); + + b.ToTable("processes", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStep", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created"); + + b.Property("DateLastChanged") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_changed"); + + b.Property("Message") + .HasColumnType("text") + .HasColumnName("message"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("ProcessStepStatusId") + .HasColumnType("integer") + .HasColumnName("process_step_status_id"); + + b.Property("ProcessStepTypeId") + .HasColumnType("integer") + .HasColumnName("process_step_type_id"); + + b.HasKey("Id") + .HasName("pk_process_steps"); + + b.HasIndex("ProcessId") + .HasDatabaseName("ix_process_steps_process_id"); + + b.HasIndex("ProcessStepStatusId") + .HasDatabaseName("ix_process_steps_process_step_status_id"); + + b.HasIndex("ProcessStepTypeId") + .HasDatabaseName("ix_process_steps_process_step_type_id"); + + b.ToTable("process_steps", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_process_step_statuses"); + + b.ToTable("process_step_statuses", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TODO" + }, + new + { + Id = 2, + Label = "DONE" + }, + new + { + Id = 3, + Label = "SKIPPED" + }, + new + { + Id = 4, + Label = "FAILED" + }, + new + { + Id = 5, + Label = "DUPLICATE" + }); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditAppSubscriptionDetail20221118", b => { b.Property("AuditV1Id") @@ -3077,7 +3197,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("ix_company_applications_application_status_id"); b.HasIndex("ChecklistProcessId") - .IsUnique() .HasDatabaseName("ix_company_applications_checklist_process_id"); b.HasIndex("CompanyApplicationTypeId") @@ -4059,7 +4178,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("ix_company_user_assigned_processes_company_user_id"); b.HasIndex("ProcessId") - .IsUnique() .HasDatabaseName("ix_company_user_assigned_processes_process_id"); b.ToTable("company_user_assigned_processes", "portal"); @@ -5010,7 +5128,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("ix_identity_provider_assigned_processes_identity_provider_id"); b.HasIndex("ProcessId") - .IsUnique() .HasDatabaseName("ix_identity_provider_assigned_processes_process_id"); b.ToTable("identity_provider_assigned_processes", "portal"); @@ -6089,7 +6206,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("ix_offer_subscriptions_offer_subscription_status_id"); b.HasIndex("ProcessId") - .IsUnique() .HasDatabaseName("ix_offer_subscriptions_process_id"); b.HasIndex("RequesterId") @@ -6315,126 +6431,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("LockExpiryDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("lock_expiry_date"); - - b.Property("ProcessTypeId") - .HasColumnType("integer") - .HasColumnName("process_type_id"); - - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("uuid") - .HasColumnName("version"); - - b.HasKey("Id") - .HasName("pk_processes"); - - b.HasIndex("ProcessTypeId") - .HasDatabaseName("ix_processes_process_type_id"); - - b.ToTable("processes", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStep", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("DateCreated") - .HasColumnType("timestamp with time zone") - .HasColumnName("date_created"); - - b.Property("DateLastChanged") - .HasColumnType("timestamp with time zone") - .HasColumnName("date_last_changed"); - - b.Property("Message") - .HasColumnType("text") - .HasColumnName("message"); - - b.Property("ProcessId") - .HasColumnType("uuid") - .HasColumnName("process_id"); - - b.Property("ProcessStepStatusId") - .HasColumnType("integer") - .HasColumnName("process_step_status_id"); - - b.Property("ProcessStepTypeId") - .HasColumnType("integer") - .HasColumnName("process_step_type_id"); - - b.HasKey("Id") - .HasName("pk_process_steps"); - - b.HasIndex("ProcessId") - .HasDatabaseName("ix_process_steps_process_id"); - - b.HasIndex("ProcessStepStatusId") - .HasDatabaseName("ix_process_steps_process_step_status_id"); - - b.HasIndex("ProcessStepTypeId") - .HasDatabaseName("ix_process_steps_process_step_type_id"); - - b.ToTable("process_steps", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepStatus", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("label"); - - b.HasKey("Id") - .HasName("pk_process_step_statuses"); - - b.ToTable("process_step_statuses", "portal"); - - b.HasData( - new - { - Id = 1, - Label = "TODO" - }, - new - { - Id = 2, - Label = "DONE" - }, - new - { - Id = 3, - Label = "SKIPPED" - }, - new - { - Id = 4, - Label = "FAILED" - }, - new - { - Id = 5, - Label = "DUPLICATE" - }); - }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", b => { b.Property("Id") @@ -7559,6 +7555,41 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToView("offer_subscription_view", "portal"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessType", null) + .WithMany("Processes") + .HasForeignKey("ProcessTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_processes_process_types_process_type_id"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStep", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany("ProcessSteps") + .HasForeignKey("ProcessId") + .IsRequired() + .HasConstraintName("fk_process_steps_processes_process_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", null) + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_statuses_process_step_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", null) + .WithMany("ProcessSteps") + .HasForeignKey("ProcessStepTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_process_steps_process_step_types_process_step_type_id"); + + b.Navigation("Process"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => { b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Country") @@ -7825,8 +7856,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_companies_company_statuses_company_status_id"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "SdCreationProcess") - .WithOne("SdCreationCompany") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "SdCreationProcess") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "SdCreationProcessId") .HasConstraintName("fk_companies_processes_sd_creation_process_id"); @@ -7853,9 +7884,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_company_applications_company_application_statuses_applicati"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "ChecklistProcess") - .WithOne("CompanyApplication") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "ChecklistProcessId") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "ChecklistProcess") + .WithMany() + .HasForeignKey("ChecklistProcessId") .HasConstraintName("fk_company_applications_processes_checklist_process_id"); b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplicationType", "CompanyApplicationType") @@ -8076,8 +8107,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_company_invitations_company_applications_application_id"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("CompanyInvitation") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyInvitation", "ProcessId") .IsRequired() .HasConstraintName("fk_company_invitations_processes_process_id"); @@ -8258,9 +8289,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_company_user_assigned_processes_company_users_company_user_"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("CompanyUserAssignedProcess") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedProcess", "ProcessId") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_company_user_assigned_processes_processes_process_id"); @@ -8313,8 +8344,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_connectors_companies_provider_id"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "SdCreationProcess") - .WithOne("SdCreationConnector") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "SdCreationProcess") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SdCreationProcessId") .HasConstraintName("fk_connectors_processes_sd_creation_process_id"); @@ -8519,8 +8550,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", b => { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("DimUserCreationData") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "ProcessId") .IsRequired() .HasConstraintName("fk_dim_user_creation_data_processes_process_id"); @@ -8680,9 +8711,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_identity_provider_assigned_processes_identity_providers_ide"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("IdentityProviderAssignedProcess") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderAssignedProcess", "ProcessId") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_identity_provider_assigned_processes_processes_process_id"); @@ -8747,8 +8778,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_mailing_informations_mailing_statuses_mailing_status_id"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("MailingInformation") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MailingInformation", "ProcessId") .IsRequired() .HasConstraintName("fk_mailing_informations_processes_process_id"); @@ -8780,8 +8811,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_network_registrations_companies_onboarding_service_provider"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("NetworkRegistration") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithOne() .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NetworkRegistration", "ProcessId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() @@ -8995,9 +9026,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_offer_subscriptions_offer_subscription_statuses_offer_subsc"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithOne("OfferSubscription") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "ProcessId") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", "Process") + .WithMany() + .HasForeignKey("ProcessId") .HasConstraintName("fk_offer_subscriptions_processes_process_id"); b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "Requester") @@ -9053,46 +9084,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Company"); }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessType", "ProcessType") - .WithMany("Processes") - .HasForeignKey("ProcessTypeId") - .IsRequired() - .HasConstraintName("fk_processes_process_types_process_type_id"); - - b.Navigation("ProcessType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStep", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") - .WithMany("ProcessSteps") - .HasForeignKey("ProcessId") - .IsRequired() - .HasConstraintName("fk_process_steps_processes_process_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepStatus", "ProcessStepStatus") - .WithMany("ProcessSteps") - .HasForeignKey("ProcessStepStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_process_steps_process_step_statuses_process_step_status_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", "ProcessStepType") - .WithMany("ProcessSteps") - .HasForeignKey("ProcessStepTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_process_steps_process_step_types_process_step_type_id"); - - b.Navigation("Process"); - - b.Navigation("ProcessStepStatus"); - - b.Navigation("ProcessStepType"); - }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProviderCompanyDetail", b => { b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") @@ -9271,6 +9262,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("CompanyServiceAccount"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.Process", b => + { + b.Navigation("ProcessSteps"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities.ProcessStepStatus", b => + { + b.Navigation("ProcessSteps"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => { b.Navigation("Companies"); @@ -9686,36 +9687,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("OfferAssignedPrivacyPolicies"); }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => - { - b.Navigation("CompanyApplication"); - - b.Navigation("CompanyInvitation"); - - b.Navigation("CompanyUserAssignedProcess"); - - b.Navigation("DimUserCreationData"); - - b.Navigation("IdentityProviderAssignedProcess"); - - b.Navigation("MailingInformation"); - - b.Navigation("NetworkRegistration"); - - b.Navigation("OfferSubscription"); - - b.Navigation("ProcessSteps"); - - b.Navigation("SdCreationCompany"); - - b.Navigation("SdCreationConnector"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepStatus", b => - { - b.Navigation("ProcessSteps"); - }); - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ProcessStepType", b => { b.Navigation("ProcessSteps"); diff --git a/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj b/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj index 7be952d106..39907561f0 100644 --- a/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj +++ b/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj @@ -45,6 +45,7 @@ + diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs index fd7ce37927..f59d8b4da8 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs @@ -20,10 +20,12 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; @@ -138,8 +140,8 @@ private async Task SeedBaseEntity(CancellationToken cancellationToken) await SeedTableForBaseEntity("app_instances", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("app_subscription_details", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("use_cases", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - await SeedTableForBaseEntity("process_steps", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - await SeedTableForBaseEntity("processes", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await SeedTableForBaseEntity>("process_steps", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await SeedTableForBaseEntity>("processes", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("app_instance_setups", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("technical_user_profiles", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("company_certificates", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); diff --git a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20230526.cs b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20230526.cs index 7a24efff09..dd1eb1d386 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20230526.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20230526.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20231115.cs b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20231115.cs index 75a837f3a4..f5971d599f 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20231115.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditIdentity20231115.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditExtensions.cs b/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditExtensions.cs index b4b458eaa9..5e3bbb7b52 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditExtensions.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditExtensions.cs @@ -19,9 +19,9 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; using System.Reflection; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditHandlerV1.cs b/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditHandlerV1.cs index adf168231b..c7b7f3a222 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditHandlerV1.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Auditing/AuditHandlerV1.cs @@ -22,7 +22,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using System.Collections.Immutable; using System.Reflection; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Address.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Address.cs index fd1d5554e0..6b672f086c 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Address.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Address.cs @@ -18,8 +18,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Agreement.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Agreement.cs index ede20a6918..d7bdcfbcea 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Agreement.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Agreement.cs @@ -18,8 +18,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstance.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstance.cs index e52974a432..05724a6dba 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstance.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstance.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceSetup.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceSetup.cs index 03d29d3504..1b08b6a008 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceSetup.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceSetup.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs index c912eea356..348b3cd014 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs @@ -16,9 +16,10 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Company.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Company.cs index ed2b1d9e93..7c4af6d5b6 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Company.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Company.cs @@ -17,7 +17,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; @@ -87,7 +88,7 @@ public Company(Guid id, string name, CompanyStatusId companyStatusId, DateTimeOf public virtual CompanyStatus? CompanyStatus { get; set; } public virtual Document? SelfDescriptionDocument { get; set; } public virtual CompanyWalletData? CompanyWalletData { get; set; } - public virtual Process? SdCreationProcess { get; set; } + public virtual Process? SdCreationProcess { get; set; } public virtual ICollection Agreements { get; private set; } public virtual ICollection BoughtOffers { get; private set; } public virtual ICollection CompanyApplications { get; private set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs index e400325c99..d841e73984 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs @@ -17,9 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -63,7 +64,7 @@ public CompanyApplication(Guid id, Guid companyId, CompanyApplicationStatusId ap // Navigation properties public virtual CompanyApplicationStatus? ApplicationStatus { get; set; } public virtual Company? Company { get; set; } - public virtual Process? ChecklistProcess { get; set; } + public virtual Process? ChecklistProcess { get; set; } public virtual CompanyApplicationType? CompanyApplicationType { get; set; } public virtual Company? OnboardingServiceProvider { get; set; } public virtual NetworkRegistration? NetworkRegistration { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyCertificate.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyCertificate.cs index cd465c4c87..7e4f33694d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyCertificate.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyCertificate.cs @@ -17,9 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyInvitation.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyInvitation.cs index 3ef0467549..f026ce6b76 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyInvitation.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyInvitation.cs @@ -17,7 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -64,7 +66,7 @@ public CompanyInvitation(Guid id, Guid applicationId, string firstName, string l public string? ServiceAccountUserId { get; set; } - public virtual Process? Process { get; private set; } + public virtual Process? Process { get; private set; } public virtual CompanyApplication? Application { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs index 4422ef2e93..7f2e678ce2 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs @@ -18,7 +18,6 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs index 8d4555dc29..9f1f3f8012 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs @@ -18,9 +18,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedProcess.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedProcess.cs index 440beb080c..f3d9b3b1a9 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedProcess.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedProcess.cs @@ -17,6 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; + namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; public class CompanyUserAssignedProcess @@ -32,5 +35,5 @@ public CompanyUserAssignedProcess(Guid companyUserId, Guid processId) // Navigation properties public virtual CompanyUser? CompanyUser { get; private set; } - public virtual Process? Process { get; private set; } + public virtual Process? Process { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyWalletData.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyWalletData.cs index a15a881906..f9bfc86883 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyWalletData.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyWalletData.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using System.Text.Json; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs index a562c312e3..70818f406c 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs @@ -17,9 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; @@ -81,7 +82,7 @@ public Connector(Guid id, string name, string locationId, string connectorUrl) public virtual Country? Location { get; set; } public virtual CompanyServiceAccount? CompanyServiceAccount { get; set; } public virtual Identity? LastEditor { get; set; } - public virtual Process? SdCreationProcess { get; set; } + public virtual Process? SdCreationProcess { get; set; } /// /// Mapping to the assigned document diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs index 6df2a36c66..0a6f023dd8 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs @@ -18,9 +18,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs index 7728fb01f8..a89af7fd11 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs index a63ceb5454..69fe7aad6d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs @@ -17,6 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; + namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; public class DimUserCreationData(Guid id, Guid serviceAccountId, Guid processId) @@ -27,5 +30,5 @@ public class DimUserCreationData(Guid id, Guid serviceAccountId, Guid processId) // Navigational Properties public CompanyServiceAccount? ServiceAccount { get; private set; } - public Process? Process { get; private set; } + public Process? Process { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Document.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Document.cs index 63a591ea62..7c4dfcc872 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Document.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Document.cs @@ -18,9 +18,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/IamClient.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/IamClient.cs index 5fb1f583ba..db3928fd7d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/IamClient.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/IamClient.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs index a8a8791500..a7b0b2df86 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs @@ -17,9 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProvider.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProvider.cs index c8dbe6144a..7afdfb1634 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProvider.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProvider.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProviderAssignedProcess.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProviderAssignedProcess.cs index cd0d3410e0..09f2ecbf11 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProviderAssignedProcess.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityProviderAssignedProcess.cs @@ -17,6 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; + namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; public class IdentityProviderAssignedProcess @@ -32,5 +35,5 @@ public IdentityProviderAssignedProcess(Guid identityProviderId, Guid processId) // Navigation properties public virtual IdentityProvider? IdentityProvider { get; private set; } - public virtual Process? Process { get; private set; } + public virtual Process? Process { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityType.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityType.cs index eb32e22e5c..b06f90ba35 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityType.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/IdentityType.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Invitation.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Invitation.cs index d1e0084ad2..80adb4ceea 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Invitation.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Invitation.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/MailingInformation.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/MailingInformation.cs index 6609a6f16f..c706d5454f 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/MailingInformation.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/MailingInformation.cs @@ -17,7 +17,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -50,7 +51,7 @@ public MailingInformation(Guid id, Guid processId, string email, string template public byte[] InitializationVector { get; set; } public int EncryptionMode { get; set; } - public virtual Process? Process { get; private set; } + public virtual Process? Process { get; private set; } public virtual MailingStatus? MailingStatus { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/NetworkRegistration.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/NetworkRegistration.cs index 34bded051c..90a62c8ed2 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/NetworkRegistration.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/NetworkRegistration.cs @@ -17,7 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -60,5 +62,5 @@ public NetworkRegistration(Guid id, string externalId, Guid companyId, Guid proc public virtual CompanyApplication? CompanyApplication { get; private set; } - public virtual Process? Process { get; private set; } + public virtual Process? Process { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs index e2107ba41b..cae811fb3d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs index 1559f61d75..b3e4ceb86e 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs @@ -18,9 +18,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferLicense.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferLicense.cs index 178272a7f3..0dd81cd5ac 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferLicense.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferLicense.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs index 8c1343451e..7e69b0be65 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs @@ -17,9 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; @@ -121,7 +122,7 @@ public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptio /// /// Assigned Process. /// - public virtual Process? Process { get; set; } + public virtual Process? Process { get; set; } /// /// Requester diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscriptionProcessData.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscriptionProcessData.cs index 2b86194e9e..6eb1482324 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscriptionProcessData.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscriptionProcessData.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OnboardingServiceProviderDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OnboardingServiceProviderDetail.cs index 62500189d7..bd95d4492d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OnboardingServiceProviderDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OnboardingServiceProviderDetail.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Process.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Process.cs deleted file mode 100644 index 62c7641dcc..0000000000 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Process.cs +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using System.ComponentModel.DataAnnotations; - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; - -public class Process : IBaseEntity, ILockableEntity -{ - private Process() - { - ProcessSteps = new HashSet(); - } - - public Process(Guid id, ProcessTypeId processTypeId, Guid version) : this() - { - Id = id; - ProcessTypeId = processTypeId; - Version = version; - } - - public Guid Id { get; private set; } - - public ProcessTypeId ProcessTypeId { get; set; } - - public DateTimeOffset? LockExpiryDate { get; set; } - - [ConcurrencyCheck] - public Guid Version { get; set; } - - // Navigation properties - public virtual ProcessType? ProcessType { get; set; } - public virtual CompanyApplication? CompanyApplication { get; set; } - public virtual OfferSubscription? OfferSubscription { get; set; } - public virtual NetworkRegistration? NetworkRegistration { get; set; } - public virtual MailingInformation? MailingInformation { get; set; } - public virtual CompanyInvitation? CompanyInvitation { get; set; } - public virtual DimUserCreationData? DimUserCreationData { get; set; } - public virtual CompanyUserAssignedProcess? CompanyUserAssignedProcess { get; set; } - public virtual IdentityProviderAssignedProcess? IdentityProviderAssignedProcess { get; set; } - public virtual Company? SdCreationCompany { get; set; } - public virtual Connector? SdCreationConnector { get; set; } - public virtual ICollection ProcessSteps { get; private set; } -} diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStep.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStep.cs deleted file mode 100644 index 254033419b..0000000000 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStep.cs +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 BMW Group AG - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; - -public class ProcessStep : IBaseEntity -{ - public ProcessStep(Guid id, ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId, DateTimeOffset dateCreated) - { - Id = id; - ProcessStepTypeId = processStepTypeId; - ProcessStepStatusId = processStepStatusId; - ProcessId = processId; - DateCreated = dateCreated; - } - - public Guid Id { get; private set; } - - public ProcessStepTypeId ProcessStepTypeId { get; private set; } - - public ProcessStepStatusId ProcessStepStatusId { get; set; } - - public Guid ProcessId { get; private set; } - - public DateTimeOffset DateCreated { get; private set; } - - [LastChangedV1] - public DateTimeOffset? DateLastChanged { get; set; } - - public string? Message { get; set; } - - // Navigation properties - public virtual ProcessStepType? ProcessStepType { get; private set; } - public virtual ProcessStepStatus? ProcessStepStatus { get; set; } - public virtual Process? Process { get; private set; } -} diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepType.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepType.cs index d5904adc2e..02381f1426 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepType.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessStepType.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; @@ -27,7 +28,7 @@ public class ProcessStepType private ProcessStepType() { Label = null!; - ProcessSteps = new HashSet(); + ProcessSteps = new HashSet>(); } public ProcessStepType(ProcessStepTypeId processStepTypeId) : this() @@ -42,5 +43,5 @@ public ProcessStepType(ProcessStepTypeId processStepTypeId) : this() public string Label { get; private set; } // Navigation properties - public virtual ICollection ProcessSteps { get; private set; } + public virtual ICollection> ProcessSteps { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessType.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessType.cs index 1f737a5893..a51f01b274 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessType.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProcessType.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.ComponentModel.DataAnnotations; @@ -27,7 +28,7 @@ public class ProcessType private ProcessType() { Label = null!; - Processes = new HashSet(); + Processes = new HashSet>(); } public ProcessType(ProcessTypeId processTypeId) : this() @@ -42,5 +43,5 @@ public ProcessType(ProcessTypeId processTypeId) : this() public string Label { get; private set; } // Navigation properties - public virtual ICollection Processes { get; private set; } + public virtual ICollection> Processes { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs index f3e515a24c..db2795d486 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs @@ -18,9 +18,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/TechnicalUserProfile.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/TechnicalUserProfile.cs index 6fb103ef30..abaa062388 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/TechnicalUserProfile.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/TechnicalUserProfile.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/UseCase.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/UseCase.cs index fc895fcb1b..fe811daae9 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/UseCase.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/UseCase.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using System.ComponentModel.DataAnnotations; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs index 5925eebea5..88191e5196 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs @@ -17,9 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRoleCollection.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRoleCollection.cs index 9f41d6c855..a630bb56be 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRoleCollection.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRoleCollection.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Base; +using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/src/portalbackend/PortalBackend.PortalEntities/Extensions/ProcessTypeExtensions.cs b/src/portalbackend/PortalBackend.PortalEntities/Extensions/ProcessTypeExtensions.cs index 7669999f79..8502c6df3b 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Extensions/ProcessTypeExtensions.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Extensions/ProcessTypeExtensions.cs @@ -32,7 +32,7 @@ public static ProcessStepTypeId GetInitialProcessStepTypeIdForSaCreation(this Pr _ => throw new ArgumentException($"ProcessType {processTypeId} is not supported") }; - public static (ProcessTypeId ProcessType, ProcessStepTypeId NextStep) GetProcessStepForRetrigger(this ProcessStepTypeId stepToTrigger) => + public static (ProcessTypeId ProcessType, ProcessStepTypeId NextStep) GetProcessStepForRetrigger(ProcessStepTypeId stepToTrigger) => stepToTrigger switch { ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP => (ProcessTypeId.INVITATION, ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP), diff --git a/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj b/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj index 6222467935..c423a26c8a 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj +++ b/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj @@ -44,7 +44,9 @@ + + diff --git a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs index fa1b72435e..3513732faa 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs @@ -18,6 +18,8 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -34,7 +36,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; /// The Trigger Framework requires new Guid() to convert it to gen_random_uuid(), /// for the Id field we'll use a randomly set UUID to satisfy SonarCloud. /// -public class PortalDbContext : DbContext +public class PortalDbContext : ProcessDbContext { private readonly IAuditHandler _auditHandler; @@ -44,7 +46,7 @@ protected PortalDbContext() } public PortalDbContext(DbContextOptions options, IAuditHandler auditHandler) - : base(options) + : base(options) { _auditHandler = auditHandler; } @@ -177,9 +179,6 @@ public PortalDbContext(DbContextOptions options, IAuditHandler public virtual DbSet OfferSubscriptionStatuses { get; set; } = default!; public virtual DbSet OfferSubscriptionsProcessDatas { get; set; } = default!; public virtual DbSet OnboardingServiceProviderDetails { get; set; } = default!; - public virtual DbSet Processes { get; set; } = default!; - public virtual DbSet ProcessSteps { get; set; } = default!; - public virtual DbSet ProcessStepStatuses { get; set; } = default!; public virtual DbSet ProcessStepTypes { get; set; } = default!; public virtual DbSet ProcessTypes { get; set; } = default!; public virtual DbSet ProviderCompanyDetails { get; set; } = default!; @@ -208,7 +207,7 @@ public PortalDbContext(DbContextOptions options, IAuditHandler protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - optionsBuilder.UseSnakeCaseNamingConvention(); + base.OnConfiguring(optionsBuilder); } protected override void OnModelCreating(ModelBuilder modelBuilder) @@ -216,6 +215,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.HasAnnotation("Relational:Collation", "en_US.utf8"); modelBuilder.HasDefaultSchema("portal"); + base.OnModelCreating(modelBuilder); + modelBuilder.Entity(entity => { entity.HasOne(d => d.AgreementCategory) @@ -540,7 +541,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasOne(d => d.SdCreationProcess) - .WithOne(p => p.SdCreationCompany) + .WithOne() .HasForeignKey(d => d.SdCreationProcessId) .OnDelete(DeleteBehavior.ClientSetNull); @@ -1119,7 +1120,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasOne(d => d.SdCreationProcess) - .WithOne(p => p.SdCreationConnector) + .WithOne() .HasForeignKey(d => d.SdCreationProcessId) .OnDelete(DeleteBehavior.ClientSetNull); @@ -1251,18 +1252,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .Select(e => new BpdmIdentifier(e)) ); - modelBuilder.Entity() - .HasOne(d => d.ProcessType) - .WithMany(p => p!.Processes) - .HasForeignKey(d => d.ProcessTypeId) - .OnDelete(DeleteBehavior.ClientSetNull); - - modelBuilder.Entity() - .HasOne(d => d.Process) - .WithMany(p => p!.ProcessSteps) - .HasForeignKey(d => d.ProcessId) - .OnDelete(DeleteBehavior.ClientSetNull); - modelBuilder.Entity() .HasData( Enum.GetValues(typeof(ProcessTypeId)) @@ -1270,13 +1259,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .Select(e => new ProcessType(e)) ); - modelBuilder.Entity() - .HasData( - Enum.GetValues(typeof(ProcessStepStatusId)) - .Cast() - .Select(e => new ProcessStepStatus(e)) - ); - modelBuilder.Entity() .HasData( Enum.GetValues(typeof(ProcessStepTypeId)) @@ -1426,7 +1408,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasOne(x => x.Process) - .WithOne(x => x.NetworkRegistration) + .WithOne() .HasForeignKey(x => x.ProcessId); entity.HasOne(x => x.OnboardingServiceProvider) @@ -1457,7 +1439,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasOne(x => x.Process) - .WithOne(x => x.CompanyInvitation) + .WithOne() .HasForeignKey(x => x.ProcessId) .OnDelete(DeleteBehavior.ClientSetNull); }); @@ -1485,7 +1467,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasKey(x => x.Id); entity.HasOne(x => x.Process) - .WithOne(x => x.MailingInformation) + .WithOne() .HasForeignKey(x => x.ProcessId) .OnDelete(DeleteBehavior.ClientSetNull); @@ -1500,7 +1482,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasKey(x => x.Id); entity.HasOne(x => x.Process) - .WithOne(x => x.DimUserCreationData) + .WithOne() .HasForeignKey(x => x.ProcessId) .OnDelete(DeleteBehavior.ClientSetNull); diff --git a/src/processes/ApplicationChecklist.Executor/ApplicationChecklist.Executor.csproj b/src/processes/ApplicationChecklist.Executor/ApplicationChecklist.Executor.csproj index 616c7ee99e..bb8ef470d5 100644 --- a/src/processes/ApplicationChecklist.Executor/ApplicationChecklist.Executor.csproj +++ b/src/processes/ApplicationChecklist.Executor/ApplicationChecklist.Executor.csproj @@ -31,9 +31,10 @@ + + - diff --git a/src/processes/ApplicationChecklist.Executor/ApplicationChecklistProcessTypeExecutor.cs b/src/processes/ApplicationChecklist.Executor/ApplicationChecklistProcessTypeExecutor.cs index 3c9e13f043..93a7edb3fe 100644 --- a/src/processes/ApplicationChecklist.Executor/ApplicationChecklistProcessTypeExecutor.cs +++ b/src/processes/ApplicationChecklist.Executor/ApplicationChecklistProcessTypeExecutor.cs @@ -19,17 +19,18 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Executor; -public class ApplicationChecklistProcessTypeExecutor : IProcessTypeExecutor +public class ApplicationChecklistProcessTypeExecutor : IProcessTypeExecutor { private readonly IApplicationChecklistHandlerService _checklistHandlerService; private readonly IApplicationChecklistCreationService _checklistCreationService; @@ -54,7 +55,7 @@ public ApplicationChecklistProcessTypeExecutor( public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => ValueTask.FromResult(_checklistHandlerService.GetProcessStepExecution(processStepTypeId).RequiresLock); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { applicationId = Guid.Empty; checklist = null; @@ -84,13 +85,13 @@ public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => if (createdEntries.Any()) { createdEntries.ForEach(entry => checklist[entry.TypeId] = entry.StatusId); - return new IProcessTypeExecutor.InitializationResult(true, _checklistCreationService.GetInitialProcessStepTypeIds(createdEntries)); + return new IProcessTypeExecutor.InitializationResult(true, _checklistCreationService.GetInitialProcessStepTypeIds(createdEntries)); } } - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (applicationId == Guid.Empty || checklist == null) { @@ -136,7 +137,7 @@ public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => execution.EntryTypeId, modifyChecklistEntry); - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, stepsToSkip, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, stepsToSkip, processMessage); } private bool ProcessChecklistEntry( diff --git a/src/processes/ApplicationChecklist.Library/ApplicationChecklist.Library.csproj b/src/processes/ApplicationChecklist.Library/ApplicationChecklist.Library.csproj index a6707aa88e..251eb8a2e5 100644 --- a/src/processes/ApplicationChecklist.Library/ApplicationChecklist.Library.csproj +++ b/src/processes/ApplicationChecklist.Library/ApplicationChecklist.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/processes/ApplicationChecklist.Library/ApplicationChecklistService.cs b/src/processes/ApplicationChecklist.Library/ApplicationChecklistService.cs index 5bda839d71..c6bc6d06fd 100644 --- a/src/processes/ApplicationChecklist.Library/ApplicationChecklistService.cs +++ b/src/processes/ApplicationChecklist.Library/ApplicationChecklistService.cs @@ -19,6 +19,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -78,7 +80,7 @@ public void RequestLock(IApplicationChecklistService.ManualChecklistProcessStepD public void SkipProcessSteps(IApplicationChecklistService.ManualChecklistProcessStepData context, IEnumerable processStepTypeIds) { - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); foreach (var processStepGroup in context.ProcessSteps.GroupBy(step => step.ProcessStepTypeId).IntersectBy(processStepTypeIds, step => step.Key)) { var firstModified = false; @@ -99,7 +101,7 @@ public void SkipProcessSteps(IApplicationChecklistService.ManualChecklistProcess public void FinalizeChecklistEntryAndProcessSteps(IApplicationChecklistService.ManualChecklistProcessStepData context, Action? initializeApplicationChecklistEntry, Action? modifyApplicationChecklistEntry, IEnumerable? nextProcessStepTypeIds) { var applicationChecklistRepository = _portalRepositories.GetInstance(); - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); if (modifyApplicationChecklistEntry != null) { diff --git a/src/processes/ApplicationChecklist.Library/IApplicationChecklistService.cs b/src/processes/ApplicationChecklist.Library/IApplicationChecklistService.cs index 5d22896c34..e473576588 100644 --- a/src/processes/ApplicationChecklist.Library/IApplicationChecklistService.cs +++ b/src/processes/ApplicationChecklist.Library/IApplicationChecklistService.cs @@ -17,6 +17,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; @@ -25,14 +27,14 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Lib public interface IApplicationChecklistService { - record ManualChecklistProcessStepData(Guid ApplicationId, Process Process, Guid ProcessStepId, ApplicationChecklistEntryTypeId EntryTypeId, ImmutableDictionary Checklist, IEnumerable ProcessSteps); + record ManualChecklistProcessStepData(Guid ApplicationId, Process Process, Guid ProcessStepId, ApplicationChecklistEntryTypeId EntryTypeId, ImmutableDictionary Checklist, IEnumerable> ProcessSteps); record WorkerChecklistProcessStepData(Guid ApplicationId, ProcessStepTypeId ProcessStepTypeId, ImmutableDictionary Checklist, IEnumerable ProcessStepTypeIds); record WorkerChecklistProcessStepExecutionResult(ProcessStepStatusId StepStatusId, Action? ModifyChecklistEntry, IEnumerable? ScheduleStepTypeIds, IEnumerable? SkipStepTypeIds, bool Modified, string? ProcessMessage); Task VerifyChecklistEntryAndProcessSteps(Guid applicationId, ApplicationChecklistEntryTypeId entryTypeId, IEnumerable entryStatusIds, ProcessStepTypeId processStepTypeId, IEnumerable? entryTypeIds = null, IEnumerable? processStepTypeIds = null); - void RequestLock(IApplicationChecklistService.ManualChecklistProcessStepData context, DateTimeOffset lockExpiryDate); + void RequestLock(ManualChecklistProcessStepData context, DateTimeOffset lockExpiryDate); void SkipProcessSteps(ManualChecklistProcessStepData context, IEnumerable processStepTypeIds); void FinalizeChecklistEntryAndProcessSteps(ManualChecklistProcessStepData context, Action? initializeApplicationChecklistEntry, Action? modifyApplicationChecklistEntry, IEnumerable? nextProcessStepTypeIds); - Task HandleServiceErrorAsync(Exception exception, ProcessStepTypeId manualProcessTriggerStep); + Task HandleServiceErrorAsync(Exception exception, ProcessStepTypeId manualProcessTriggerStep); } diff --git a/src/processes/ApplicationChecklist.Library/VerifyApplicationChecklistDataExtensions.cs b/src/processes/ApplicationChecklist.Library/VerifyApplicationChecklistDataExtensions.cs index f7f5a0c1ef..1872d210b4 100644 --- a/src/processes/ApplicationChecklist.Library/VerifyApplicationChecklistDataExtensions.cs +++ b/src/processes/ApplicationChecklist.Library/VerifyApplicationChecklistDataExtensions.cs @@ -20,8 +20,9 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; @@ -71,8 +72,8 @@ public static void ValidateApplicationChecklistData( } } - public static IApplicationChecklistService.ManualChecklistProcessStepData CreateManualChecklistProcessStepData(this VerifyChecklistData checklistData, Guid applicationId, ApplicationChecklistEntryTypeId entryTypeId, ProcessStep processStep) => - new IApplicationChecklistService.ManualChecklistProcessStepData( + public static IApplicationChecklistService.ManualChecklistProcessStepData CreateManualChecklistProcessStepData(this VerifyChecklistData checklistData, Guid applicationId, ApplicationChecklistEntryTypeId entryTypeId, ProcessStep processStep) => + new( applicationId, checklistData.Process ?? throw new UnexpectedConditionException("checklistData.Process should never be null here"), processStep.Id, diff --git a/src/processes/DimUserProcess.Executor/DependencyInjection/DimUserProcessCollectionExtensions.cs b/src/processes/DimUserProcess.Executor/DependencyInjection/DimUserProcessCollectionExtensions.cs index e9dec77080..6b1ae95df8 100644 --- a/src/processes/DimUserProcess.Executor/DependencyInjection/DimUserProcessCollectionExtensions.cs +++ b/src/processes/DimUserProcess.Executor/DependencyInjection/DimUserProcessCollectionExtensions.cs @@ -21,7 +21,8 @@ using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.ExternalSystems.Provisioning.Library.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.DimUserCreationProcess.Executor.DependencyInjection; @@ -32,6 +33,6 @@ public static IServiceCollection AddDimUserProcessExecutor(this IServiceCollecti services .AddIdpManagement(config) .AddTransient() - .AddTransient() + .AddTransient, DimUserProcessTypeExecutor>() .AddDimService(config.GetSection("Dim")); } diff --git a/src/processes/DimUserProcess.Executor/DimUserProcess.Executor.csproj b/src/processes/DimUserProcess.Executor/DimUserProcess.Executor.csproj index 76628577ff..91fc936cf8 100644 --- a/src/processes/DimUserProcess.Executor/DimUserProcess.Executor.csproj +++ b/src/processes/DimUserProcess.Executor/DimUserProcess.Executor.csproj @@ -31,8 +31,7 @@ - - + diff --git a/src/processes/DimUserProcess.Executor/DimUserProcessService.cs b/src/processes/DimUserProcess.Executor/DimUserProcessService.cs index ea3003fca9..35bd262105 100644 --- a/src/processes/DimUserProcess.Executor/DimUserProcessService.cs +++ b/src/processes/DimUserProcess.Executor/DimUserProcessService.cs @@ -20,6 +20,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Dim.Library; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -30,7 +31,6 @@ public class DimUserProcessService( IDimService dimService, IPortalRepositories portalRepositories) : IDimUserProcessService { - public async Task<(IEnumerable? nextStepTypeIds, ProcessStepStatusId stepStatusId, bool modified, string? processMessage)> CreateDimUser(Guid processId, Guid dimServiceAccountId, CancellationToken cancellationToken) { var (bpn, dimName) = await GetBpnDimName(dimServiceAccountId).ConfigureAwait(ConfigureAwaitOptions.None); diff --git a/src/processes/DimUserProcess.Executor/DimUserProcessTypeExecutor.cs b/src/processes/DimUserProcess.Executor/DimUserProcessTypeExecutor.cs index d6bdc11b5a..369c5d231d 100644 --- a/src/processes/DimUserProcess.Executor/DimUserProcessTypeExecutor.cs +++ b/src/processes/DimUserProcess.Executor/DimUserProcessTypeExecutor.cs @@ -19,17 +19,18 @@ using Flurl.Http; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Net; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.DimUserCreationProcess.Executor; public class DimUserProcessTypeExecutor( IPortalRepositories portalRepositories, - IDimUserProcessService dimUserProcessService) : IProcessTypeExecutor + IDimUserProcessService dimUserProcessService) : IProcessTypeExecutor { private static readonly IEnumerable RecoverableStatusCodes = [ @@ -54,7 +55,7 @@ public bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId) => public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _dimServiceAccountId = Guid.Empty; @@ -68,12 +69,12 @@ public bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId) => _dimServiceAccountId = result; _processId = processId; - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => ValueTask.FromResult(false); - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_dimServiceAccountId == Guid.Empty) throw new UnexpectedConditionException("dimServiceAccountId should never be empty here"); @@ -103,7 +104,7 @@ public bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId) => modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) => diff --git a/src/processes/DimUserProcess.Executor/IDimUserProcessService.cs b/src/processes/DimUserProcess.Executor/IDimUserProcessService.cs index efeaf7746d..bfa144a0a3 100644 --- a/src/processes/DimUserProcess.Executor/IDimUserProcessService.cs +++ b/src/processes/DimUserProcess.Executor/IDimUserProcessService.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.DimUserCreationProcess.Executor; diff --git a/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioning.Executor.csproj b/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioning.Executor.csproj index 6030e08d8e..63c0780e97 100644 --- a/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioning.Executor.csproj +++ b/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioning.Executor.csproj @@ -30,7 +30,7 @@ - - + + \ No newline at end of file diff --git a/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioningProcessTypeExecutor.cs b/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioningProcessTypeExecutor.cs index aef3ba4502..30d831b742 100644 --- a/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioningProcessTypeExecutor.cs +++ b/src/processes/IdentityProviderProvisioning.Executor/IdentityProviderProvisioningProcessTypeExecutor.cs @@ -18,12 +18,13 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.IdentityProviderProvisioning.Executor; @@ -31,7 +32,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Processes.IdentityProviderProvisio public class IdentityProviderProvisioningProcessTypeExecutor( IPortalRepositories portalRepositories, IProvisioningManager provisioningManager) - : IProcessTypeExecutor + : IProcessTypeExecutor { private static readonly IEnumerable ExecutableProcessSteps = [ @@ -48,15 +49,15 @@ public class IdentityProviderProvisioningProcessTypeExecutor( public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => ValueTask.FromResult(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _idpData = await portalRepositories.GetInstance().GetIdentityProviderDataForProcessIdAsync(processId).ConfigureAwait(ConfigureAwaitOptions.None) ?? throw new ConflictException($"process {processId} does not exist or is not associated with an Identity Provider"); - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_idpData == null) { @@ -85,7 +86,7 @@ public class IdentityProviderProvisioningProcessTypeExecutor( modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) diff --git a/src/processes/Invitation.Executor/DependencyInjection/InvitationProcessCollectionExtensions.cs b/src/processes/Invitation.Executor/DependencyInjection/InvitationProcessCollectionExtensions.cs index a2bbf315f1..86ec7f179e 100644 --- a/src/processes/Invitation.Executor/DependencyInjection/InvitationProcessCollectionExtensions.cs +++ b/src/processes/Invitation.Executor/DependencyInjection/InvitationProcessCollectionExtensions.cs @@ -20,7 +20,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.ExternalSystems.Provisioning.Library.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Invitation.Executor.DependencyInjection; @@ -30,6 +31,6 @@ public static IServiceCollection AddInvitationProcessExecutor(this IServiceColle services .AddIdpManagement(config) .AddTransient() - .AddTransient() + .AddTransient, InvitationProcessTypeExecutor>() .ConfigureInvitationSettings(config.GetSection("Invitation")); } diff --git a/src/processes/Invitation.Executor/IInvitationProcessService.cs b/src/processes/Invitation.Executor/IInvitationProcessService.cs index 4494b5d4a9..db04b69816 100644 --- a/src/processes/Invitation.Executor/IInvitationProcessService.cs +++ b/src/processes/Invitation.Executor/IInvitationProcessService.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Invitation.Executor; diff --git a/src/processes/Invitation.Executor/Invitation.Executor.csproj b/src/processes/Invitation.Executor/Invitation.Executor.csproj index 0bf5fd23a9..4ca77b162e 100644 --- a/src/processes/Invitation.Executor/Invitation.Executor.csproj +++ b/src/processes/Invitation.Executor/Invitation.Executor.csproj @@ -30,8 +30,8 @@ + - diff --git a/src/processes/Invitation.Executor/InvitationProcessService.cs b/src/processes/Invitation.Executor/InvitationProcessService.cs index 3a936a1954..4b8bcb2eca 100644 --- a/src/processes/Invitation.Executor/InvitationProcessService.cs +++ b/src/processes/Invitation.Executor/InvitationProcessService.cs @@ -22,6 +22,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/src/processes/Invitation.Executor/InvitationProcessTypeExecutor.cs b/src/processes/Invitation.Executor/InvitationProcessTypeExecutor.cs index a03b0a04d3..5822166957 100644 --- a/src/processes/Invitation.Executor/InvitationProcessTypeExecutor.cs +++ b/src/processes/Invitation.Executor/InvitationProcessTypeExecutor.cs @@ -19,17 +19,18 @@ using Flurl.Http; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.Invitation.Executor.Extensions; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Collections.Immutable; using System.Net; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Invitation.Executor; -public class InvitationProcessTypeExecutor : IProcessTypeExecutor +public class InvitationProcessTypeExecutor : IProcessTypeExecutor { private static readonly IEnumerable RecoverableStatusCodes = ImmutableArray.Create( (int)HttpStatusCode.BadGateway, @@ -75,7 +76,7 @@ public InvitationProcessTypeExecutor(IPortalRepositories portalRepositories, IIn public bool IsExecutableStepTypeId(ProcessStepTypeId processStepTypeId) => ExecutableProcessSteps.Contains(processStepTypeId); public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _companyInvitationId = Guid.Empty; @@ -86,14 +87,14 @@ public InvitationProcessTypeExecutor(IPortalRepositories portalRepositories, IIn } _companyInvitationId = result; - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => new(LockableProcessSteps.Contains(processStepTypeId)); public ProcessTypeId GetProcessTypeId() => ProcessTypeId.INVITATION; - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_companyInvitationId == Guid.Empty) { @@ -138,7 +139,7 @@ public InvitationProcessTypeExecutor(IPortalRepositories portalRepositories, IIn modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) => diff --git a/src/processes/Mailing.Executor/DependencyInjection/MailingProcessCollectionExtensions.cs b/src/processes/Mailing.Executor/DependencyInjection/MailingProcessCollectionExtensions.cs index 6e4963ea52..70450795e4 100644 --- a/src/processes/Mailing.Executor/DependencyInjection/MailingProcessCollectionExtensions.cs +++ b/src/processes/Mailing.Executor/DependencyInjection/MailingProcessCollectionExtensions.cs @@ -18,7 +18,8 @@ ********************************************************************************/ using Microsoft.Extensions.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Executor.DependencyInjection; @@ -26,5 +27,5 @@ public static class MailingProcessCollectionExtensions { public static IServiceCollection AddMailingProcessExecutor(this IServiceCollection services) => services - .AddTransient(); + .AddTransient, MailingProcessTypeExecutor>(); } diff --git a/src/processes/Mailing.Executor/Mailing.Executor.csproj b/src/processes/Mailing.Executor/Mailing.Executor.csproj index 51786b2c1f..78745cd612 100644 --- a/src/processes/Mailing.Executor/Mailing.Executor.csproj +++ b/src/processes/Mailing.Executor/Mailing.Executor.csproj @@ -30,7 +30,7 @@ - + diff --git a/src/processes/Mailing.Executor/MailingProcessTypeExecutor.cs b/src/processes/Mailing.Executor/MailingProcessTypeExecutor.cs index f24ddbe17d..f201b478ff 100644 --- a/src/processes/Mailing.Executor/MailingProcessTypeExecutor.cs +++ b/src/processes/Mailing.Executor/MailingProcessTypeExecutor.cs @@ -20,18 +20,19 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Collections.Immutable; using System.Text.Json; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Executor; -public class MailingProcessTypeExecutor : IProcessTypeExecutor +public class MailingProcessTypeExecutor : IProcessTypeExecutor { private readonly IPortalRepositories _portalRepositories; private readonly IMailingService _mailingService; @@ -52,13 +53,13 @@ public MailingProcessTypeExecutor(IPortalRepositories portalRepositories, IMaili public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => new(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _processId = processId; - return await Task.FromResult(new IProcessTypeExecutor.InitializationResult(false, null)); + return await Task.FromResult(new IProcessTypeExecutor.InitializationResult(false, null)); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { IEnumerable? nextStepTypeIds; ProcessStepStatusId stepStatusId; @@ -79,7 +80,7 @@ public MailingProcessTypeExecutor(IPortalRepositories portalRepositories, IMaili modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private async Task<(IEnumerable? NextStepTypeIds, ProcessStepStatusId StepStatusId, bool Modified, string? ProcessMessage)> SendMail() diff --git a/src/processes/Mailing.Library/Mailing.Library.csproj b/src/processes/Mailing.Library/Mailing.Library.csproj index 04af8656c0..9b17fb692c 100644 --- a/src/processes/Mailing.Library/Mailing.Library.csproj +++ b/src/processes/Mailing.Library/Mailing.Library.csproj @@ -28,6 +28,7 @@ + diff --git a/src/processes/Mailing.Library/MailingProcessCreation.cs b/src/processes/Mailing.Library/MailingProcessCreation.cs index 7b36778877..b4944c45d6 100644 --- a/src/processes/Mailing.Library/MailingProcessCreation.cs +++ b/src/processes/Mailing.Library/MailingProcessCreation.cs @@ -21,6 +21,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -41,7 +43,7 @@ public MailingProcessCreation(IPortalRepositories portalRepositories, IOptions mailParameters) { - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); var processId = processStepRepository.CreateProcess(ProcessTypeId.MAILING).Id; processStepRepository.CreateProcessStep(ProcessStepTypeId.SEND_MAIL, ProcessStepStatusId.TODO, processId); CreateMailingInformation(processId, email, template, mailParameters); @@ -102,7 +104,7 @@ private async Task CreateMailProcesses(IEnumerable<(string ParameterName, string return parameters; } - var processStepRepository = _portalRepositories.GetInstance(); + var processStepRepository = _portalRepositories.GetInstance>(); var processId = processStepRepository.CreateProcess(ProcessTypeId.MAILING).Id; processStepRepository.CreateProcessStep(ProcessStepTypeId.SEND_MAIL, ProcessStepStatusId.TODO, processId); foreach (var template in templates) diff --git a/src/processes/NetworkRegistration.Executor/DependencyInjection/NetworkRegistrationProcessCollectionExtensions.cs b/src/processes/NetworkRegistration.Executor/DependencyInjection/NetworkRegistrationProcessCollectionExtensions.cs index 8eb9e9f830..0ab4528661 100644 --- a/src/processes/NetworkRegistration.Executor/DependencyInjection/NetworkRegistrationProcessCollectionExtensions.cs +++ b/src/processes/NetworkRegistration.Executor/DependencyInjection/NetworkRegistrationProcessCollectionExtensions.cs @@ -20,9 +20,10 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.DependencyInjection; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Executor.DependencyInjection; @@ -31,5 +32,5 @@ public static class NetworkRegistrationProcessCollectionExtensions public static IServiceCollection AddNetworkRegistrationProcessExecutor(this IServiceCollection services, IConfiguration config) => services.AddNetworkRegistrationHandler(config) .AddOnboardingServiceProviderService(config) - .AddTransient(); + .AddTransient, NetworkRegistrationProcessTypeExecutor>(); } diff --git a/src/processes/NetworkRegistration.Executor/NetworkRegistration.Executor.csproj b/src/processes/NetworkRegistration.Executor/NetworkRegistration.Executor.csproj index a57ac061a3..ec7dcba8fd 100644 --- a/src/processes/NetworkRegistration.Executor/NetworkRegistration.Executor.csproj +++ b/src/processes/NetworkRegistration.Executor/NetworkRegistration.Executor.csproj @@ -30,7 +30,7 @@ - + diff --git a/src/processes/NetworkRegistration.Executor/NetworkRegistrationProcessTypeExecutor.cs b/src/processes/NetworkRegistration.Executor/NetworkRegistrationProcessTypeExecutor.cs index f86971c3d8..aa84e9f5fe 100644 --- a/src/processes/NetworkRegistration.Executor/NetworkRegistrationProcessTypeExecutor.cs +++ b/src/processes/NetworkRegistration.Executor/NetworkRegistrationProcessTypeExecutor.cs @@ -19,17 +19,18 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Executor; -public class NetworkRegistrationProcessTypeExecutor : IProcessTypeExecutor +public class NetworkRegistrationProcessTypeExecutor : IProcessTypeExecutor { private readonly IPortalRepositories _portalRepositories; private readonly INetworkRegistrationHandler _networkRegistrationHandler; @@ -59,7 +60,7 @@ public NetworkRegistrationProcessTypeExecutor( public IEnumerable GetExecutableStepTypeIds() => _executableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => new(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { var result = await _portalRepositories.GetInstance().GetNetworkRegistrationDataForProcessIdAsync(processId).ConfigureAwait(ConfigureAwaitOptions.None); if (result == Guid.Empty) @@ -68,10 +69,10 @@ public NetworkRegistrationProcessTypeExecutor( } _networkRegistrationId = result; - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_networkRegistrationId == Guid.Empty) { @@ -106,7 +107,7 @@ public NetworkRegistrationProcessTypeExecutor( modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) diff --git a/src/processes/NetworkRegistration.Library/INetworkRegistrationHandler.cs b/src/processes/NetworkRegistration.Library/INetworkRegistrationHandler.cs index 4a9f220439..49165fdb30 100644 --- a/src/processes/NetworkRegistration.Library/INetworkRegistrationHandler.cs +++ b/src/processes/NetworkRegistration.Library/INetworkRegistrationHandler.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library; diff --git a/src/processes/NetworkRegistration.Library/NetworkRegistration.Library.csproj b/src/processes/NetworkRegistration.Library/NetworkRegistration.Library.csproj index 61c2ff361e..9961a3e1c0 100644 --- a/src/processes/NetworkRegistration.Library/NetworkRegistration.Library.csproj +++ b/src/processes/NetworkRegistration.Library/NetworkRegistration.Library.csproj @@ -34,9 +34,9 @@ + + - - diff --git a/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs b/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs index 579c749557..59067e7ccb 100644 --- a/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs +++ b/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; diff --git a/src/processes/NetworkRegistration.Library/NetworkRegistrationProcessHelper.cs b/src/processes/NetworkRegistration.Library/NetworkRegistrationProcessHelper.cs index 94ccf517e0..b1cfcbb2ce 100644 --- a/src/processes/NetworkRegistration.Library/NetworkRegistrationProcessHelper.cs +++ b/src/processes/NetworkRegistration.Library/NetworkRegistrationProcessHelper.cs @@ -18,22 +18,17 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library; -public class NetworkRegistrationProcessHelper : INetworkRegistrationProcessHelper +public class NetworkRegistrationProcessHelper( + IPortalRepositories portalRepositories) + : INetworkRegistrationProcessHelper { - private readonly IPortalRepositories _portalRepositories; - - public NetworkRegistrationProcessHelper(IPortalRepositories portalRepositories) - { - _portalRepositories = portalRepositories; - } - /// public async Task TriggerProcessStep(string externalId, ProcessStepTypeId stepToTrigger) { @@ -47,17 +42,17 @@ public async Task TriggerProcessStep(string externalId, ProcessStepTypeId stepTo _ => throw new ConflictException($"Step {stepToTrigger} is not retriggerable") }; - var networkRepository = _portalRepositories.GetInstance(); + var networkRepository = portalRepositories.GetInstance(); var (registrationIdExists, processData) = await networkRepository.IsValidRegistration(externalId, Enumerable.Repeat(stepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None); if (!registrationIdExists) { throw new NotFoundException($"external registration {externalId} does not exist"); } - var context = processData.CreateManualProcessData(stepToTrigger, _portalRepositories, () => $"externalId {externalId}"); + var context = processData.CreateManualProcessData(stepToTrigger, portalRepositories, () => $"externalId {externalId}"); context.ScheduleProcessSteps(Enumerable.Repeat(nextStep, 1)); context.FinalizeProcessStep(); - await _portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); + await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); } } diff --git a/src/processes/OfferSubscription.Executor/DependencyInjection/OfferSubscriptionProcessCollectionExtensions.cs b/src/processes/OfferSubscription.Executor/DependencyInjection/OfferSubscriptionProcessCollectionExtensions.cs index 4bf2f72f55..cf69cf37cc 100644 --- a/src/processes/OfferSubscription.Executor/DependencyInjection/OfferSubscriptionProcessCollectionExtensions.cs +++ b/src/processes/OfferSubscription.Executor/DependencyInjection/OfferSubscriptionProcessCollectionExtensions.cs @@ -20,9 +20,10 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Validation; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Executor.DependencyInjection; @@ -38,6 +39,6 @@ public static IServiceCollection AddOfferSubscriptionProcessExecutor(this IServi return services .AddOfferProviderService(config) .AddOfferServices() - .AddTransient(); + .AddTransient, OfferSubscriptionProcessTypeExecutor>(); } } diff --git a/src/processes/OfferSubscription.Executor/OfferSubscription.Executor.csproj b/src/processes/OfferSubscription.Executor/OfferSubscription.Executor.csproj index 7a1339b8f3..7542307057 100644 --- a/src/processes/OfferSubscription.Executor/OfferSubscription.Executor.csproj +++ b/src/processes/OfferSubscription.Executor/OfferSubscription.Executor.csproj @@ -30,8 +30,8 @@ - - + + diff --git a/src/processes/OfferSubscription.Executor/OfferSubscriptionProcessTypeExecutor.cs b/src/processes/OfferSubscription.Executor/OfferSubscriptionProcessTypeExecutor.cs index 3b06de9f80..2a502227f4 100644 --- a/src/processes/OfferSubscription.Executor/OfferSubscriptionProcessTypeExecutor.cs +++ b/src/processes/OfferSubscription.Executor/OfferSubscriptionProcessTypeExecutor.cs @@ -20,6 +20,8 @@ using Flurl.Http; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; @@ -27,7 +29,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Executor.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library.Extensions; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using System.Net; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Executor; @@ -37,7 +38,7 @@ public class OfferSubscriptionProcessTypeExecutor( IOfferSetupService offerSetupService, IPortalRepositories portalRepositories, IOptions options) - : IProcessTypeExecutor + : IProcessTypeExecutor { private static readonly IEnumerable RecoverableStatusCodes = [ @@ -67,7 +68,7 @@ public class OfferSubscriptionProcessTypeExecutor( public IEnumerable GetExecutableStepTypeIds() => _executableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => ValueTask.FromResult(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _processId = processId; _offerSubscriptionId = Guid.Empty; @@ -79,10 +80,10 @@ public class OfferSubscriptionProcessTypeExecutor( } _offerSubscriptionId = result; - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_offerSubscriptionId == Guid.Empty) { @@ -125,7 +126,7 @@ public class OfferSubscriptionProcessTypeExecutor( modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) diff --git a/src/processes/OfferSubscription.Library/IOfferSubscriptionProcessService.cs b/src/processes/OfferSubscription.Library/IOfferSubscriptionProcessService.cs index db17b7da77..8aebc83b31 100644 --- a/src/processes/OfferSubscription.Library/IOfferSubscriptionProcessService.cs +++ b/src/processes/OfferSubscription.Library/IOfferSubscriptionProcessService.cs @@ -18,13 +18,13 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; public interface IOfferSubscriptionProcessService { - Task VerifySubscriptionAndProcessSteps(Guid offerSubscriptionId, ProcessStepTypeId processStepTypeId, IEnumerable? processStepTypeIds, bool mustBePending); - void FinalizeProcessSteps(ManualProcessStepData context, IEnumerable? nextProcessStepTypeIds); + Task> VerifySubscriptionAndProcessSteps(Guid offerSubscriptionId, ProcessStepTypeId processStepTypeId, IEnumerable? processStepTypeIds, bool mustBePending); + void FinalizeProcessSteps(ManualProcessStepData context, IEnumerable? nextProcessStepTypeIds); } diff --git a/src/processes/OfferSubscription.Library/OfferSubscription.Library.csproj b/src/processes/OfferSubscription.Library/OfferSubscription.Library.csproj index 890d06f393..d249c3d7cb 100644 --- a/src/processes/OfferSubscription.Library/OfferSubscription.Library.csproj +++ b/src/processes/OfferSubscription.Library/OfferSubscription.Library.csproj @@ -28,7 +28,13 @@ - + + + + + + + diff --git a/src/processes/OfferSubscription.Library/OfferSubscriptionProcessService.cs b/src/processes/OfferSubscription.Library/OfferSubscriptionProcessService.cs index 2808ca12b2..cddcbca3f3 100644 --- a/src/processes/OfferSubscription.Library/OfferSubscriptionProcessService.cs +++ b/src/processes/OfferSubscription.Library/OfferSubscriptionProcessService.cs @@ -19,23 +19,16 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; -public class OfferSubscriptionProcessService : IOfferSubscriptionProcessService +public class OfferSubscriptionProcessService(IPortalRepositories portalRepositories) : IOfferSubscriptionProcessService { - private readonly IPortalRepositories _portalRepositories; - - public OfferSubscriptionProcessService(IPortalRepositories portalRepositories) - { - _portalRepositories = portalRepositories; - } - - public async Task VerifySubscriptionAndProcessSteps(Guid offerSubscriptionId, ProcessStepTypeId processStepTypeId, IEnumerable? processStepTypeIds, bool mustBePending) + public async Task> VerifySubscriptionAndProcessSteps(Guid offerSubscriptionId, ProcessStepTypeId processStepTypeId, IEnumerable? processStepTypeIds, bool mustBePending) { var allProcessStepTypeIds = processStepTypeIds switch { @@ -45,7 +38,7 @@ public async Task VerifySubscriptionAndProcessSteps(Guid : processStepTypeIds.Append(processStepTypeId) }; - var offerSubscriptionsRepository = _portalRepositories.GetInstance(); + var offerSubscriptionsRepository = portalRepositories.GetInstance(); if (mustBePending) { @@ -63,10 +56,10 @@ public async Task VerifySubscriptionAndProcessSteps(Guid var processData = await offerSubscriptionsRepository .GetProcessStepData(offerSubscriptionId, allProcessStepTypeIds).ConfigureAwait(ConfigureAwaitOptions.None); - return processData.CreateManualProcessData(processStepTypeId, _portalRepositories, () => $"offer subscription {offerSubscriptionId}"); + return processData.CreateManualProcessData(processStepTypeId, portalRepositories, () => $"offer subscription {offerSubscriptionId}"); } - public void FinalizeProcessSteps(ManualProcessStepData context, IEnumerable? nextProcessStepTypeIds) + public void FinalizeProcessSteps(ManualProcessStepData context, IEnumerable? nextProcessStepTypeIds) { if (nextProcessStepTypeIds != null && nextProcessStepTypeIds.Any()) { diff --git a/src/processes/Processes.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs b/src/processes/Processes.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs index a376db0b65..e1bc64db00 100644 --- a/src/processes/Processes.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs +++ b/src/processes/Processes.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs @@ -19,8 +19,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Validation; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity.DependencyInjection; diff --git a/src/processes/Processes.ProcessIdentity/ProcessIdentityDataBuilder.cs b/src/processes/Processes.ProcessIdentity/ProcessIdentityDataBuilder.cs index 2819d7d77b..992e836d43 100644 --- a/src/processes/Processes.ProcessIdentity/ProcessIdentityDataBuilder.cs +++ b/src/processes/Processes.ProcessIdentity/ProcessIdentityDataBuilder.cs @@ -19,7 +19,8 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity.DependencyInjection; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; diff --git a/src/processes/Processes.ProcessIdentity/ProcessIdentityDataDetermination.cs b/src/processes/Processes.ProcessIdentity/ProcessIdentityDataDetermination.cs index cdb46469fd..16d97e7c40 100644 --- a/src/processes/Processes.ProcessIdentity/ProcessIdentityDataDetermination.cs +++ b/src/processes/Processes.ProcessIdentity/ProcessIdentityDataDetermination.cs @@ -18,9 +18,9 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; @@ -38,7 +38,7 @@ public ProcessIdentityDataDetermination(IPortalRepositories portalRepositories, /// public async Task GetIdentityData() { - (IdentityTypeId IdentityTypeId, Guid CompanyId) identityData; + (Framework.Identity.IdentityTypeId IdentityTypeId, Guid CompanyId) identityData; if ((identityData = await _identityRepository.GetActiveIdentityDataByIdentityId(_processIdentityDataBuilder.IdentityId).ConfigureAwait(ConfigureAwaitOptions.None)) == default) throw new ConflictException($"Identity {_processIdentityDataBuilder.IdentityId} could not be found"); diff --git a/src/processes/Processes.ProcessIdentity/ProcessIdentityService.cs b/src/processes/Processes.ProcessIdentity/ProcessIdentityService.cs index 25f4594901..6bfb960992 100644 --- a/src/processes/Processes.ProcessIdentity/ProcessIdentityService.cs +++ b/src/processes/Processes.ProcessIdentity/ProcessIdentityService.cs @@ -17,7 +17,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; diff --git a/src/processes/Processes.ProcessIdentity/Processes.ProcessIdentity.csproj b/src/processes/Processes.ProcessIdentity/Processes.ProcessIdentity.csproj index 7150bf55e9..21ea5015f8 100644 --- a/src/processes/Processes.ProcessIdentity/Processes.ProcessIdentity.csproj +++ b/src/processes/Processes.ProcessIdentity/Processes.ProcessIdentity.csproj @@ -29,6 +29,8 @@ + + diff --git a/src/processes/Processes.Worker.Library/Processes.Worker.Library.csproj b/src/processes/Processes.Worker.Library/Processes.Worker.Library.csproj deleted file mode 100644 index c62fb2652e..0000000000 --- a/src/processes/Processes.Worker.Library/Processes.Worker.Library.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library - Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library - net8.0 - enable - enable - - - - - - - - - - - - - diff --git a/src/processes/Processes.Worker/Processes.Worker.csproj b/src/processes/Processes.Worker/Processes.Worker.csproj index cbd1561d21..f08ad52687 100644 --- a/src/processes/Processes.Worker/Processes.Worker.csproj +++ b/src/processes/Processes.Worker/Processes.Worker.csproj @@ -45,13 +45,14 @@ + - + diff --git a/src/processes/Processes.Worker/Program.cs b/src/processes/Processes.Worker/Program.cs index f8d585a0b2..04cac7d871 100644 --- a/src/processes/Processes.Worker/Program.cs +++ b/src/processes/Processes.Worker/Program.cs @@ -23,11 +23,13 @@ using Org.Eclipse.TractusX.Portal.Backend.ApplicationActivation.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.BpnDidResolver.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Factory; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Config; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Executor; using Org.Eclipse.TractusX.Portal.Backend.Processes.DimUserCreationProcess.Executor.DependencyInjection; @@ -40,7 +42,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Processes.SelfDescriptionCreation.Executor.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Processes.UserProvisioning.Executor; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using Serilog; LoggingExtensions.EnsureInitialized(); @@ -53,8 +54,8 @@ { services .AddMailingAndTemplateManager(hostContext.Configuration) - .AddProcessExecutionService(hostContext.Configuration.GetSection("Processes")) - .AddTransient() + .AddProcessExecutionService(hostContext.Configuration.GetSection("Processes")) + .AddTransient, ApplicationChecklistProcessTypeExecutor>() .AddOfferSubscriptionProcessExecutor(hostContext.Configuration) .AddTechnicalUserProfile() .AddTransient() @@ -69,8 +70,8 @@ .AddInvitationProcessExecutor(hostContext.Configuration) .AddMailingProcessCreation(hostContext.Configuration.GetSection("MailingProcessCreation")) .AddDimUserProcessExecutor(hostContext.Configuration.GetSection("ApplicationChecklist")) - .AddTransient() - .AddTransient() + .AddTransient, IdentityProviderProvisioningProcessTypeExecutor>() + .AddTransient, UserProvisioningProcessTypeExecutor>() .AddSelfDescriptionCreationProcessExecutor(hostContext.Configuration); if (hostContext.HostingEnvironment.IsDevelopment()) @@ -99,7 +100,7 @@ }; Log.Information("Start processing"); - var workerInstance = host.Services.GetRequiredService(); + var workerInstance = host.Services.GetRequiredService>(); await workerInstance.ExecuteAsync(tokenSource.Token).ConfigureAwait(ConfigureAwaitOptions.None); Log.Information("Execution finished shutting down"); } diff --git a/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SdCreationProcessExtensions.cs b/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SdCreationProcessExtensions.cs index 55351420f0..e3c0ae8e15 100644 --- a/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SdCreationProcessExtensions.cs +++ b/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SdCreationProcessExtensions.cs @@ -20,7 +20,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Validation; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.SelfDescriptionCreation.Executor.DependencyInjection; @@ -34,6 +35,6 @@ public static IServiceCollection AddSelfDescriptionCreationProcessExecutor(this .EnvironmentalValidation(section); return services - .AddTransient(); + .AddTransient, SdCreationProcessTypeExecutor>(); } } diff --git a/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SelfDescriptionProcessCollectionExtensions.cs b/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SelfDescriptionProcessCollectionExtensions.cs index 5bb03886ea..27dc9b98d8 100644 --- a/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SelfDescriptionProcessCollectionExtensions.cs +++ b/src/processes/SelfDescriptionCreation.Executor/DependencyInjection/SelfDescriptionProcessCollectionExtensions.cs @@ -18,7 +18,8 @@ ********************************************************************************/ using Microsoft.Extensions.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.SelfDescriptionCreation.Executor.DependencyInjection; @@ -26,5 +27,5 @@ public static class SelfDescriptionProcessCollectionExtensions { public static IServiceCollection AddSelfDescriptionCreationProcessExecutor(this IServiceCollection services) => services - .AddTransient(); + .AddTransient, SdCreationProcessTypeExecutor>(); } diff --git a/src/processes/SelfDescriptionCreation.Executor/SdCreationProcessTypeExecutor.cs b/src/processes/SelfDescriptionCreation.Executor/SdCreationProcessTypeExecutor.cs index bb9a356e09..9bda9fe85b 100644 --- a/src/processes/SelfDescriptionCreation.Executor/SdCreationProcessTypeExecutor.cs +++ b/src/processes/SelfDescriptionCreation.Executor/SdCreationProcessTypeExecutor.cs @@ -19,17 +19,18 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.SelfDescriptionCreation.Executor.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.SelfDescriptionCreation.Executor; public class SdCreationProcessTypeExecutor(IPortalRepositories portalRepositories, ISdFactoryService sdFactoryService, IOptions options) - : IProcessTypeExecutor + : IProcessTypeExecutor { private readonly SelfDescriptionProcessSettings _settings = options.Value; private static readonly IEnumerable ExecutableProcessSteps = [ProcessStepTypeId.SELF_DESCRIPTION_COMPANY_CREATION, ProcessStepTypeId.SELF_DESCRIPTION_CONNECTOR_CREATION]; @@ -40,13 +41,13 @@ public class SdCreationProcessTypeExecutor(IPortalRepositories portalRepositorie public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => new(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { _processId = processId; - return await Task.FromResult(new IProcessTypeExecutor.InitializationResult(false, null)); + return await Task.FromResult(new IProcessTypeExecutor.InitializationResult(false, null)); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { IEnumerable? nextStepTypeIds; ProcessStepStatusId stepStatusId; @@ -68,7 +69,7 @@ public class SdCreationProcessTypeExecutor(IPortalRepositories portalRepositorie modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private async Task<(IEnumerable? NextStepTypeIds, ProcessStepStatusId StepStatusId, bool Modified, string? ProcessMessage)> CreateSdDocumentForCompany(CancellationToken cancellationToken) diff --git a/src/processes/SelfDescriptionCreation.Executor/SelfDescriptionCreation.Executor.csproj b/src/processes/SelfDescriptionCreation.Executor/SelfDescriptionCreation.Executor.csproj index 195c73bf4c..16b4bb4a36 100644 --- a/src/processes/SelfDescriptionCreation.Executor/SelfDescriptionCreation.Executor.csproj +++ b/src/processes/SelfDescriptionCreation.Executor/SelfDescriptionCreation.Executor.csproj @@ -29,8 +29,8 @@ - - + + diff --git a/src/processes/UserProvisioning.Executor/UserProvisioning.Executor.csproj b/src/processes/UserProvisioning.Executor/UserProvisioning.Executor.csproj index 696f9ce7f1..b583778077 100644 --- a/src/processes/UserProvisioning.Executor/UserProvisioning.Executor.csproj +++ b/src/processes/UserProvisioning.Executor/UserProvisioning.Executor.csproj @@ -28,9 +28,10 @@ + - - + + \ No newline at end of file diff --git a/src/processes/UserProvisioning.Executor/UserProvisioningProcessTypeExecutor.cs b/src/processes/UserProvisioning.Executor/UserProvisioningProcessTypeExecutor.cs index c2c1533567..506a8a31fa 100644 --- a/src/processes/UserProvisioning.Executor/UserProvisioningProcessTypeExecutor.cs +++ b/src/processes/UserProvisioning.Executor/UserProvisioningProcessTypeExecutor.cs @@ -18,16 +18,17 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.UserProvisioning.Executor; -public class UserProvisioningProcessTypeExecutor : IProcessTypeExecutor +public class UserProvisioningProcessTypeExecutor : IProcessTypeExecutor { private readonly IPortalRepositories _portalRepositories; private readonly IProvisioningManager _provisioningManager; @@ -52,7 +53,7 @@ public UserProvisioningProcessTypeExecutor(IPortalRepositories portalRepositorie public IEnumerable GetExecutableStepTypeIds() => ExecutableProcessSteps; public ValueTask IsLockRequested(ProcessStepTypeId processStepTypeId) => ValueTask.FromResult(false); - public async ValueTask InitializeProcess(Guid processId, IEnumerable processStepTypeIds) + public async ValueTask.InitializationResult> InitializeProcess(Guid processId, IEnumerable processStepTypeIds) { var userId = await _portalRepositories.GetInstance().GetCompanyUserIdForProcessIdAsync(processId).ConfigureAwait(ConfigureAwaitOptions.None); @@ -62,10 +63,10 @@ public UserProvisioningProcessTypeExecutor(IPortalRepositories portalRepositorie } _userId = userId; _processId = processId; - return new IProcessTypeExecutor.InitializationResult(false, null); + return new IProcessTypeExecutor.InitializationResult(false, null); } - public async ValueTask ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) + public async ValueTask.StepExecutionResult> ExecuteProcessStep(ProcessStepTypeId processStepTypeId, IEnumerable processStepTypeIds, CancellationToken cancellationToken) { if (_userId == Guid.Empty) { @@ -95,7 +96,7 @@ public UserProvisioningProcessTypeExecutor(IPortalRepositories portalRepositorie (stepStatusId, processMessage, nextStepTypeIds) = ProcessError(ex, processStepTypeId); modified = true; } - return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); + return new IProcessTypeExecutor.StepExecutionResult(modified, stepStatusId, nextStepTypeIds, null, processMessage); } private static (ProcessStepStatusId StatusId, string? ProcessMessage, IEnumerable? nextSteps) ProcessError(Exception ex, ProcessStepTypeId processStepTypeId) diff --git a/src/provisioning/Provisioning.Library/Provisioning.Library.csproj b/src/provisioning/Provisioning.Library/Provisioning.Library.csproj index 2f44fb915e..d27e32245e 100644 --- a/src/provisioning/Provisioning.Library/Provisioning.Library.csproj +++ b/src/provisioning/Provisioning.Library/Provisioning.Library.csproj @@ -30,6 +30,8 @@ + + diff --git a/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs b/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs index fd71152960..8e178a9b23 100644 --- a/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs +++ b/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs @@ -19,7 +19,10 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -90,7 +93,7 @@ public class ServiceAccountCreation( var dimRoleData = roleData.ToImmutableList(); var dimSaName = $"dim-{name}"; var dimServiceAccountId = CreateDatabaseServiceAccount(companyId, UserStatusId.PENDING, companyServiceAccountTypeId, CompanyServiceAccountKindId.EXTERNAL, dimSaName, null, description, dimRoleData, serviceAccountsRepository, userRolesRepository, setOptionalParameter); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); if (processData?.ProcessTypeId is not null) { if (processData.ProcessId is null) diff --git a/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs b/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs index dcccba985c..1d7b936dea 100644 --- a/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs +++ b/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; diff --git a/src/registration/ApplicationActivation.Library/ApplicationActivation.Library.csproj b/src/registration/ApplicationActivation.Library/ApplicationActivation.Library.csproj index 9f1cfd1e74..b144fbee90 100644 --- a/src/registration/ApplicationActivation.Library/ApplicationActivation.Library.csproj +++ b/src/registration/ApplicationActivation.Library/ApplicationActivation.Library.csproj @@ -36,6 +36,7 @@ + diff --git a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs index 32ba5df5a0..6e9a2eb70b 100644 --- a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs +++ b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs @@ -25,6 +25,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; @@ -119,7 +121,7 @@ public ApplicationActivationService( throw new ConflictException("ProcessId should be set for external applications"); } - _portalRepositories.GetInstance().CreateProcessStepRange(Enumerable.Repeat(new ValueTuple(ProcessStepTypeId.TRIGGER_CALLBACK_OSP_APPROVED, ProcessStepStatusId.TODO, networkRegistrationProcessId.Value), 1)); + _portalRepositories.GetInstance>().CreateProcessStepRange(Enumerable.Repeat(new ValueTuple(ProcessStepTypeId.TRIGGER_CALLBACK_OSP_APPROVED, ProcessStepStatusId.TODO, networkRegistrationProcessId.Value), 1)); } var notifications = _settings.WelcomeNotificationTypeIds.Select(x => (default(string), x)); diff --git a/src/registration/Registration.Service/BusinessLogic/NetworkBusinessLogic.cs b/src/registration/Registration.Service/BusinessLogic/NetworkBusinessLogic.cs index 832081849d..2613b6ba33 100644 --- a/src/registration/Registration.Service/BusinessLogic/NetworkBusinessLogic.cs +++ b/src/registration/Registration.Service/BusinessLogic/NetworkBusinessLogic.cs @@ -18,14 +18,16 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Model; using System.Collections.Immutable; @@ -92,8 +94,8 @@ public async Task Submit(PartnerSubmitData submitData) .CreateConsents(requiredAgreementIds.Select(agreementId => (agreementId, companyId, userId, ConsentStatusId.ACTIVE))); var entries = await _checklistService.CreateInitialChecklistAsync(companyApplication.CompanyApplicationId); - var processId = _portalRepositories.GetInstance().CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST).Id; - _portalRepositories.GetInstance() + var processId = _portalRepositories.GetInstance>().CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST).Id; + _portalRepositories.GetInstance>() .CreateProcessStepRange( _checklistService .GetInitialProcessStepTypeIds(entries) diff --git a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs index 8bfac441db..8bdc1c4434 100644 --- a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs +++ b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs @@ -22,9 +22,12 @@ using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; @@ -32,7 +35,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; @@ -554,9 +556,9 @@ public async Task SubmitRegistrationAsync(Guid applicationId) var entries = await checklistService.CreateInitialChecklistAsync(applicationId); - var process = portalRepositories.GetInstance().CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST); + var process = portalRepositories.GetInstance>().CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST); - portalRepositories.GetInstance() + portalRepositories.GetInstance>() .CreateProcessStepRange( checklistService .GetInitialProcessStepTypeIds(entries) @@ -967,7 +969,7 @@ private void DeactivateDocuments(IEnumerable documentStatusD private void ScheduleDeleteIdentityProviders(Guid companyId, IEnumerable identityProviderStatusDatas) { var identityProviderRepository = portalRepositories.GetInstance(); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); identityProviderStatusDatas .Where(data => data.IdentityProviderTypeId == IdentityProviderTypeId.MANAGED) @@ -1024,7 +1026,7 @@ private void ScheduleDeleteCompanyUsers(IEnumerable compa .DeleteCompanyUserAssignedRoles( companyUserDatas.SelectMany(data => data.IdentityAssignedRoleIds.Select(roleId => (data.CompanyUserId, roleId)))); - var processStepRepository = portalRepositories.GetInstance(); + var processStepRepository = portalRepositories.GetInstance>(); var processIds = processStepRepository .CreateProcessRange(Enumerable.Repeat(ProcessTypeId.USER_PROVISIONING, companyUserDatas.Count())) .Select(x => x.Id) diff --git a/src/registration/Registration.Service/Registration.Service.csproj b/src/registration/Registration.Service/Registration.Service.csproj index 363f236e6b..88be59064e 100644 --- a/src/registration/Registration.Service/Registration.Service.csproj +++ b/src/registration/Registration.Service/Registration.Service.csproj @@ -53,10 +53,11 @@ + + - diff --git a/src/web/Web.Identity/ClaimsIdentityDataBuilder.cs b/src/web/Web.Identity/ClaimsIdentityDataBuilder.cs index 5ef5e79fcf..26e25dc3b8 100644 --- a/src/web/Web.Identity/ClaimsIdentityDataBuilder.cs +++ b/src/web/Web.Identity/ClaimsIdentityDataBuilder.cs @@ -18,7 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.Web.Identity; diff --git a/src/web/Web.Identity/ClaimsIdentityService.cs b/src/web/Web.Identity/ClaimsIdentityService.cs index faab16f2f8..172fa9b365 100644 --- a/src/web/Web.Identity/ClaimsIdentityService.cs +++ b/src/web/Web.Identity/ClaimsIdentityService.cs @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.Web.Identity; diff --git a/src/web/Web.Identity/ClaimsIdentityServiceCollectionExtensions.cs b/src/web/Web.Identity/ClaimsIdentityServiceCollectionExtensions.cs index bf52e223ac..88cb2834fe 100644 --- a/src/web/Web.Identity/ClaimsIdentityServiceCollectionExtensions.cs +++ b/src/web/Web.Identity/ClaimsIdentityServiceCollectionExtensions.cs @@ -18,7 +18,7 @@ ********************************************************************************/ using Microsoft.Extensions.DependencyInjection; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.Web.Identity; diff --git a/src/web/Web.Identity/IClaimsIdentityDataBuilder.cs b/src/web/Web.Identity/IClaimsIdentityDataBuilder.cs index 5b63e27ac2..ad0f6f0efd 100644 --- a/src/web/Web.Identity/IClaimsIdentityDataBuilder.cs +++ b/src/web/Web.Identity/IClaimsIdentityDataBuilder.cs @@ -17,8 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.Web.Identity; diff --git a/src/web/Web.Identity/MandatoryIdentityClaimHandler.cs b/src/web/Web.Identity/MandatoryIdentityClaimHandler.cs index a5838e5b70..e279e772db 100644 --- a/src/web/Web.Identity/MandatoryIdentityClaimHandler.cs +++ b/src/web/Web.Identity/MandatoryIdentityClaimHandler.cs @@ -22,7 +22,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Security.Claims; namespace Org.Eclipse.TractusX.Portal.Backend.Web.Identity; @@ -67,8 +66,8 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext { PolicyTypeId.ValidIdentity => _identityDataBuilder.IdentityId != Guid.Empty, PolicyTypeId.ValidCompany => (await GetCompanyId().ConfigureAwait(false)) != Guid.Empty, - PolicyTypeId.CompanyUser => _identityDataBuilder.IdentityTypeId == IdentityTypeId.COMPANY_USER, - PolicyTypeId.ServiceAccount => _identityDataBuilder.IdentityTypeId == IdentityTypeId.COMPANY_SERVICE_ACCOUNT, + PolicyTypeId.CompanyUser => _identityDataBuilder.IdentityTypeId == Framework.Identity.IdentityTypeId.COMPANY_USER, + PolicyTypeId.ServiceAccount => _identityDataBuilder.IdentityTypeId == Framework.Identity.IdentityTypeId.COMPANY_SERVICE_ACCOUNT, _ => throw new UnexpectedConditionException($"unexpected PolicyTypeId {requirement.PolicyTypeId}") }) { @@ -86,7 +85,7 @@ private async ValueTask InitializeClaims(ClaimsPrincipal principal) if (Guid.TryParse(preferredUserName, out var identityId)) { _identityDataBuilder.AddIdentityId(identityId); - _identityDataBuilder.AddIdentityTypeId(IdentityTypeId.COMPANY_USER); + _identityDataBuilder.AddIdentityTypeId(Framework.Identity.IdentityTypeId.COMPANY_USER); _identityDataBuilder.Status = IClaimsIdentityDataBuilderStatus.Initialized; return; } @@ -96,7 +95,7 @@ private async ValueTask InitializeClaims(ClaimsPrincipal principal) if (!string.IsNullOrWhiteSpace(clientId) && (serviceAccountData = await _serviceAccountRepository.GetServiceAccountDataByClientId(clientId).ConfigureAwait(ConfigureAwaitOptions.None)) != default) { _identityDataBuilder.AddIdentityId(serviceAccountData.IdentityId); - _identityDataBuilder.AddIdentityTypeId(IdentityTypeId.COMPANY_SERVICE_ACCOUNT); + _identityDataBuilder.AddIdentityTypeId(Framework.Identity.IdentityTypeId.COMPANY_SERVICE_ACCOUNT); _identityDataBuilder.AddCompanyId(serviceAccountData.CompanyId); _identityDataBuilder.Status = IClaimsIdentityDataBuilderStatus.Complete; return; @@ -105,7 +104,7 @@ private async ValueTask InitializeClaims(ClaimsPrincipal principal) var sub = principal.Claims.SingleOrDefault(x => x.Type == PortalClaimTypes.Sub)?.Value; _logger.LogInformation("Preferred user name {PreferredUserName} couldn't be parsed to uuid for sub {Sub}", preferredUserName, sub); - (Guid IdentityId, IdentityTypeId IdentityTypeId, Guid CompanyId) identityData; + (Guid IdentityId, Framework.Identity.IdentityTypeId IdentityTypeId, Guid CompanyId) identityData; if (!string.IsNullOrWhiteSpace(sub) && (identityData = await _identityRepository.GetActiveIdentityDataByUserEntityId(sub).ConfigureAwait(ConfigureAwaitOptions.None)) != default) { _identityDataBuilder.AddIdentityId(identityData.IdentityId); diff --git a/src/web/Web.Identity/Web.Identity.csproj b/src/web/Web.Identity/Web.Identity.csproj index 7246ef47c6..fa2f7b2685 100644 --- a/src/web/Web.Identity/Web.Identity.csproj +++ b/src/web/Web.Identity/Web.Identity.csproj @@ -31,6 +31,7 @@ + diff --git a/src/web/Web.PublicInfos/PublicInformationBusinessLogic.cs b/src/web/Web.PublicInfos/PublicInformationBusinessLogic.cs index f3392c041d..3b370de6ed 100644 --- a/src/web/Web.PublicInfos/PublicInformationBusinessLogic.cs +++ b/src/web/Web.PublicInfos/PublicInformationBusinessLogic.cs @@ -22,9 +22,9 @@ using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Infrastructure; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Reflection; namespace Org.Eclipse.TractusX.Portal.Backend.Web.PublicInfos; diff --git a/src/web/Web.PublicInfos/Web.PublicInfos.csproj b/src/web/Web.PublicInfos/Web.PublicInfos.csproj index 5f48e8b4ff..cdaeb486a2 100644 --- a/src/web/Web.PublicInfos/Web.PublicInfos.csproj +++ b/src/web/Web.PublicInfos/Web.PublicInfos.csproj @@ -33,6 +33,7 @@ + diff --git a/tests/administration/Administration.Service.Tests/Administration.Service.Tests.csproj b/tests/administration/Administration.Service.Tests/Administration.Service.Tests.csproj index d9375f05df..2323e10650 100644 --- a/tests/administration/Administration.Service.Tests/Administration.Service.Tests.csproj +++ b/tests/administration/Administration.Service.Tests/Administration.Service.Tests.csproj @@ -40,6 +40,8 @@ + + diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs index 928b023473..0c29f8aa86 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs @@ -22,7 +22,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; @@ -30,7 +34,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -46,7 +49,7 @@ public class CompanyDataBusinessLogicTests private readonly IConsentRepository _consentRepository; private readonly ICompanyRepository _companyRepository; private readonly ICompanyRolesRepository _companyRolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IDocumentRepository _documentRepository; private readonly ILanguageRepository _languageRepository; private readonly ICompanyCertificateRepository _companyCertificateRepository; @@ -66,7 +69,7 @@ public CompanyDataBusinessLogicTests() _documentRepository = A.Fake(); _languageRepository = A.Fake(); _companyCertificateRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); var issuerComponentBusinessLogic = A.Fake(); _now = _fixture.Create(); @@ -82,7 +85,7 @@ public CompanyDataBusinessLogicTests() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_documentRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_languageRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyCertificateRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _identity.IdentityId).Returns(Guid.NewGuid()); A.CallTo(() => _identity.IdentityTypeId).Returns(IdentityTypeId.COMPANY_USER); @@ -1183,18 +1186,18 @@ public async Task TriggerSelfDescriptionCreation_WithMissingSdDocsForConnectorAn { // Arrange var processId = Guid.NewGuid(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); A.CallTo(() => _processStepRepository.CreateProcess(A._)) .Invokes((ProcessTypeId processTypeId) => { - processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); + processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); }) - .Returns(new Process(processId, default, default)); + .Returns(new Process(processId, default, default)); A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, processId)) .Invokes((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid _) => { - processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); + processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); }); A.CallTo(() => _companyRepository.GetCompanyIdsWithMissingSelfDescription()) .Returns(new[] { Guid.NewGuid(), Guid.NewGuid() }.ToAsyncEnumerable()); @@ -1221,18 +1224,18 @@ public async Task TriggerSelfDescriptionCreation_WithoutMissingSdDocsForCompany_ { // Arrange var processId = Guid.NewGuid(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); A.CallTo(() => _processStepRepository.CreateProcess(A._)) .Invokes((ProcessTypeId processTypeId) => { - processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); + processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); }) - .Returns(new Process(processId, default, default)); + .Returns(new Process(processId, default, default)); A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, processId)) .Invokes((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid _) => { - processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); + processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); }); A.CallTo(() => _companyRepository.GetCompanyIdsWithMissingSelfDescription()) .Returns(Enumerable.Empty().ToAsyncEnumerable()); diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs index a43fe65653..3e9dfd3a70 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs @@ -23,13 +23,16 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -56,7 +59,7 @@ public class ConnectorsBusinessLogicTests private readonly ICompanyRepository _companyRepository; private readonly IOfferSubscriptionsRepository _offerSubscriptionRepository; private readonly IConnectorsRepository _connectorsRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IUserRepository _userRepository; private readonly IPortalRepositories _portalRepositories; private readonly ISdFactoryBusinessLogic _sdFactoryBusinessLogic; @@ -80,7 +83,7 @@ public ConnectorsBusinessLogicTests() _serviceAccountRepository = A.Fake(); _offerSubscriptionRepository = A.Fake(); _identityService = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _portalRepositories = A.Fake(); _identity = A.Fake(); _connectors = new List(); @@ -1316,18 +1319,18 @@ public async Task TriggerSelfDescriptionCreation_WithMissingSdDocsForConnector_C { // Arrange var processId = Guid.NewGuid(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); A.CallTo(() => _processStepRepository.CreateProcess(A._)) .Invokes((ProcessTypeId processTypeId) => { - processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); + processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); }) - .Returns(new Process(processId, default, default)); + .Returns(new Process(processId, default, default)); A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, processId)) .Invokes((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid _) => { - processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); + processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); }); A.CallTo(() => _connectorsRepository.GetConnectorIdsWithMissingSelfDescription()) .Returns(new[] { Guid.NewGuid(), Guid.NewGuid() }.ToAsyncEnumerable()); @@ -1354,18 +1357,18 @@ public async Task TriggerSelfDescriptionCreation_WithoutMissingSdDocsForConnecto { // Arrange var processId = Guid.NewGuid(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); A.CallTo(() => _processStepRepository.CreateProcess(A._)) .Invokes((ProcessTypeId processTypeId) => { - processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); + processes.Add(new Process(processId, processTypeId, Guid.NewGuid())); }) - .Returns(new Process(processId, default, default)); + .Returns(new Process(processId, default, default)); A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, processId)) .Invokes((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid _) => { - processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); + processSteps.Add(new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)); }); A.CallTo(() => _connectorsRepository.GetConnectorIdsWithMissingSelfDescription()) .Returns(Enumerable.Empty().ToAsyncEnumerable()); @@ -1424,11 +1427,10 @@ private void SetupRepositoryMethods() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_countryRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_connectorsRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_documentRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_offerSubscriptionRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); } private void SetupCheckActiveServiceAccountExistsForCompanyAsyncForManaged() diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs index abeaa8bfd8..f2b40c3cfb 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs @@ -20,11 +20,11 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.BusinessLogic; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs index eb0409efcc..a1a5c2f5d0 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; @@ -32,7 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs index 09ad10b725..560d73d125 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs @@ -21,8 +21,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -35,7 +37,7 @@ public class InvitationBusinessLogicTests private static readonly Guid ApplicationId = Guid.NewGuid(); private static readonly Guid CompanyId = Guid.NewGuid(); private readonly IFixture _fixture; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly ICompanyInvitationRepository _companyInvitationRepository; private readonly ICompanyRepository _companyRepository; private readonly IApplicationRepository _applicationRepository; @@ -48,12 +50,12 @@ public InvitationBusinessLogicTests() _fixture.ConfigureFixture(); _portalRepositories = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _companyInvitationRepository = A.Fake(); _companyRepository = A.Fake(); _applicationRepository = A.Fake(); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyInvitationRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_applicationRepository); @@ -83,8 +85,8 @@ public async Task ExecuteInvitation_WithoutEmail_ThrowsControllerArgumentExcepti [Fact] public async Task ExecuteInvitation_WithValidData_CreatesExpected() { - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); var invitations = new List(); SetupFakesForInvite(processes, processSteps, invitations); @@ -100,7 +102,7 @@ public async Task ExecuteInvitation_WithValidData_CreatesExpected() await _sut.ExecuteInvitation(invitationData); processes.Should().ContainSingle().And.Satisfy(x => x.ProcessTypeId == ProcessTypeId.INVITATION); - processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP && x.ProcessStepStatusId == ProcessStepStatusId.TODO); + processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP && x.ProcessStepStatusId == Framework.Processes.Library.Enums.ProcessStepStatusId.TODO); invitations.Should().ContainSingle().And.Satisfy(x => x.ProcessId == processes.Single().Id && x.UserName == "testUserName" && x.ApplicationId == ApplicationId); A.CallTo(() => _companyRepository.CreateCompany(invitationData.OrganisationName, null)).MustHaveHappenedOnceExactly(); A.CallTo(() => _applicationRepository.CreateCompanyApplication(CompanyId, CompanyApplicationStatusId.CREATED, CompanyApplicationTypeId.INTERNAL, null)).MustHaveHappenedOnceExactly(); @@ -157,11 +159,11 @@ public async Task RetriggerCreateCentralIdp_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -170,7 +172,7 @@ public async Task RetriggerCreateCentralIdp_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -180,9 +182,9 @@ public async Task RetriggerCreateCentralIdp_WithNotExistingProcess_ThrowsExcepti { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_USER; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateCentralIdp(process.Id); // Act @@ -202,11 +204,11 @@ public async Task RetriggerCreateSharedIdpServiceAccount_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -215,7 +217,7 @@ public async Task RetriggerCreateSharedIdpServiceAccount_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -225,9 +227,9 @@ public async Task RetriggerCreateSharedIdpServiceAccount_WithNotExistingProcess_ { // Arrange var stepToTrigger = ProcessStepTypeId.INVITATION_CREATE_SHARED_IDP_SERVICE_ACCOUNT; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateDatabaseIdp(process.Id); // Act @@ -247,11 +249,11 @@ public async Task RetriggerUpdateCentralIdpUrls_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_UPDATE_CENTRAL_IDP_URLS; var processStepTypeId = ProcessStepTypeId.INVITATION_UPDATE_CENTRAL_IDP_URLS; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -260,7 +262,7 @@ public async Task RetriggerUpdateCentralIdpUrls_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -270,9 +272,9 @@ public async Task RetriggerUpdateCentralIdpUrls_WithNotExistingProcess_ThrowsExc { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_UPDATE_CENTRAL_IDP_URLS; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateDatabaseIdp(process.Id); // Act @@ -292,11 +294,11 @@ public async Task RetriggerCreateCentralIdpOrgMapper_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -305,7 +307,7 @@ public async Task RetriggerCreateCentralIdpOrgMapper_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -315,9 +317,9 @@ public async Task RetriggerCreateCentralIdpOrgMapper_WithNotExistingProcess_Thro { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_CENTRAL_IDP_ORG_MAPPER; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateCentralIdpOrgMapper(process.Id); // Act @@ -337,11 +339,11 @@ public async Task RetriggerCreateSharedRealmIdpClient_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_REALM; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_SHARED_REALM; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -350,7 +352,7 @@ public async Task RetriggerCreateSharedRealmIdpClient_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -360,9 +362,9 @@ public async Task RetriggerCreateSharedRealmIdpClient_WithNotExistingProcess_Thr { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_SHARED_REALM; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateSharedRealmIdpClient(process.Id); // Act @@ -382,11 +384,11 @@ public async Task RetriggerEnableCentralIdp_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_ENABLE_CENTRAL_IDP; var processStepTypeId = ProcessStepTypeId.INVITATION_ENABLE_CENTRAL_IDP; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -395,7 +397,7 @@ public async Task RetriggerEnableCentralIdp_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -405,9 +407,9 @@ public async Task RetriggerEnableCentralIdp_WithNotExistingProcess_ThrowsExcepti { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_ENABLE_CENTRAL_IDP; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerEnableCentralIdp(process.Id); // Act @@ -427,11 +429,11 @@ public async Task RetriggerCreateDatabaseIdp_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_DATABASE_IDP; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_DATABASE_IDP; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -440,7 +442,7 @@ public async Task RetriggerCreateDatabaseIdp_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -450,9 +452,9 @@ public async Task RetriggerCreateDatabaseIdp_WithNotExistingProcess_ThrowsExcept { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_DATABASE_IDP; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerCreateDatabaseIdp(process.Id); // Act @@ -472,11 +474,11 @@ public async Task RetriggerInvitationCreateUser_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_USER; var processStepTypeId = ProcessStepTypeId.INVITATION_CREATE_USER; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .Returns((true, verifyProcessData)); @@ -485,7 +487,7 @@ public async Task RetriggerInvitationCreateUser_CallsExpected() // Assert processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -495,9 +497,9 @@ public async Task RetriggerInvitationCreateUser_WithNotExistingProcess_ThrowsExc { // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_INVITATION_CREATE_USER; - var process = _fixture.Create(); + var process = _fixture.Create>(); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.INVITATION, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); async Task Act() => await _sut.RetriggerInvitationCreateUser(process.Id); // Act @@ -511,20 +513,20 @@ public async Task RetriggerInvitationCreateUser_WithNotExistingProcess_ThrowsExc #region Setup - private void SetupFakesForInvite(List processes, List processSteps, List invitations) + private void SetupFakesForInvite(List> processes, List> processSteps, List invitations) { var createdProcessId = Guid.NewGuid(); A.CallTo(() => _processStepRepository.CreateProcess(A._)) .ReturnsLazily((ProcessTypeId processTypeId) => { - var process = new Process(createdProcessId, processTypeId, Guid.NewGuid()); + var process = new Process(createdProcessId, processTypeId, Guid.NewGuid()); processes.Add(process); return process; }); - A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, A._)) - .ReturnsLazily((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId) => + A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, A._)) + .ReturnsLazily((ProcessStepTypeId processStepTypeId, Framework.Processes.Library.Enums.ProcessStepStatusId processStepStatusId, Guid processId) => { - var processStep = new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, + var processStep = new ProcessStep(Guid.NewGuid(), processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow); processSteps.Add(processStep); return processStep; @@ -553,12 +555,12 @@ private void SetupFakesForInvite(List processes, List proc }); } - private void SetupFakesForRetrigger(List processSteps) + private void SetupFakesForRetrigger(List> processSteps) { - A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) - .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => + A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) + .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, Framework.Processes.Library.Enums.ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); + processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); }); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/MailBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/MailBusinessLogicTests.cs index f1a885a474..80de4837ce 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/MailBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/MailBusinessLogicTests.cs @@ -21,9 +21,9 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.BusinessLogic; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs index bb0958da2c..fb2ba2406f 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs @@ -22,13 +22,16 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.NetworkRegistration.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; @@ -58,7 +61,7 @@ public class NetworkBusinessLogicTests private readonly IPortalRepositories _portalRepositories; private readonly ICompanyRepository _companyRepository; private readonly ICompanyRolesRepository _companyRolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IApplicationRepository _applicationRepository; private readonly INetworkRepository _networkRepository; private readonly IIdentityProviderRepository _identityProviderRepository; @@ -79,7 +82,7 @@ public NetworkBusinessLogicTests() _companyRepository = A.Fake(); _companyRolesRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _applicationRepository = A.Fake(); _networkRepository = A.Fake(); _identityProviderRepository = A.Fake(); @@ -100,7 +103,7 @@ public NetworkBusinessLogicTests() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRolesRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_applicationRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_networkRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_identityProviderRepository); @@ -374,7 +377,7 @@ public async Task HandlePartnerRegistration_WithUserCreationThrowsException_Thro .Returns(new Company(newCompanyId, null!, default, default)); A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.PARTNER_REGISTRATION)) - .Returns(new Process(processId, default, default)); + .Returns(new Process(processId, default, default)); A.CallTo(() => _userProvisioningService.GetOrCreateCompanyUser(A._, A._, A._, A._, A._, "BPNL00000001TEST")) .Throws(new UnexpectedConditionException("Test message")); @@ -426,8 +429,8 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe var addresses = new List
(); var companies = new List(); var companyAssignedRoles = new List(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); var companyApplications = new List(); var networkRegistrations = new List(); @@ -479,14 +482,14 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.PARTNER_REGISTRATION)) .ReturnsLazily((ProcessTypeId processTypeId) => { - var process = new Process(newProcessId, processTypeId, Guid.NewGuid()); + var process = new Process(newProcessId, processTypeId, Guid.NewGuid()); processes.Add(process); return process; }); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> foo) => { - processSteps.AddRange(foo.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); + processSteps.AddRange(foo.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); }); A.CallTo(() => _applicationRepository.CreateCompanyApplication(A._, A._, A._, A>._)) .ReturnsLazily((Guid companyId, CompanyApplicationStatusId companyApplicationStatusId, CompanyApplicationTypeId applicationTypeId, Action? setOptionalFields) => @@ -520,7 +523,7 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe x.Name == data.Name && x.CompanyStatusId == CompanyStatusId.PENDING); processes.Should().ContainSingle() - .Which.Should().Match( + .Which.Should().Match>( x => x.ProcessTypeId == ProcessTypeId.PARTNER_REGISTRATION); processSteps.Should().HaveCount(2).And.Satisfy( x => x.ProcessStepStatusId == ProcessStepStatusId.TODO && x.ProcessStepTypeId == ProcessStepTypeId.SYNCHRONIZE_USER, @@ -559,8 +562,8 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? var addresses = new List
(); var companies = new List(); var companyAssignedRoles = new List(); - var processes = new List(); - var processSteps = new List(); + var processes = new List>(); + var processSteps = new List>(); var companyApplications = new List(); var networkRegistrations = new List(); var invitations = new List(); @@ -613,14 +616,14 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? A.CallTo(() => _processStepRepository.CreateProcess(A._)) .ReturnsLazily((ProcessTypeId processTypeId) => { - var process = new Process(newProcessId, processTypeId, Guid.NewGuid()); + var process = new Process(newProcessId, processTypeId, Guid.NewGuid()); processes.Add(process); return process; }); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); + processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); }); A.CallTo(() => _applicationRepository.CreateCompanyApplication(A._, A._, A._, A>._)) .ReturnsLazily((Guid companyId, CompanyApplicationStatusId companyApplicationStatusId, CompanyApplicationTypeId applicationTypeId, Action? setOptionalFields) => @@ -659,7 +662,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? x.Name == data.Name && x.CompanyStatusId == CompanyStatusId.PENDING); processes.Should().ContainSingle() - .Which.Should().Match(x => + .Which.Should().Match>(x => x.ProcessTypeId == ProcessTypeId.PARTNER_REGISTRATION); processSteps.Should().HaveCount(2).And.Satisfy( x => x.ProcessStepStatusId == ProcessStepStatusId.TODO && x.ProcessStepTypeId == ProcessStepTypeId.SYNCHRONIZE_USER, diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs index e6a41683d6..f2cca3a5d7 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs @@ -26,7 +26,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; @@ -34,7 +38,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; @@ -69,7 +72,7 @@ public class RegistrationBusinessLogicTest private readonly IApplicationRepository _applicationRepository; private readonly IMailingProcessCreation _mailingProcessCreation; private readonly IIdentityProviderRepository _identityProviderRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IUserRepository _userRepository; private readonly IFixture _fixture; private readonly IRegistrationBusinessLogic _logic; @@ -96,7 +99,7 @@ public RegistrationBusinessLogicTest() _applicationRepository = A.Fake(); _identityProviderRepository = A.Fake(); _documentRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _userRepository = A.Fake(); _companyRepository = A.Fake(); _connectorRepository = A.Fake(); @@ -122,7 +125,7 @@ public RegistrationBusinessLogicTest() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_connectorRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _identityData.IdentityId).Returns(Guid.NewGuid()); A.CallTo(() => _identityData.IdentityTypeId).Returns(IdentityTypeId.COMPANY_USER); @@ -799,11 +802,11 @@ public async Task TriggerChecklistAsync_WithValidData_ReturnsExpected(Applicatio var applicationId = _fixture.Create(); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( applicationId, - new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), + new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), typeId, ImmutableDictionary.Create(), - Enumerable.Empty()); + Enumerable.Empty>()); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(applicationId, typeId, A>._, @@ -1128,11 +1131,11 @@ public async Task RetriggerDeleteIdpSharedRealm_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM; var processStepTypeId = ProcessStepTypeId.DELETE_IDP_SHARED_REALM; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) .Returns((true, verifyProcessData)); @@ -1143,7 +1146,7 @@ public async Task RetriggerDeleteIdpSharedRealm_CallsExpected() processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -1155,7 +1158,7 @@ public async Task RetriggerDeleteIdpSharedRealm_WithNotExistingProcess_ThrowsExc var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM; var processId = Guid.NewGuid(); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); Task Act() => _logic.RetriggerDeleteIdpSharedRealm(processId); @@ -1174,11 +1177,11 @@ public async Task RetriggerDeleteIdpSharedServiceAccount_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT; var processStepTypeId = ProcessStepTypeId.DELETE_IDP_SHARED_SERVICEACCOUNT; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) .Returns((true, verifyProcessData)); @@ -1189,7 +1192,7 @@ public async Task RetriggerDeleteIdpSharedServiceAccount_CallsExpected() processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -1201,7 +1204,7 @@ public async Task RetriggerDeleteIdpSharedServiceAccount_WithNotExistingProcess_ var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT; var processId = Guid.NewGuid(); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); Task Act() => _logic.RetriggerDeleteIdpSharedServiceAccount(processId); @@ -1220,11 +1223,11 @@ public async Task RetriggerDeleteCentralIdentityProvider_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER; var processStepTypeId = ProcessStepTypeId.DELETE_CENTRAL_IDENTITY_PROVIDER; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) .Returns((true, verifyProcessData)); @@ -1235,7 +1238,7 @@ public async Task RetriggerDeleteCentralIdentityProvider_CallsExpected() processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -1247,7 +1250,7 @@ public async Task RetriggerDeleteCentralIdentityProvider_WithNotExistingProcess_ var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER; var processId = Guid.NewGuid(); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); Task Act() => _logic.RetriggerDeleteCentralIdentityProvider(processId); @@ -1266,11 +1269,11 @@ public async Task RetriggerDeleteCentralUser_CallsExpected() // Arrange var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER; var processStepTypeId = ProcessStepTypeId.DELETE_CENTRAL_USER; - var processSteps = new List(); - var process = _fixture.Build().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); + var processSteps = new List>(); + var process = _fixture.Build>().With(x => x.LockExpiryDate, default(DateTimeOffset?)).Create(); var processStepId = Guid.NewGuid(); SetupFakesForRetrigger(processSteps); - var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); + var verifyProcessData = new VerifyProcessData(process, Enumerable.Repeat(new ProcessStep(processStepId, stepToTrigger, Framework.Processes.Library.Enums.ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1)); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) .Returns((true, verifyProcessData)); @@ -1281,7 +1284,7 @@ public async Task RetriggerDeleteCentralUser_CallsExpected() processSteps.Should().ContainSingle().And.Satisfy(x => x.ProcessStepTypeId == processStepTypeId); A.CallTo(() => _processStepRepository.IsValidProcess(process.Id, ProcessTypeId.USER_PROVISIONING, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A? Initialize, Action Modify)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>? Initialize, Action> Modify)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -1293,7 +1296,7 @@ public async Task RetriggerDeleteCentralUser_WithNotExistingProcess_ThrowsExcept var stepToTrigger = ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER; var processId = Guid.NewGuid(); A.CallTo(() => _processStepRepository.IsValidProcess(A._, A._, A>._)) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); Task Act() => _logic.RetriggerDeleteCentralUser(processId); @@ -1349,9 +1352,9 @@ private void SetupForUpdateCompanyBpn(ApplicationChecklistEntry? applicationChec }.ToAsyncEnumerable()); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(IdWithoutBpn, ApplicationChecklistEntryTypeId.BUSINESS_PARTNER_NUMBER, A>._, A._, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create(ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, (ApplicationChecklistEntryStatusId.DONE, default(string?))) }), - Enumerable.Empty())); + Enumerable.Empty>())); } private void SetupForApproveRegistrationVerification(ApplicationChecklistEntry applicationChecklistEntry) @@ -1363,13 +1366,13 @@ private void SetupForApproveRegistrationVerification(ApplicationChecklistEntry a }); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(IdWithoutBpn, ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, A>._, A._, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create(ApplicationChecklistEntryTypeId.BUSINESS_PARTNER_NUMBER, (ApplicationChecklistEntryStatusId.IN_PROGRESS, default(string?))) }), - Enumerable.Empty())); + Enumerable.Empty>())); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(IdWithBpn, ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, A>._, A._, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create(ApplicationChecklistEntryTypeId.BUSINESS_PARTNER_NUMBER, (ApplicationChecklistEntryStatusId.DONE, default(string?))) }), - Enumerable.Empty())); + Enumerable.Empty>())); } private void SetupForDeclineRegistrationVerification(ApplicationChecklistEntry applicationChecklistEntry, CompanyApplication application, Company company, ApplicationChecklistEntryStatusId checklistStatusId, IdentityProviderTypeId idpTypeId) @@ -1381,13 +1384,13 @@ private void SetupForDeclineRegistrationVerification(ApplicationChecklistEntry a }); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(IdWithoutBpn, ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, A>._, A._, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create(ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, (checklistStatusId, default(string?))) }), - Enumerable.Empty())); + Enumerable.Empty>())); A.CallTo(() => _checklistService.VerifyChecklistEntryAndProcessSteps(IdWithBpn, ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, A>._, A._, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(IdWithoutBpn, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.NewGuid(), ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create(ApplicationChecklistEntryTypeId.REGISTRATION_VERIFICATION, (ApplicationChecklistEntryStatusId.DONE, default(string?))) }), - Enumerable.Empty())); + Enumerable.Empty>())); A.CallTo(() => _applicationRepository.GetCompanyIdNameForSubmittedApplication(IdWithBpn)) .Returns((CompanyId, CompanyName, ExistingExternalId, Enumerable.Repeat((IdpId, IamAliasId, idpTypeId, Enumerable.Repeat(UserId, 1)), 1), Enumerable.Repeat(UserId, 1))); @@ -1413,12 +1416,12 @@ private void SetupForDeclineRegistrationVerification(ApplicationChecklistEntry a }); } - private void SetupFakesForRetrigger(List processSteps) + private void SetupFakesForRetrigger(List> processSteps) { - A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) - .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => + A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) + .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, Framework.Processes.Library.Enums.ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); + processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList()); }); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationStatusBusinessLogicTest.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationStatusBusinessLogicTest.cs index 6cd54b6f2f..891eafe796 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationStatusBusinessLogicTest.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/RegistrationStatusBusinessLogicTest.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.DependencyInjection; @@ -28,7 +29,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Security.Cryptography; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.BusinessLogic; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs index 2685551322..a34cf5c096 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs @@ -23,14 +23,19 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; @@ -58,7 +63,7 @@ public class ServiceAccountBusinessLogicTests private readonly ICompanyRepository _companyRepository; private readonly IUserRepository _userRepository; private readonly IUserRolesRepository _userRolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IServiceAccountRepository _serviceAccountRepository; private readonly IConnectorsRepository _connectorsRepository; private readonly IProvisioningManager _provisioningManager; @@ -82,9 +87,10 @@ public ServiceAccountBusinessLogicTests() _userRolesRepository = A.Fake(); _serviceAccountRepository = A.Fake(); _connectorsRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); + _provisioningManager = A.Fake(); _portalRepositories = A.Fake(); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_serviceAccountRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRolesRepository); @@ -689,9 +695,9 @@ public async Task HandleServiceAccountCreationCallback_WithValidOfferSubscriptio { // Arrange const ProcessStepTypeId stepToTrigger = ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE; - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); - var context = new VerifyProcessData(process, [new ProcessStep(Guid.NewGuid(), stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)]); - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var context = new VerifyProcessData(process, [new ProcessStep(Guid.NewGuid(), stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)]); + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) .Returns((ProcessTypeId.OFFER_SUBSCRIPTION, context, Guid.NewGuid(), Guid.NewGuid())); var sut = new ServiceAccountBusinessLogic(_provisioningManager, _portalRepositories, _options, _serviceAccountCreation, _identityService, _serviceAccountManagement); @@ -700,7 +706,7 @@ public async Task HandleServiceAccountCreationCallback_WithValidOfferSubscriptio await sut.HandleServiceAccountCreationCallback(process.Id, _fixture.Create()); // Assert - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -712,9 +718,9 @@ public async Task HandleServiceAccountCreationCallback_WithNotExistingProcess_Th { // Arrange var stepToTrigger = ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE; - var process = new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid()); - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) - .Returns<(ProcessTypeId, VerifyProcessData, Guid?, Guid?)>(default); + var process = new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid()); + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) + .Returns<(ProcessTypeId, VerifyProcessData, Guid?, Guid?)>(default); var sut = new ServiceAccountBusinessLogic(_provisioningManager, _portalRepositories, _options, _serviceAccountCreation, _identityService, _serviceAccountManagement); @@ -724,7 +730,7 @@ public async Task HandleServiceAccountCreationCallback_WithNotExistingProcess_Th var ex = await Assert.ThrowsAsync(Act); // Assert - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); ex.Message.Should().Be($"externalId {process.Id} does not exist"); } @@ -734,9 +740,9 @@ public async Task HandleServiceAccountCreationCallback_WithOfferSubscriptionIdNo { // Arrange const ProcessStepTypeId stepToTrigger = ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE; - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); - var context = new VerifyProcessData(process, [new ProcessStep(Guid.NewGuid(), stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)]); - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var context = new VerifyProcessData(process, [new ProcessStep(Guid.NewGuid(), stepToTrigger, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)]); + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(A._, A>._)) .Returns((ProcessTypeId.OFFER_SUBSCRIPTION, context, null, null)); var sut = new ServiceAccountBusinessLogic(_provisioningManager, _portalRepositories, _options, _serviceAccountCreation, _identityService, _serviceAccountManagement); @@ -747,7 +753,7 @@ public async Task HandleServiceAccountCreationCallback_WithOfferSubscriptionIdNo var ex = await Assert.ThrowsAsync(Act); // Assert - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountCallback(process.Id, A>.That.Matches(x => x.Count() == 1 && x.Single() == stepToTrigger))) .MustHaveHappenedOnceExactly(); ex.Message.Should().Be($"ServiceAccountId must be set for process {process.Id}"); } @@ -870,7 +876,8 @@ private void SetupDeleteOwnCompanyServiceAccount(Connector? connector = null, Id A.CallTo(() => _portalRepositories.GetInstance()).Returns(_connectorsRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRolesRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); } #endregion diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountManagementTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountManagementTests.cs index 34853308b1..1ecf2c6dc6 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountManagementTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountManagementTests.cs @@ -19,6 +19,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -36,7 +40,8 @@ public class ServiceAccountManagementTests private readonly IEnumerable _userRoleIds = Enumerable.Repeat(Guid.NewGuid(), 1); private readonly IUserRepository _userRepository; private readonly IUserRolesRepository _userRolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; + private readonly IServiceAccountRepository _serviceAccountRepository; private readonly IProvisioningManager _provisioningManager; private readonly IFixture _fixture; private readonly ServiceAccountManagement _sut; @@ -50,11 +55,13 @@ public ServiceAccountManagementTests() _userRepository = A.Fake(); _userRolesRepository = A.Fake(); - _processStepRepository = A.Fake(); + _serviceAccountRepository = A.Fake(); + _processStepRepository = A.Fake>(); var portalRepositories = A.Fake(); A.CallTo(() => portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => portalRepositories.GetInstance()).Returns(_userRolesRepository); - A.CallTo(() => portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => portalRepositories.GetInstance()).Returns(_serviceAccountRepository); + A.CallTo(() => portalRepositories.GetInstance>()).Returns(_processStepRepository); _sut = new ServiceAccountManagement(_provisioningManager, portalRepositories); } @@ -80,7 +87,7 @@ public async Task DeleteOwnCompanyServiceAccountAsync_WithoutClient_CallsExpecte // Assert if (isDimServiceAccount) { - A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>.That.Matches(x => x.Count() == 1 && x.First().ProcessStepTypeId == ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER && x.First().ProcessStepStatusId == ProcessStepStatusId.TODO && x.First().ProcessId == processId))).MustHaveHappenedOnceExactly(); + A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>.That.Matches(x => x.Count() == 1 && x.First().ProcessStepTypeId == ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER && x.First().ProcessStepStatusId == ProcessStepStatusId.TODO && x.First().ProcessId == processId))).MustHaveHappenedOnceExactly(); A.CallTo(() => _userRepository.AttachAndModifyIdentity(A._, A>._, A>._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _provisioningManager.DeleteCentralClientAsync(A._)).MustNotHaveHappened(); identity.UserStatusId.Should().Be(UserStatusId.PENDING_DELETION); @@ -114,13 +121,13 @@ private void SetupDeleteOwnCompanyServiceAccount(bool isDimServiceAccount, Ident { if (isDimServiceAccount) { - A.CallTo(() => _processStepRepository.GetProcessDataForServiceAccountDeletionCallback(A._, A>._)) + A.CallTo(() => _serviceAccountRepository.GetProcessDataForServiceAccountDeletionCallback(A._, A>._)) .ReturnsLazily((Guid id, IEnumerable? processStepTypeIds) => ( ProcessTypeId.OFFER_SUBSCRIPTION, - new VerifyProcessData( - new Process(id, ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()), - processStepTypeIds?.Select(stepTypeId => new ProcessStep(Guid.NewGuid(), stepTypeId, ProcessStepStatusId.TODO, id, _fixture.Create())) ?? Enumerable.Empty()), + new VerifyProcessData( + new Process(id, ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()), + processStepTypeIds?.Select(stepTypeId => new ProcessStep(Guid.NewGuid(), stepTypeId, ProcessStepStatusId.TODO, id, _fixture.Create())) ?? Enumerable.Empty>()), Guid.NewGuid())); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs index 7fc154b5d1..791601a000 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs @@ -19,13 +19,15 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -102,9 +104,9 @@ public async Task RetriggerProvider_WithValidInput_ReturnsExpected() // Arrange var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_PROVIDER, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_PROVIDER, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(OfferSubscriptionId, ProcessStepTypeId.RETRIGGER_PROVIDER, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_PROVIDER, _fixture.Create(), new[] { processStep }, _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_PROVIDER, _fixture.Create>(), new[] { processStep }, _portalRepositories)); // Act await _sut.RetriggerProvider(OfferSubscriptionId); @@ -112,7 +114,7 @@ public async Task RetriggerProvider_WithValidInput_ReturnsExpected() // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps( - A._, + A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.TRIGGER_PROVIDER }))) .MustHaveHappenedOnceExactly(); } @@ -123,9 +125,9 @@ public async Task RetriggerCreateClient_WithValidInput_ReturnsExpected() // Arrange var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(OfferSubscriptionId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION, _fixture.Create(), new[] { processStep }, _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_CLIENT_CREATION, _fixture.Create>(), new[] { processStep }, _portalRepositories)); // Act await _sut.RetriggerCreateClient(OfferSubscriptionId); @@ -133,7 +135,7 @@ public async Task RetriggerCreateClient_WithValidInput_ReturnsExpected() // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps( - A._, + A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.OFFERSUBSCRIPTION_CLIENT_CREATION }))) .MustHaveHappenedOnceExactly(); } @@ -144,9 +146,9 @@ public async Task RetriggerCreateTechnicalUser_WithValidInput_ReturnsExpected() // Arrange var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(OfferSubscriptionId, ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION, _fixture.Create(), new[] { processStep }, _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_OFFERSUBSCRIPTION_TECHNICALUSER_CREATION, _fixture.Create>(), new[] { processStep }, _portalRepositories)); // Act await _sut.RetriggerCreateTechnicalUser(OfferSubscriptionId); @@ -154,7 +156,7 @@ public async Task RetriggerCreateTechnicalUser_WithValidInput_ReturnsExpected() // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps( - A._, + A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.OFFERSUBSCRIPTION_TECHNICALUSER_CREATION }))) .MustHaveHappenedOnceExactly(); } @@ -165,9 +167,9 @@ public async Task RetriggerProviderCallback_WithValidInput_ReturnsExpected() // Arrange var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_PROVIDER_CALLBACK, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.RETRIGGER_PROVIDER_CALLBACK, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(OfferSubscriptionId, ProcessStepTypeId.RETRIGGER_PROVIDER_CALLBACK, null, false)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_PROVIDER_CALLBACK, _fixture.Create(), new[] { processStep }, _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.RETRIGGER_PROVIDER_CALLBACK, _fixture.Create>(), new[] { processStep }, _portalRepositories)); // Act await _sut.RetriggerProviderCallback(OfferSubscriptionId); @@ -175,7 +177,7 @@ public async Task RetriggerProviderCallback_WithValidInput_ReturnsExpected() // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps( - A._, + A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.TRIGGER_PROVIDER_CALLBACK }))) .MustHaveHappenedOnceExactly(); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs index c8880aa92b..ef0519bc80 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; @@ -32,7 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs index fdd434b18a..391358a901 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs @@ -22,11 +22,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; diff --git a/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs index 026b345aea..7106a2de90 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs @@ -20,11 +20,11 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Net; diff --git a/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs index ea7e0cd7e7..f77766bfe5 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs @@ -21,10 +21,9 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs index 2f6fbb1376..f6a3606216 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs @@ -19,9 +19,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Text; diff --git a/tests/administration/Administration.Service.Tests/Controllers/MailControllerTest.cs b/tests/administration/Administration.Service.Tests/Controllers/MailControllerTest.cs index fd2e40d409..10e8f1e88b 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/MailControllerTest.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/MailControllerTest.cs @@ -21,8 +21,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Controllers; diff --git a/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs b/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs index 23b73ca995..19933fad7d 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs @@ -23,9 +23,9 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Text; diff --git a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs index 685090c971..cfed716fba 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs @@ -20,10 +20,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs index c80f11393b..4efccefa59 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs @@ -20,9 +20,8 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Controllers; diff --git a/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs b/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs index fc06249ecf..00b75737f6 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs @@ -20,8 +20,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Controllers; diff --git a/tests/externalsystems/BpnDidResolver.Library.Tests/BpnDidResolverBusinessLogicTests.cs b/tests/externalsystems/BpnDidResolver.Library.Tests/BpnDidResolverBusinessLogicTests.cs index 069d3e5146..11b319664c 100644 --- a/tests/externalsystems/BpnDidResolver.Library.Tests/BpnDidResolverBusinessLogicTests.cs +++ b/tests/externalsystems/BpnDidResolver.Library.Tests/BpnDidResolverBusinessLogicTests.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.BpnDidResolver.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/tests/externalsystems/Clearinghouse.Library.Tests/ClearinghouseBusinessLogicTests.cs b/tests/externalsystems/Clearinghouse.Library.Tests/ClearinghouseBusinessLogicTests.cs index 081feb5958..f5f2227d85 100644 --- a/tests/externalsystems/Clearinghouse.Library.Tests/ClearinghouseBusinessLogicTests.cs +++ b/tests/externalsystems/Clearinghouse.Library.Tests/ClearinghouseBusinessLogicTests.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -442,7 +443,7 @@ private void SetupForProcessClearinghouseResponse(ApplicationChecklistEntry appl ProcessStepTypeId.AWAIT_CLEARING_HOUSE_RESPONSE, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.CLEARING_HOUSE, ImmutableDictionary.Empty, new List())); + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.CLEARING_HOUSE, ImmutableDictionary.Empty, new List>())); } private void SetupForCheckEndClearinghouseProcesses(IEnumerable applicationChecklistEntries) @@ -472,7 +473,7 @@ private void SetupForCheckEndClearinghouseProcesses(IEnumerable? _, IEnumerable? _) => new IApplicationChecklistService.ManualChecklistProcessStepData( id, - new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), + new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.CLEARING_HOUSE, ImmutableDictionary.Empty, diff --git a/tests/externalsystems/Custodian.Library.Tests/CustodianBusinessLogicTests.cs b/tests/externalsystems/Custodian.Library.Tests/CustodianBusinessLogicTests.cs index 98803e326d..13870d77f2 100644 --- a/tests/externalsystems/Custodian.Library.Tests/CustodianBusinessLogicTests.cs +++ b/tests/externalsystems/Custodian.Library.Tests/CustodianBusinessLogicTests.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; diff --git a/tests/externalsystems/Dim.Library.Tests/DimBusinessLogicTests.cs b/tests/externalsystems/Dim.Library.Tests/DimBusinessLogicTests.cs index a7a22389e7..c96cd7e163 100644 --- a/tests/externalsystems/Dim.Library.Tests/DimBusinessLogicTests.cs +++ b/tests/externalsystems/Dim.Library.Tests/DimBusinessLogicTests.cs @@ -25,6 +25,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -294,10 +296,10 @@ public async Task ProcessDimResponse_WithMultipleSubmittedApplications_ThrowsCon public async Task ProcessDimResponse_WithDidSchemaInvalid_CallsExpected() { // Arrange - var context = new IApplicationChecklistService.ManualChecklistProcessStepData(ApplicationId, _fixture.Create(), Guid.NewGuid(), ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new Dictionary>() + var context = new IApplicationChecklistService.ManualChecklistProcessStepData(ApplicationId, _fixture.Create>(), Guid.NewGuid(), ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new Dictionary>() { { ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new(ApplicationChecklistEntryStatusId.TO_DO, string.Empty) } - }.ToImmutableDictionary(), Enumerable.Empty()); + }.ToImmutableDictionary(), Enumerable.Empty>()); var didDocument = JsonDocument.Parse("{\n \"@context\": [\n \"https://www.w3.org/ns/did/v1\",\n \"https://w3id.org/security/suites/ed25519-2020/v1\"\n ],\n \"id\": \"did:web:example.com:did:BPNL0000000000XX\",\n \"verificationMethod\": [\n {\n \"id\": [\"did:web:example.com:did:BPNL0000000000XX#key-0\"],\n \"type\": \"JsonWebKey2020\",\n \"publicKeyJwk\": {\n \"kty\": \"JsonWebKey2020\",\n \"crv\": \"Ed25519\",\n \"x\": \"3534354354353\"\n }\n }\n ],\n \"services\": [\n {\n \"id\": [\"did:web:example.com:did:BPNL0000000000XX#key-0\"],\n \"type\": \"CredentialStore\",\n \"serviceEndpoint\": \"test.org:123\"\n }\n ]\n}"); var data = _fixture.Build() .With(x => x.DidDocument, didDocument) @@ -323,10 +325,10 @@ public async Task ProcessDimResponse_WithDidSchemaInvalid_CallsExpected() public async Task ProcessDimResponse_WithFailingSchemaValidation_CallsExpected() { // Arrange - var context = new IApplicationChecklistService.ManualChecklistProcessStepData(ApplicationId, _fixture.Create(), Guid.NewGuid(), ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new Dictionary>() + var context = new IApplicationChecklistService.ManualChecklistProcessStepData(ApplicationId, _fixture.Create>(), Guid.NewGuid(), ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new Dictionary>() { { ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new (ApplicationChecklistEntryStatusId.TO_DO, string.Empty )} - }.ToImmutableDictionary(), Enumerable.Empty()); + }.ToImmutableDictionary(), Enumerable.Empty>()); var didDocument = JsonDocument.Parse("{\n \"@context\": [\n \"abc\" ],\n \"id\": \"did:web:example.org:did:BPNL0000000000XX\",\n \"verificationMethod\": [\n {\n \"id\": [\"did:web:example.com:did:BPNL0000000000XX#key-0\"],\n \"publicKeyJwk\": {\n \"kty\": \"JsonWebKey2020\",\n \"crv\": \"Ed25519\",\n \"x\": \"3534354354353\"\n }\n }\n ],\n \"services\": [\n {\n \"id\": [\"did:web:example.com:did:BPNL0000000000XX#key-0\"],\n \"serviceEndpoint\": \"test.org:123\"\n }\n ]\n}"); var data = _fixture.Build().With(x => x.DidDocument, didDocument).With(x => x.Did, "did:web:example.org:did:BPNL0000000000XX").Create(); var companyId = Guid.NewGuid(); @@ -351,11 +353,11 @@ public async Task ProcessDimResponse_WithValid_CallsExpected() // Arrange var context = new IApplicationChecklistService.ManualChecklistProcessStepData( ApplicationId, - _fixture.Create(), + _fixture.Create>(), Guid.NewGuid(), ApplicationChecklistEntryTypeId.IDENTITY_WALLET, ImmutableDictionary.CreateRange(new[] { KeyValuePair.Create>(ApplicationChecklistEntryTypeId.IDENTITY_WALLET, new(ApplicationChecklistEntryStatusId.TO_DO, string.Empty)) }), - Enumerable.Empty()); + Enumerable.Empty>()); const string jsonData = """ { diff --git a/tests/externalsystems/IssuerComponent.Library.Tests/IssuerComponentBusinessLogicTests.cs b/tests/externalsystems/IssuerComponent.Library.Tests/IssuerComponentBusinessLogicTests.cs index 8255dbf1f8..87ec8a95e4 100644 --- a/tests/externalsystems/IssuerComponent.Library.Tests/IssuerComponentBusinessLogicTests.cs +++ b/tests/externalsystems/IssuerComponent.Library.Tests/IssuerComponentBusinessLogicTests.cs @@ -21,6 +21,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.IssuerComponent.Library.Models; @@ -271,7 +273,7 @@ public async Task StoreBpnlCredential_WithSuccessful_UpdatesEntry() ProcessStepTypeId.AWAIT_BPN_CREDENTIAL_RESPONSE, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.BPNL_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty())); + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.BPNL_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty>())); SetupForProcessIssuerComponentResponse(entry); // Act @@ -297,7 +299,7 @@ public async Task StoreBpnlCredential_WithUnsuccessful_UpdatesEntry() ProcessStepTypeId.AWAIT_MEMBERSHIP_CREDENTIAL_RESPONSE, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty())); + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty>())); SetupForProcessIssuerComponentResponse(entry); // Act @@ -490,7 +492,7 @@ public async Task StoreMembershipCredential_WithSuccessful_UpdatesEntry() ProcessStepTypeId.AWAIT_MEMBERSHIP_CREDENTIAL_RESPONSE, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty())); + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty>())); SetupForProcessIssuerComponentResponse(entry); // Act @@ -516,7 +518,7 @@ public async Task StoreMembershipCredential_WithUnsuccessful_UpdatesEntry() ProcessStepTypeId.AWAIT_MEMBERSHIP_CREDENTIAL_RESPONSE, A?>._, A?>._)) - .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty())); + .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(Guid.Empty, new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()), Guid.Empty, ApplicationChecklistEntryTypeId.MEMBERSHIP_CREDENTIAL, ImmutableDictionary.Empty, Enumerable.Empty>())); SetupForProcessIssuerComponentResponse(entry); // Act diff --git a/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs b/tests/externalsystems/OfferProvider.Library.Tests/BusinessLogic/OfferProviderBusinessLogicTests.cs similarity index 99% rename from tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs rename to tests/externalsystems/OfferProvider.Library.Tests/BusinessLogic/OfferProviderBusinessLogicTests.cs index c9e4ee79fa..69b2af72e5 100644 --- a/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs +++ b/tests/externalsystems/OfferProvider.Library.Tests/BusinessLogic/OfferProviderBusinessLogicTests.cs @@ -19,6 +19,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/tests/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj b/tests/externalsystems/OfferProvider.Library.Tests/OfferProvider.Library.Tests.csproj similarity index 100% rename from tests/externalsystems/OfferProvider.Library/OfferProvider.Library.csproj rename to tests/externalsystems/OfferProvider.Library.Tests/OfferProvider.Library.Tests.csproj diff --git a/tests/externalsystems/OfferProvider.Library/OfferProviderServiceTests.cs b/tests/externalsystems/OfferProvider.Library.Tests/OfferProviderServiceTests.cs similarity index 100% rename from tests/externalsystems/OfferProvider.Library/OfferProviderServiceTests.cs rename to tests/externalsystems/OfferProvider.Library.Tests/OfferProviderServiceTests.cs diff --git a/tests/externalsystems/OfferProvider.Library/Usings.cs b/tests/externalsystems/OfferProvider.Library.Tests/Usings.cs similarity index 100% rename from tests/externalsystems/OfferProvider.Library/Usings.cs rename to tests/externalsystems/OfferProvider.Library.Tests/Usings.cs diff --git a/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs b/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs index b38704bb70..e490db4448 100644 --- a/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs +++ b/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/tests/externalsystems/SdFactory.Library.Tests/SdFactoryBusinessLogicTests.cs b/tests/externalsystems/SdFactory.Library.Tests/SdFactoryBusinessLogicTests.cs index 8dfca4a967..4e5fb86544 100644 --- a/tests/externalsystems/SdFactory.Library.Tests/SdFactoryBusinessLogicTests.cs +++ b/tests/externalsystems/SdFactory.Library.Tests/SdFactoryBusinessLogicTests.cs @@ -19,6 +19,8 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -39,7 +41,7 @@ public class SdFactoryBusinessLogicTests private const string CountryCode = "DE"; private const string Bpn = "BPNL000000000009"; private static readonly Guid ApplicationId = new("ac1cf001-7fbc-1f2f-817f-bce058020001"); - private readonly Process _process; + private readonly Process _process; private static readonly Guid CompanyId = new("b4697623-dd87-410d-abb8-6d4f4d87ab58"); private static readonly IEnumerable<(UniqueIdentifierId Id, string Value)> UniqueIdentifiers = new List<(UniqueIdentifierId Id, string Value)> @@ -65,7 +67,7 @@ public SdFactoryBusinessLogicTests() _fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); _fixture.ConfigureFixture(); - _process = _fixture.Create(); + _process = _fixture.Create>(); _documents = new HashSet(); _applicationRepository = A.Fake(); @@ -546,7 +548,7 @@ private void SetupForProcessFinish(Company company, ApplicationChecklistEntry ap .Returns(new IApplicationChecklistService.ManualChecklistProcessStepData(ApplicationId, _process, Guid.NewGuid(), ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP, ImmutableDictionary.Empty, - Enumerable.Empty())); + Enumerable.Empty>())); A.CallTo(() => _checklistService.FinalizeChecklistEntryAndProcessSteps( A._, A>._, A>._, A>._)) diff --git a/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs b/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs index 2e8f9f0d50..cd91cc60e2 100644 --- a/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs +++ b/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs @@ -18,8 +18,6 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using System.Text.RegularExpressions; - namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Tests; public class ValidationExpressionsTests diff --git a/tests/maintenance/Maintenance.App.Tests/MaintenanceServiceTests.cs b/tests/maintenance/Maintenance.App.Tests/MaintenanceServiceTests.cs index 3265313e87..f97c996aa3 100644 --- a/tests/maintenance/Maintenance.App.Tests/MaintenanceServiceTests.cs +++ b/tests/maintenance/Maintenance.App.Tests/MaintenanceServiceTests.cs @@ -19,8 +19,8 @@ using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.BusinessLogic; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; using Org.Eclipse.TractusX.Portal.Backend.Maintenance.App.Services; -using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Maintenance.App.Tests; diff --git a/tests/marketplace/Apps.Service.Tests/Apps.Service.Tests.csproj b/tests/marketplace/Apps.Service.Tests/Apps.Service.Tests.csproj index f00fc38ba2..2cd393525f 100644 --- a/tests/marketplace/Apps.Service.Tests/Apps.Service.Tests.csproj +++ b/tests/marketplace/Apps.Service.Tests/Apps.Service.Tests.csproj @@ -46,6 +46,7 @@ + diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs index cdd5c1807a..470df0beb3 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs @@ -23,6 +23,7 @@ using FluentAssertions; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -32,7 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Collections.Immutable; using Xunit; diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs index 7a4bfe3fc6..d9d4ba18e7 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -36,7 +37,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs index dc721b4fec..dd6d09370e 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs @@ -24,6 +24,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -34,7 +35,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs index c43b585c2b..c9364952dc 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs @@ -23,9 +23,9 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs index 69e1decc5a..513cc0bd68 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs @@ -23,11 +23,11 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs index f998dbe29d..ca8e2c2711 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs @@ -24,11 +24,11 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Offer.Library.Web.Tests/Offer.Library.Web.Tests.csproj b/tests/marketplace/Offer.Library.Web.Tests/Offer.Library.Web.Tests.csproj index f587bbed8f..f4f9b8d0ae 100644 --- a/tests/marketplace/Offer.Library.Web.Tests/Offer.Library.Web.Tests.csproj +++ b/tests/marketplace/Offer.Library.Web.Tests/Offer.Library.Web.Tests.csproj @@ -44,6 +44,7 @@ + diff --git a/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs b/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs index f7ee1dfe16..b21b8c25fe 100644 --- a/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs +++ b/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs @@ -18,12 +18,12 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/marketplace/Offers.Library.Tests/Offers.Library.Tests.csproj b/tests/marketplace/Offers.Library.Tests/Offers.Library.Tests.csproj index b75d72864c..d8e1f39f56 100644 --- a/tests/marketplace/Offers.Library.Tests/Offers.Library.Tests.csproj +++ b/tests/marketplace/Offers.Library.Tests/Offers.Library.Tests.csproj @@ -44,6 +44,8 @@ + + diff --git a/tests/marketplace/Offers.Library.Tests/Service/ExtensionsTest.cs b/tests/marketplace/Offers.Library.Tests/Service/ExtensionsTest.cs index 0c649e318e..310b390a2e 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/ExtensionsTest.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/ExtensionsTest.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs index 310292217f..43c6b68db2 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; @@ -26,7 +27,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs index dfeea8f904..81ec2ba567 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs @@ -20,15 +20,17 @@ using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; @@ -697,7 +699,6 @@ public async Task StartAutoSetupAsync_WithWrongStatue_ThrowsConflictException(Of // Assert var ex = await Assert.ThrowsAsync(Act); ex.Message.Should().Be("Status of the offer subscription must be pending"); - } [Theory] @@ -761,14 +762,14 @@ public async Task StartAutoSetupAsync_WithValidSingleInstance_ThrowsConflictExce .With(x => x.AppInstanceIds, [Guid.NewGuid()]) .Create(); var offerSubscriptionId = Guid.NewGuid(); - var process = _fixture.Create(); + var process = _fixture.Create>(); var data = new OfferAutoSetupData(offerSubscriptionId, "https://www.test.de"); A.CallTo(() => _offerSubscriptionsRepository.GetOfferDetailsAndCheckProviderCompany(offerSubscriptionId, _companyId, offerTypeId)) .Returns(transferData); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscriptionId, ProcessStepTypeId.AWAIT_START_AUTOSETUP, null, false)) - .Returns(new ManualProcessStepData( + .Returns(new ManualProcessStepData( ProcessStepTypeId.AWAIT_START_AUTOSETUP, process, [ @@ -797,14 +798,14 @@ public async Task StartAutoSetupAsync_WithValidMultiInstance_ReturnsExpected(Off .With(x => x.AppInstanceIds, [Guid.NewGuid(), Guid.NewGuid()]) .Create(); var offerSubscriptionId = Guid.NewGuid(); - var process = _fixture.Create(); + var process = _fixture.Create>(); var data = new OfferAutoSetupData(offerSubscriptionId, "https://www.test.de"); A.CallTo(() => _offerSubscriptionsRepository.GetOfferDetailsAndCheckProviderCompany(offerSubscriptionId, _companyId, offerTypeId)) .Returns(transferData); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscriptionId, ProcessStepTypeId.AWAIT_START_AUTOSETUP, null, false)) - .Returns(new ManualProcessStepData( + .Returns(new ManualProcessStepData( ProcessStepTypeId.AWAIT_START_AUTOSETUP, process, [ @@ -822,7 +823,7 @@ public async Task StartAutoSetupAsync_WithValidMultiInstance_ReturnsExpected(Off ? ProcessStepTypeId.OFFERSUBSCRIPTION_CLIENT_CREATION : ProcessStepTypeId.OFFERSUBSCRIPTION_TECHNICALUSER_CREATION; A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps( - A._, + A>._, A>.That.IsSameSequenceAs(new[] { nextStepId }))) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); @@ -916,11 +917,11 @@ public async Task CreateSingleInstanceSubscriptionDetail_WithWrongCompanyId_Thro public async Task CreateSingleInstanceSubscriptionDetail_WithValidData_ReturnsExpected() { // Arrange - var process = _fixture.Create(); - var manualProcessStepData = new ManualProcessStepData( + var process = _fixture.Create>(); + var manualProcessStepData = new ManualProcessStepData( ProcessStepTypeId.SINGLE_INSTANCE_SUBSCRIPTION_DETAILS_CREATION, process, - Enumerable.Repeat(new ProcessStep(Guid.NewGuid(), + Enumerable.Repeat(new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.SINGLE_INSTANCE_SUBSCRIPTION_DETAILS_CREATION, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow), 1), _portalRepositories); @@ -948,7 +949,7 @@ public async Task CreateSingleInstanceSubscriptionDetail_WithValidData_ReturnsEx // Assert detail.AppSubscriptionUrl.Should().Be("https://www.test.de"); - A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) + A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } @@ -1235,18 +1236,18 @@ public async Task ActivateSubscription_WithValidData_ReturnsExpected() { // Arrange var offerSubscription = new OfferSubscription(Guid.NewGuid(), _validOfferId, CompanyUserCompanyId, OfferSubscriptionStatusId.PENDING, _companyUserId, default); - var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); + var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionsRepository.CheckOfferSubscriptionForProvider(offerSubscription.Id, _companyId)) .Returns(true); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscription.Id, ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create(), [processStep], _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create>(), [processStep], _portalRepositories)); // Act await _sut.TriggerActivateSubscription(offerSubscription.Id); // Assert - A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) + A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()) .MustHaveHappenedOnceExactly(); @@ -1280,14 +1281,14 @@ public async Task ActivateSingleInstanceSubscription_WithValidData_ReturnsExpect // Arrange var offerSubscription = new OfferSubscription(Guid.NewGuid(), _validOfferId, CompanyUserCompanyId, OfferSubscriptionStatusId.PENDING, _companyUserId, default); var offerSubscriptionProcessDataId = Guid.NewGuid(); - var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); + var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); A.CallTo(() => _notificationService.CreateNotificationsWithExistenceCheck(A>._, null, A>._, A._, A._, A._, A._)) .Returns(new[] { Guid.NewGuid() }.AsFakeIAsyncEnumerable(out var createNotificationsEnumerator)); A.CallTo(() => _offerSubscriptionsRepository.GetSubscriptionActivationDataByIdAsync(offerSubscription.Id)) .Returns(new SubscriptionActivationData(_validOfferId, OfferSubscriptionStatusId.PENDING, OfferTypeId.APP, "Test App", "Stark Industries", _companyId, requesterEmail, "Tony", "Stark", Guid.NewGuid(), new(true, null), [Guid.NewGuid()], offerSubscriptionProcessDataId, Guid.NewGuid(), _companyId, null, Enumerable.Empty(), true)); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscription.Id, ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, _fixture.Create(), [processStep], _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, _fixture.Create>(), [processStep], _portalRepositories)); A.CallTo(() => _notificationRepository.CheckNotificationExistsForParam(A._, A._, A._, A._)) .Returns(false); @@ -1341,7 +1342,7 @@ public async Task ActivateMultipleInstancesSubscription_WithValidData_ReturnsExp // Arrange var offerSubscription = new OfferSubscription(Guid.NewGuid(), _validOfferId, CompanyUserCompanyId, OfferSubscriptionStatusId.PENDING, _companyUserId, default); var offerSubscriptionProcessDataId = Guid.NewGuid(); - var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); + var processStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, Guid.NewGuid(), DateTimeOffset.Now); var clientClientId = _fixture.Create(); var serviceAccountClientIds = _fixture.CreateMany().ToImmutableArray(); @@ -1351,7 +1352,7 @@ public async Task ActivateMultipleInstancesSubscription_WithValidData_ReturnsExp A.CallTo(() => _offerSubscriptionsRepository.GetSubscriptionActivationDataByIdAsync(offerSubscription.Id)) .Returns(new SubscriptionActivationData(_validOfferId, OfferSubscriptionStatusId.PENDING, OfferTypeId.APP, "Test App", "Stark Industries", _companyId, requesterEmail, "Tony", "Stark", Guid.NewGuid(), new(false, null), [Guid.NewGuid()], offerSubscriptionProcessDataId, Guid.NewGuid(), _companyId, clientClientId, serviceAccountClientIds, hasCallbackUrl)); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscription.Id, ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, _fixture.Create(), [processStep], _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.ACTIVATE_SUBSCRIPTION, _fixture.Create>(), [processStep], _portalRepositories)); A.CallTo(() => _notificationRepository.CheckNotificationExistsForParam(A._, A._, A._, A._)) .Returns(false); @@ -1415,9 +1416,9 @@ public async Task TriggerActivateSubscription_WithCompanyNotProvider_ThrowsNotFo var offerSubscriptionId = Guid.NewGuid(); var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscriptionId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create(), [processStep], _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create>(), [processStep], _portalRepositories)); A.CallTo(() => _offerSubscriptionsRepository.CheckOfferSubscriptionForProvider(offerSubscriptionId, _identityService.IdentityData.CompanyId)) .Returns(false); @@ -1436,9 +1437,9 @@ public async Task TriggerActivateSubscription_WithNotExistingOfferSubscription_T var offerSubscriptionId = Guid.NewGuid(); var processStepId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processStep = new ProcessStep(processStepId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); + var processStep = new ProcessStep(processStepId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, ProcessStepStatusId.TODO, processId, DateTimeOffset.Now); A.CallTo(() => _offerSubscriptionProcessService.VerifySubscriptionAndProcessSteps(offerSubscriptionId, ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, null, true)) - .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create(), [processStep], _portalRepositories)); + .Returns(new ManualProcessStepData(ProcessStepTypeId.MANUAL_TRIGGER_ACTIVATE_SUBSCRIPTION, _fixture.Create>(), [processStep], _portalRepositories)); A.CallTo(() => _offerSubscriptionsRepository.CheckOfferSubscriptionForProvider(offerSubscriptionId, _identityService.IdentityData.CompanyId)) .Returns(true); @@ -1446,7 +1447,7 @@ public async Task TriggerActivateSubscription_WithNotExistingOfferSubscription_T await _sut.TriggerActivateSubscription(offerSubscriptionId); // Assert - A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) + A.CallTo(() => _offerSubscriptionProcessService.FinalizeProcessSteps(A>._, A>.That.IsSameSequenceAs(new[] { ProcessStepTypeId.ACTIVATE_SUBSCRIPTION }))) .MustHaveHappenedOnceExactly(); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs index 7c93d9150d..c9409c4b4c 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs @@ -18,14 +18,16 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using System.Collections.Immutable; @@ -65,7 +67,7 @@ public class OfferSubscriptionServiceTests private readonly IUserRepository _userRepository; private readonly IUserRolesRepository _userRolesRepository; private readonly IMailingProcessCreation _mailingProcessCreation; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IIdentityService _identityService; private readonly OfferSubscriptionService _sut; @@ -106,7 +108,7 @@ public OfferSubscriptionServiceTests() _offerRepository = A.Fake(); _offerSubscriptionsRepository = A.Fake(); _notificationRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _userRepository = A.Fake(); _userRolesRepository = A.Fake(); _mailingProcessCreation = A.Fake(); @@ -607,7 +609,7 @@ private void SetupRepositories() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_offerRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_offerSubscriptionsRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_notificationRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRolesRepository); _fixture.Inject(_portalRepositories); diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs index 6dbb3a41cf..58a8d5802a 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs @@ -23,6 +23,7 @@ using FluentAssertions; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -32,7 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; using System.Collections.Immutable; diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs index d78467bf90..0a19a5c685 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs @@ -23,6 +23,7 @@ using FluentAssertions; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -33,7 +34,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs index b5a1c8ee57..a0d1ba6db9 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs @@ -20,8 +20,7 @@ using AutoFixture; using FakeItEasy; using Microsoft.AspNetCore.Mvc; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs index e5b4ad377f..c51bdf1cfe 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs @@ -21,11 +21,11 @@ using FakeItEasy; using FluentAssertions; using Microsoft.AspNetCore.Mvc; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs index 527753f748..8f17210a88 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs @@ -21,11 +21,11 @@ using FakeItEasy; using FluentAssertions; using Microsoft.AspNetCore.Mvc; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; diff --git a/tests/marketplace/Services.Service.Tests/Services.Service.Tests.csproj b/tests/marketplace/Services.Service.Tests/Services.Service.Tests.csproj index 2c7756a205..1b7ce674a1 100644 --- a/tests/marketplace/Services.Service.Tests/Services.Service.Tests.csproj +++ b/tests/marketplace/Services.Service.Tests/Services.Service.Tests.csproj @@ -46,6 +46,7 @@ + diff --git a/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs b/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs index 5f1ed6d718..4e6ad0b94f 100644 --- a/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs +++ b/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs @@ -23,6 +23,7 @@ using FluentAssertions; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.ErrorHandling; @@ -32,7 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Xunit; diff --git a/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs b/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs index c3f1d7b19b..5fa8c630f3 100644 --- a/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs +++ b/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs @@ -21,13 +21,13 @@ using FakeItEasy; using FluentAssertions; using Microsoft.AspNetCore.Mvc; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using Xunit; diff --git a/tests/notifications/Notifications.Service.Tests/Notifications.Service.Tests.csproj b/tests/notifications/Notifications.Service.Tests/Notifications.Service.Tests.csproj index fb655a7503..d9d599f7c6 100644 --- a/tests/notifications/Notifications.Service.Tests/Notifications.Service.Tests.csproj +++ b/tests/notifications/Notifications.Service.Tests/Notifications.Service.Tests.csproj @@ -45,6 +45,7 @@ + diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs index 6bc9643f87..19d86aa76c 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/LockableProcessEntityTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/LockableProcessEntityTests.cs index 90cb72d170..dd7f12bad6 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/LockableProcessEntityTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/LockableProcessEntityTests.cs @@ -19,8 +19,8 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Xunit.Extensions.AssemblyFixture; @@ -56,7 +56,7 @@ public async Task IsLocked_ReturnsExpected() { var (processId, _, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var result = process!.IsLocked(); result.Should().BeFalse(); @@ -68,7 +68,7 @@ public async Task ReleaseLock_ReturnsExpected() { var (processId, _, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var result = process!.ReleaseLock(); result.Should().BeFalse(); @@ -80,7 +80,7 @@ public async Task UpdateVersion_UpdateVersion_ReturnsExpected() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); process!.UpdateVersion(); process!.Version.Should().NotBe(version); @@ -88,7 +88,7 @@ public async Task UpdateVersion_UpdateVersion_ReturnsExpected() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var updated = await context.FindAsync(processId); + var updated = await context.FindAsync>(processId); updated.Should().NotBeNull(); updated!.Version.Should().Be(process.Version); updated.UpdateVersion(); @@ -97,7 +97,7 @@ public async Task UpdateVersion_UpdateVersion_ReturnsExpected() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var result = await context.FindAsync(processId); + var result = await context.FindAsync>(processId); result.Should().NotBeNull(); result!.Version.Should().Be(updated.Version); } @@ -107,7 +107,7 @@ public async Task TryLock_IsLocked_ReturnsExpected() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var isLocked = process!.TryLock(_soon); isLocked.Should().BeTrue(); @@ -115,7 +115,7 @@ public async Task TryLock_IsLocked_ReturnsExpected() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var locked = await context.FindAsync(processId); + var locked = await context.FindAsync>(processId); locked.Should().NotBeNull(); locked!.Version.Should().Be(process.Version); var result = locked.IsLocked(); @@ -131,7 +131,7 @@ public async Task IsLockExpired_ReturnsExpected(TimeFrame timeFrame, bool expect { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); process!.Version.Should().Be(version); var result = process.IsLockExpired(GetDateTimeOffset(timeFrame)!.Value); @@ -147,7 +147,7 @@ public async Task TryLock_IsLockExpired_ReturnsExpected(TimeFrame timeFrame, boo { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var isLocked = process!.TryLock(_soon); isLocked.Should().BeTrue(); @@ -155,7 +155,7 @@ public async Task TryLock_IsLockExpired_ReturnsExpected(TimeFrame timeFrame, boo await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var locked = await context.FindAsync(processId); + var locked = await context.FindAsync>(processId); locked.Should().NotBeNull(); locked!.Version.Should().Be(process.Version); var result = locked.IsLockExpired(GetDateTimeOffset(timeFrame)!.Value); @@ -168,7 +168,7 @@ public async Task TryLock_TryLock_ReturnsExpected() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var isLocked = process!.TryLock(_soon); isLocked.Should().BeTrue(); @@ -176,7 +176,7 @@ public async Task TryLock_TryLock_ReturnsExpected() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var locked = await context.FindAsync(processId); + var locked = await context.FindAsync>(processId); locked.Should().NotBeNull(); locked!.Version.Should().Be(process.Version); var result = locked.TryLock(_soon); @@ -190,7 +190,7 @@ public async Task TryLock_ReleaseLock_ReturnsExpected() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var isLocked = process!.TryLock(_soon); isLocked.Should().BeTrue(); @@ -198,7 +198,7 @@ public async Task TryLock_ReleaseLock_ReturnsExpected() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var locked = await context.FindAsync(processId); + var locked = await context.FindAsync>(processId); locked.Should().NotBeNull(); locked!.Version.Should().Be(process.Version); var isReleased = locked.ReleaseLock(); @@ -214,14 +214,14 @@ public async Task UpdateWithParallelUpdate_Throws() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); process!.UpdateVersion(); process!.Version.Should().NotBe(version); await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var parallel = context.Attach(new Process(processId, default, version)).Entity; + var parallel = context.Attach(new Process(processId, default, version)).Entity; parallel!.Version.Should().NotBe(process.Version); parallel.UpdateVersion(); parallel!.Version.Should().NotBe(version); @@ -235,14 +235,14 @@ public async Task UpdateWithParallelLock_Throws() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); process!.UpdateVersion(); process!.Version.Should().NotBe(version); await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var parallel = context.Attach(new Process(processId, default, version)).Entity; + var parallel = context.Attach(new Process(processId, default, version)).Entity; parallel!.Version.Should().NotBe(process.Version); var isReLocked = parallel.TryLock(_soon); isReLocked.Should().BeTrue(); @@ -257,7 +257,7 @@ public async Task LockWithParallelUpdate_Throws() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var locked = process!.TryLock(_soon); locked.Should().BeTrue(); @@ -265,7 +265,7 @@ public async Task LockWithParallelUpdate_Throws() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var parallel = context.Attach(new Process(processId, default, version)).Entity; + var parallel = context.Attach(new Process(processId, default, version)).Entity; parallel!.Version.Should().NotBe(process.Version); parallel.UpdateVersion(); parallel!.Version.Should().NotBe(version); @@ -279,7 +279,7 @@ public async Task LockWithParallelLock_Throws() { var (processId, version, context) = await CreateProcessAndContext(); - var process = await context.FindAsync(processId); + var process = await context.FindAsync>(processId); process.Should().NotBeNull(); var isLocked = process!.TryLock(_soon); isLocked.Should().BeTrue(); @@ -287,7 +287,7 @@ public async Task LockWithParallelLock_Throws() await context.SaveChangesAsync(); context.ChangeTracker.Clear(); - var parallel = context.Attach(new Process(processId, default, version)).Entity; + var parallel = context.Attach(new Process(processId, default, version)).Entity; parallel!.Version.Should().NotBe(process.Version); var isReLocked = parallel.TryLock(_soon); isReLocked.Should().BeTrue(); @@ -320,7 +320,7 @@ public enum TimeFrame private async Task<(Guid Id, Guid Version, DbContext Context)> CreateProcessAndContext() { var context = await _dbTestDbFixture.GetPortalDbContext(); - var process = context.Add(new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).Entity; + var process = context.Add(new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).Entity; await context.SaveChangesAsync(); context.ChangeTracker.Clear(); return (process.Id, process.Version, context); diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/NetworkRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/NetworkRepositoryTests.cs index 23f053570d..beb11590ff 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/NetworkRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/NetworkRepositoryTests.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs index d58c4266e3..76ec35479b 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalBackend.DBAccess.Tests.csproj b/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalBackend.DBAccess.Tests.csproj index 56745f4881..4ae0f5d287 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalBackend.DBAccess.Tests.csproj +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalBackend.DBAccess.Tests.csproj @@ -48,6 +48,7 @@ + diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ProcessStepRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ProcessStepRepositoryTests.cs index 1ac0a503d5..bbbd5d46b9 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ProcessStepRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ProcessStepRepositoryTests.cs @@ -18,10 +18,11 @@ ********************************************************************************/ using Microsoft.EntityFrameworkCore; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; using Xunit.Extensions.AssemblyFixture; @@ -61,9 +62,9 @@ public async Task CreateProcess_CreatesSuccessfully() .And.AllSatisfy(x => { x.State.Should().Be(EntityState.Added); - x.Entity.Should().BeOfType(); + x.Entity.Should().BeOfType>(); }); - changeTracker.Entries().Select(x => x.Entity).Cast() + changeTracker.Entries().Select(x => x.Entity).Cast>() .Should().Satisfy( x => x.Id == result.Id && x.ProcessTypeId == ProcessTypeId.APPLICATION_CHECKLIST ); @@ -93,9 +94,9 @@ public async Task CreateProcessStepRange_CreateSuccessfully() .And.AllSatisfy(x => { x.State.Should().Be(EntityState.Added); - x.Entity.Should().BeOfType(); + x.Entity.Should().BeOfType>(); }); - changeTracker.Entries().Select(x => x.Entity).Cast() + changeTracker.Entries().Select(x => x.Entity).Cast>() .Should().Satisfy( x => x.Id == result.ElementAt(0).Id && x.ProcessId == processId && x.ProcessStepTypeId == processStepTypeIds[0] && x.ProcessStepStatusId == ProcessStepStatusId.TODO, x => x.Id == result.ElementAt(1).Id && x.ProcessId == processId && x.ProcessStepTypeId == processStepTypeIds[1] && x.ProcessStepStatusId == ProcessStepStatusId.TODO, @@ -133,7 +134,7 @@ public async Task AttachAndModifyProcessStep_WithExistingProcessStep_UpdatesStat changedEntries.Should().HaveCount(1); var changedEntity = changedEntries.Single(); changedEntity.State.Should().Be(EntityState.Modified); - changedEntity.Entity.Should().BeOfType().Which.ProcessStepStatusId.Should().Be(ProcessStepStatusId.DONE); + changedEntity.Entity.Should().BeOfType>().Which.ProcessStepStatusId.Should().Be(ProcessStepStatusId.DONE); } #endregion @@ -144,12 +145,12 @@ public async Task AttachAndModifyProcessStep_WithExistingProcessStep_UpdatesStat public async Task AttachAndModifyProcessSteps_UpdatesStatus() { // Arrange - var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep, ProcessStep ModifiedStep)>(5).ToImmutableArray(); + var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep, ProcessStep ModifiedStep)>(5).ToImmutableArray(); var (sut, dbContext) = await CreateSutWithContext(); // Act - sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple?, Action>( + sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple>?, Action>>( data.ProcessStepId, step => { @@ -169,7 +170,7 @@ public async Task AttachAndModifyProcessSteps_UpdatesStatus() var changedEntries = changeTracker.Entries().ToList(); changeTracker.HasChanges().Should().BeTrue(); changedEntries.Should().HaveCount(5).And.AllSatisfy(entry => entry.State.Should().Be(EntityState.Modified)); - changedEntries.Select(entry => entry.Entity).Should().AllBeOfType().Which.Should().Satisfy( + changedEntries.Select(entry => entry.Entity).Should().AllBeOfType>().Which.Should().Satisfy( step => step.Id == stepData[0].ProcessStepId && step.ProcessStepStatusId == stepData[0].ModifiedStep.ProcessStepStatusId && step.DateLastChanged == stepData[0].ModifiedStep.DateLastChanged && step.Message == stepData[0].ModifiedStep.Message, step => step.Id == stepData[1].ProcessStepId && step.ProcessStepStatusId == stepData[1].ModifiedStep.ProcessStepStatusId && step.DateLastChanged == stepData[1].ModifiedStep.DateLastChanged && step.Message == stepData[1].ModifiedStep.Message, step => step.Id == stepData[2].ProcessStepId && step.ProcessStepStatusId == stepData[2].ModifiedStep.ProcessStepStatusId && step.DateLastChanged == stepData[2].ModifiedStep.DateLastChanged && step.Message == stepData[2].ModifiedStep.Message, @@ -182,12 +183,12 @@ public async Task AttachAndModifyProcessSteps_UpdatesStatus() public async Task AttachAndModifyProcessSteps_WithUnmodifiedData_SkipsUpdateStatus() { // Arrange - var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep)>(5).ToImmutableArray(); + var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep)>(5).ToImmutableArray(); var (sut, dbContext) = await CreateSutWithContext(); // Act - sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple?, Action>( + sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple>?, Action>>( data.ProcessStepId, step => { @@ -205,7 +206,7 @@ public async Task AttachAndModifyProcessSteps_WithUnmodifiedData_SkipsUpdateStat var changedEntries = changeTracker.Entries().ToList(); changeTracker.HasChanges().Should().BeFalse(); changedEntries.Should().HaveCount(5).And.AllSatisfy(entry => entry.State.Should().Be(EntityState.Unchanged)); - changedEntries.Select(entry => entry.Entity).Should().AllBeOfType().Which.Should().Satisfy( + changedEntries.Select(entry => entry.Entity).Should().AllBeOfType>().Which.Should().Satisfy( step => step.Id == stepData[0].ProcessStepId && step.ProcessStepStatusId == stepData[0].InitialStep.ProcessStepStatusId && step.DateLastChanged == stepData[0].InitialStep.DateLastChanged && step.Message == stepData[0].InitialStep.Message, step => step.Id == stepData[1].ProcessStepId && step.ProcessStepStatusId == stepData[1].InitialStep.ProcessStepStatusId && step.DateLastChanged == stepData[1].InitialStep.DateLastChanged && step.Message == stepData[1].InitialStep.Message, step => step.Id == stepData[2].ProcessStepId && step.ProcessStepStatusId == stepData[2].InitialStep.ProcessStepStatusId && step.DateLastChanged == stepData[2].InitialStep.DateLastChanged && step.Message == stepData[2].InitialStep.Message, @@ -218,12 +219,12 @@ public async Task AttachAndModifyProcessSteps_WithUnmodifiedData_SkipsUpdateStat public async Task AttachAndModifyProcessSteps_WithUnmodifiedData_UpdatesLastChanged() { // Arrange - var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep)>(5).ToImmutableArray(); + var stepData = _fixture.CreateMany<(Guid ProcessStepId, ProcessStep InitialStep)>(5).ToImmutableArray(); var (sut, dbContext) = await CreateSutWithContext(); // Act - sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple?, Action>( + sut.AttachAndModifyProcessSteps(stepData.Select(data => new ValueTuple>?, Action>>( data.ProcessStepId, step => { @@ -238,7 +239,7 @@ public async Task AttachAndModifyProcessSteps_WithUnmodifiedData_UpdatesLastChan var changedEntries = changeTracker.Entries().ToList(); changeTracker.HasChanges().Should().BeTrue(); changedEntries.Should().HaveCount(5).And.AllSatisfy(entry => entry.State.Should().Be(EntityState.Modified)); - changedEntries.Select(entry => entry.Entity).Should().AllBeOfType().Which.Should().Satisfy( + changedEntries.Select(entry => entry.Entity).Should().AllBeOfType>().Which.Should().Satisfy( step => step.Id == stepData[0].ProcessStepId && step.ProcessStepStatusId == stepData[0].InitialStep.ProcessStepStatusId && step.DateLastChanged != stepData[0].InitialStep.DateLastChanged && step.Message == stepData[0].InitialStep.Message, step => step.Id == stepData[1].ProcessStepId && step.ProcessStepStatusId == stepData[1].InitialStep.ProcessStepStatusId && step.DateLastChanged != stepData[1].InitialStep.DateLastChanged && step.Message == stepData[1].InitialStep.Message, step => step.Id == stepData[2].ProcessStepId && step.ProcessStepStatusId == stepData[2].InitialStep.ProcessStepStatusId && step.DateLastChanged != stepData[2].InitialStep.DateLastChanged && step.Message == stepData[2].InitialStep.Message, @@ -364,17 +365,17 @@ public async Task IsValidProcess_WithNotExistingProcess_ReturnsExpected() #endregion - private async Task<(ProcessStepRepository sut, PortalDbContext dbContext)> CreateSutWithContext() + private async Task<(ProcessStepRepository sut, PortalDbContext dbContext)> CreateSutWithContext() { var context = await _dbTestDbFixture.GetPortalDbContext(); - var sut = new ProcessStepRepository(context); + var sut = new ProcessStepRepository(context); return (sut, context); } - private async Task CreateSut() + private async Task> CreateSut() { var context = await _dbTestDbFixture.GetPortalDbContext(); - var sut = new ProcessStepRepository(context); + var sut = new ProcessStepRepository(context); return sut; } } diff --git a/tests/processes/ApplicationChecklist.Executor.Tests/ApplicationChecklistProcessTypeExecutorTests.cs b/tests/processes/ApplicationChecklist.Executor.Tests/ApplicationChecklistProcessTypeExecutorTests.cs index c9a99c9025..c74334e426 100644 --- a/tests/processes/ApplicationChecklist.Executor.Tests/ApplicationChecklistProcessTypeExecutorTests.cs +++ b/tests/processes/ApplicationChecklist.Executor.Tests/ApplicationChecklistProcessTypeExecutorTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/ApplicationChecklist.Library.Tests/ApplicationChecklistServiceTests.cs b/tests/processes/ApplicationChecklist.Library.Tests/ApplicationChecklistServiceTests.cs index 169e2c3202..10dbc1136f 100644 --- a/tests/processes/ApplicationChecklist.Library.Tests/ApplicationChecklistServiceTests.cs +++ b/tests/processes/ApplicationChecklist.Library.Tests/ApplicationChecklistServiceTests.cs @@ -18,6 +18,9 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -32,7 +35,7 @@ public class ChecklistServiceTests private readonly IFixture _fixture; private readonly IApplicationChecklistRepository _applicationChecklistRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IPortalRepositories _portalRepositories; private readonly IApplicationChecklistService _service; @@ -45,11 +48,11 @@ public ChecklistServiceTests() _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); _applicationChecklistRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _portalRepositories = A.Fake(); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_applicationChecklistRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); _service = new ApplicationChecklistService(_portalRepositories); } @@ -61,7 +64,7 @@ public async Task VerifyChecklistEntryAndProcessSteps() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(Enum.GetValues().Length - 1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -72,13 +75,13 @@ public async Task VerifyChecklistEntryAndProcessSteps() var comment = "Test Purpose"; IEnumerable<(ApplicationChecklistEntryTypeId, ApplicationChecklistEntryStatusId, string?)>? checklistData = null; - IEnumerable? processSteps = null; + IEnumerable>? processSteps = null; A.CallTo(() => _applicationChecklistRepository.GetChecklistProcessStepData(A._, A>._, A>._)) .ReturnsLazily((Guid appId, IEnumerable entryTypes, IEnumerable processStepTypes) => { checklistData = entryTypes.Zip(ProduceEntryStatusIds(entryStatusIds), (typeId, statusId) => (typeId, statusId, comment)).ToImmutableArray(); - processSteps = processStepTypes.Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); + processSteps = processStepTypes.Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); return applicationId == appId ? new VerifyChecklistData( true, @@ -137,7 +140,7 @@ public async Task VerifyChecklistEntry_LockedProcess_Throws() // Arrange var applicationId = Guid.NewGuid(); var lockExpiryDate = DateTimeOffset.UtcNow; - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(Enum.GetValues().Length - 1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -186,7 +189,7 @@ public async Task VerifyChecklistEntry_InvalidApplicationStatus_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(Enum.GetValues().Length - 1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -211,7 +214,7 @@ public async Task VerifyChecklistEntry_UnexpectedEntryData_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -219,7 +222,7 @@ public async Task VerifyChecklistEntry_UnexpectedEntryData_Throws() IEnumerable? processStepTypeIds = null; var entryData = Enum.GetValues().Except(new[] { entryTypeId }).Select(entryTypeId => (entryTypeId, entryStatusIds.First(), "Test Purpose")).ToImmutableArray(); - var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; A.CallTo(() => _applicationChecklistRepository.GetChecklistProcessStepData(A._, A>._, A>._)) .Returns(new VerifyChecklistData(true, process, entryData, processSteps)); @@ -238,7 +241,7 @@ public async Task VerifyChecklistEntry_UnexpectedQueryResult_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -262,7 +265,7 @@ public async Task VerifyChecklistEntry_UnexpectedEntryStatusData_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -270,7 +273,7 @@ public async Task VerifyChecklistEntry_UnexpectedEntryStatusData_Throws() IEnumerable? processStepTypeIds = null; var entryData = new[] { (entryTypeId, Enum.GetValues().Except(entryStatusIds).First(), "Test Purpose") }; - var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; A.CallTo(() => _applicationChecklistRepository.GetChecklistProcessStepData(A._, A>._, A>._)) .Returns(new VerifyChecklistData(true, process, entryData!, processSteps)); @@ -289,7 +292,7 @@ public async Task VerifyChecklistEntry_UnexpectedProcessStepData_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -297,7 +300,7 @@ public async Task VerifyChecklistEntry_UnexpectedProcessStepData_Throws() IEnumerable? processStepTypeIds = null; var entryData = new[] { (entryTypeId, entryStatusIds.First(), "Test Purpose") }; - var processSteps = new ProcessStep[] { new(Guid.NewGuid(), Enum.GetValues().Except(new[] { processStepTypeId }).First(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), Enum.GetValues().Except(new[] { processStepTypeId }).First(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }; A.CallTo(() => _applicationChecklistRepository.GetChecklistProcessStepData(A._, A>._, A>._)) .Returns(new VerifyChecklistData(true, process, entryData!, processSteps)); @@ -316,7 +319,7 @@ public async Task VerifyChecklistEntry_UnexpectedProcessStepStatus_Throws() { // Arrange var applicationId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var entryTypeId = _fixture.Create(); var entryStatusIds = _fixture.CreateMany(1).ToImmutableArray(); var processStepTypeId = _fixture.Create(); @@ -324,7 +327,7 @@ public async Task VerifyChecklistEntry_UnexpectedProcessStepStatus_Throws() IEnumerable? processStepTypeIds = null; var entryData = new[] { (entryTypeId, entryStatusIds.First(), "Test Purpose") }; - var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.SKIPPED, process.Id, DateTimeOffset.UtcNow) }; + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.SKIPPED, process.Id, DateTimeOffset.UtcNow) }; A.CallTo(() => _applicationChecklistRepository.GetChecklistProcessStepData(A._, A>._, A>._)) .Returns(new VerifyChecklistData(true, process, entryData!, processSteps)); @@ -347,14 +350,14 @@ public void RequestLock_UnlockedProcess_Success() { // Arrange var version = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, version); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, version); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), process, Guid.NewGuid(), _fixture.Create(), _fixture.Create>().ToImmutableDictionary(), - new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } + new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } ); var lockExpiryDate = _fixture.Create(); @@ -362,8 +365,8 @@ public void RequestLock_UnlockedProcess_Success() _service.RequestLock(context, lockExpiryDate); // Assert - A.CallTo(() => _portalRepositories.Attach(A._, null)).MustHaveHappenedOnceExactly(); - context.Process.Should().Match(x => x.Version != version && x.LockExpiryDate == lockExpiryDate); + A.CallTo(() => _portalRepositories.Attach(A>._, null)).MustHaveHappenedOnceExactly(); + context.Process.Should().Match>(x => x.Version != version && x.LockExpiryDate == lockExpiryDate); } [Fact] @@ -372,14 +375,14 @@ public void RequestLock_LockedProcess_Throws() // Arrange var version = Guid.NewGuid(); var lockExpiryDate = _fixture.Create(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, version) { LockExpiryDate = lockExpiryDate }; + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, version) { LockExpiryDate = lockExpiryDate }; var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), process, Guid.NewGuid(), _fixture.Create(), _fixture.Create>().ToImmutableDictionary(), - new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } + new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } ); // Act @@ -387,8 +390,8 @@ public void RequestLock_LockedProcess_Throws() // Assert result.Message.Should().Be("process TryLock should never fail here"); - A.CallTo(() => _portalRepositories.Attach(A._, null)).MustHaveHappenedOnceExactly(); - context.Process.Should().Match(x => x.Version == version && x.LockExpiryDate == lockExpiryDate); + A.CallTo(() => _portalRepositories.Attach(A>._, null)).MustHaveHappenedOnceExactly(); + context.Process.Should().Match>(x => x.Version == version && x.LockExpiryDate == lockExpiryDate); } #endregion @@ -399,14 +402,14 @@ public void RequestLock_LockedProcess_Throws() public void FinalizeChecklistEntryAndProcessSteps_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), process, Guid.NewGuid(), _fixture.Create(), _fixture.Create>().ToImmutableDictionary(), - new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } + new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } ); ApplicationChecklistEntry? modifiedChecklistEntry = null; @@ -418,22 +421,22 @@ public void FinalizeChecklistEntryAndProcessSteps_ReturnsExpected() modify(modifiedChecklistEntry); }); - ProcessStep? modifiedProcessStep = null; + ProcessStep? modifiedProcessStep = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid processStepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid processStepId, Action>? initialize, Action> modify) => { - modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); + modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); initialize?.Invoke(modifiedProcessStep); modify(modifiedProcessStep); }); - IEnumerable? newProcessSteps = null; + IEnumerable>? newProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId StepTypeId, ProcessStepStatusId StepStatusId, Guid ProcessId)> processStepTypeStatus) => { - newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); + newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); return newProcessSteps; }); @@ -449,7 +452,7 @@ public void FinalizeChecklistEntryAndProcessSteps_ReturnsExpected() // Assert A.CallTo(() => _applicationChecklistRepository.AttachAndModifyApplicationChecklist(A._, A._, A>._, A>._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustHaveHappenedOnceExactly(); @@ -477,32 +480,32 @@ public void FinalizeChecklistEntryAndProcessSteps_ReturnsExpected() public void FinalizeChecklistEntry_NoModifyEnty_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), process, Guid.NewGuid(), _fixture.Create(), _fixture.Create>().ToImmutableDictionary(), - new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } + new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } ); - ProcessStep? modifiedProcessStep = null; + ProcessStep? modifiedProcessStep = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid processStepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid processStepId, Action>? initialize, Action> modify) => { - modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); + modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); initialize?.Invoke(modifiedProcessStep); modify(modifiedProcessStep); }); - IEnumerable? newProcessSteps = null; + IEnumerable>? newProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId StepTypeId, ProcessStepStatusId StepStatusId, Guid ProcessId)> processStepTypeStatus) => { - newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); + newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); return newProcessSteps; }); @@ -518,7 +521,7 @@ public void FinalizeChecklistEntry_NoModifyEnty_ReturnsExpected() // Assert A.CallTo(() => _applicationChecklistRepository.AttachAndModifyApplicationChecklist(A._, A._, A>._, A>._)) .MustNotHaveHappened(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustHaveHappenedOnceExactly(); @@ -542,14 +545,14 @@ public void FinalizeChecklistEntry_NoModifyEnty_ReturnsExpected() public void FinalizeChecklistEntryNullProcessSteps_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), process, Guid.NewGuid(), _fixture.Create(), _fixture.Create>().ToImmutableDictionary(), - new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } + new ProcessStep[] { new(Guid.NewGuid(), _fixture.Create(), ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) } ); ApplicationChecklistEntry? modifiedChecklistEntry = null; @@ -561,12 +564,12 @@ public void FinalizeChecklistEntryNullProcessSteps_ReturnsExpected() modify(modifiedChecklistEntry); }); - ProcessStep? modifiedProcessStep = null; + ProcessStep? modifiedProcessStep = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid processStepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid processStepId, Action>? initialize, Action> modify) => { - modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); + modifiedProcessStep = new ProcessStep(processStepId, default, default, default, default); initialize?.Invoke(modifiedProcessStep); modify(modifiedProcessStep); }); @@ -581,7 +584,7 @@ public void FinalizeChecklistEntryNullProcessSteps_ReturnsExpected() // Assert A.CallTo(() => _applicationChecklistRepository.AttachAndModifyApplicationChecklist(A._, A._, A>._, A>._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustNotHaveHappened(); @@ -603,9 +606,9 @@ public void FinalizeChecklistEntryNullProcessSteps_ReturnsExpected() public void SkipProcessSteps() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()); var processStepTypeIds = _fixture.CreateMany(3); - var processSteps = _fixture.CreateMany(100).Select(stepTypeId => new ProcessStep(Guid.NewGuid(), stepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); + var processSteps = _fixture.CreateMany(100).Select(stepTypeId => new ProcessStep(Guid.NewGuid(), stepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); var context = new IApplicationChecklistService.ManualChecklistProcessStepData( Guid.NewGuid(), @@ -616,12 +619,12 @@ public void SkipProcessSteps() processSteps ); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid processStepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid processStepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(processStepId, default, default, default, default); + var step = new ProcessStep(processStepId, default, default, default, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -633,7 +636,7 @@ public void SkipProcessSteps() // Assert var eligibleSteps = processSteps.Where(step => processStepTypeIds.Contains(step.ProcessStepTypeId)).ToImmutableArray(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(eligibleSteps.Length, Times.Exactly); modifiedProcessSteps.Should().HaveCount(eligibleSteps.Length); diff --git a/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessServiceTests.cs b/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessServiceTests.cs index 47b620962f..ff39172602 100644 --- a/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessServiceTests.cs +++ b/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessServiceTests.cs @@ -20,6 +20,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Dim.Library; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessTypeExecutorTests.cs b/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessTypeExecutorTests.cs index d8d398a1ba..9fe02aa5d7 100644 --- a/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessTypeExecutorTests.cs +++ b/tests/processes/DimUserProcess.Executor.Tests/DimUserProcessTypeExecutorTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/IdentityProviderProvisioning.Executor.Tests/IdentityProviderProvisioningProcessTypeExecutorTests.cs b/tests/processes/IdentityProviderProvisioning.Executor.Tests/IdentityProviderProvisioningProcessTypeExecutorTests.cs index f77ef349ed..af6b39a76f 100644 --- a/tests/processes/IdentityProviderProvisioning.Executor.Tests/IdentityProviderProvisioningProcessTypeExecutorTests.cs +++ b/tests/processes/IdentityProviderProvisioning.Executor.Tests/IdentityProviderProvisioningProcessTypeExecutorTests.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/Invitation.Executor.Tests/InvitationProcessServiceTests.cs b/tests/processes/Invitation.Executor.Tests/InvitationProcessServiceTests.cs index 37cdaa0486..774acd56c5 100644 --- a/tests/processes/Invitation.Executor.Tests/InvitationProcessServiceTests.cs +++ b/tests/processes/Invitation.Executor.Tests/InvitationProcessServiceTests.cs @@ -21,6 +21,8 @@ using Org.Eclipse.TractusX.Portal.Backend.ExternalSystems.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/Invitation.Executor.Tests/InvitationProcessTypeExecutorTests.cs b/tests/processes/Invitation.Executor.Tests/InvitationProcessTypeExecutorTests.cs index b56337d03b..ad72059bd5 100644 --- a/tests/processes/Invitation.Executor.Tests/InvitationProcessTypeExecutorTests.cs +++ b/tests/processes/Invitation.Executor.Tests/InvitationProcessTypeExecutorTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/Mailing.Executor.Tests/MailingProcessTypeExecutorTests.cs b/tests/processes/Mailing.Executor.Tests/MailingProcessTypeExecutorTests.cs index 3dffe8b5a9..ca0877af49 100644 --- a/tests/processes/Mailing.Executor.Tests/MailingProcessTypeExecutorTests.cs +++ b/tests/processes/Mailing.Executor.Tests/MailingProcessTypeExecutorTests.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/tests/processes/Mailing.Library.Tests/RoleBaseMailServiceTests.cs b/tests/processes/Mailing.Library.Tests/RoleBaseMailServiceTests.cs index 122cd51aa1..b5378c9a22 100644 --- a/tests/processes/Mailing.Library.Tests/RoleBaseMailServiceTests.cs +++ b/tests/processes/Mailing.Library.Tests/RoleBaseMailServiceTests.cs @@ -25,6 +25,8 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; @@ -43,7 +45,7 @@ public class MailingProcessCreationTests private readonly IUserRolesRepository _userRolesRepository; private readonly IUserRepository _userRepository; private readonly IMailingInformationRepository _mailingInformationRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly Guid _companyId; private readonly IEnumerable _userRoleIds; private readonly byte[] _encryptionKey; @@ -59,7 +61,7 @@ public MailingProcessCreationTests() _portalRepositories = A.Fake(); _userRolesRepository = A.Fake(); _mailingInformationRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _userRepository = A.Fake(); _companyId = _fixture.Create(); _userRoleIds = _fixture.CreateMany(2); @@ -185,7 +187,7 @@ private void SetupRepositories() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRolesRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_mailingInformationRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); _fixture.Inject(_portalRepositories); } diff --git a/tests/processes/NetworkRegistration.Executor.Tests/NetworkRegistrationProcessTypeExecutorTests.cs b/tests/processes/NetworkRegistration.Executor.Tests/NetworkRegistrationProcessTypeExecutorTests.cs index b3c963dc0b..5a08af173c 100644 --- a/tests/processes/NetworkRegistration.Executor.Tests/NetworkRegistrationProcessTypeExecutorTests.cs +++ b/tests/processes/NetworkRegistration.Executor.Tests/NetworkRegistrationProcessTypeExecutorTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistration.Library.Tests.csproj b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistration.Library.Tests.csproj index 36910d4877..cdd3e7cad2 100644 --- a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistration.Library.Tests.csproj +++ b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistration.Library.Tests.csproj @@ -42,6 +42,8 @@ + + diff --git a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationHandlerTests.cs b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationHandlerTests.cs index c4c869b554..36caa2f262 100644 --- a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationHandlerTests.cs +++ b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationHandlerTests.cs @@ -19,7 +19,10 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; @@ -46,7 +49,7 @@ public class NetworkRegistrationHandlerTests private readonly IProvisioningManager _provisioningManager; private readonly IUserRepository _userRepository; private readonly INetworkRepository _networkRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly NetworkRegistrationHandler _sut; private readonly IMailingProcessCreation _mailingProcessCreation; @@ -60,7 +63,7 @@ public NetworkRegistrationHandlerTests() var portalRepositories = A.Fake(); _userRepository = A.Fake(); _networkRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _mailingProcessCreation = A.Fake(); _userProvisioningService = A.Fake(); @@ -75,7 +78,7 @@ public NetworkRegistrationHandlerTests() A.CallTo(() => options.Value).Returns(settings); A.CallTo(() => portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => portalRepositories.GetInstance()).Returns(_networkRepository); - A.CallTo(() => portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => portalRepositories.GetInstance>()).Returns(_processStepRepository); _sut = new NetworkRegistrationHandler(portalRepositories, _userProvisioningService, _provisioningManager, _mailingProcessCreation, options); } diff --git a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationProcessHelperTests.cs b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationProcessHelperTests.cs index 74524ad49c..1f7e86cace 100644 --- a/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationProcessHelperTests.cs +++ b/tests/processes/NetworkRegistration.Library.Tests/NetworkRegistrationProcessHelperTests.cs @@ -18,10 +18,12 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -32,7 +34,7 @@ public class NetworkRegistrationProcessHelperTests private static readonly ProcessStepTypeId StepToRetrigger = ProcessStepTypeId.RETRIGGER_SYNCHRONIZE_USER; private readonly IPortalRepositories _portalRepositories; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly INetworkRepository _networkRepository; private readonly IFixture _fixture; @@ -44,10 +46,10 @@ public NetworkRegistrationProcessHelperTests() _fixture.ConfigureFixture(); _portalRepositories = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _networkRepository = A.Fake(); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_networkRepository); _sut = new NetworkRegistrationProcessHelper(_portalRepositories); @@ -70,7 +72,7 @@ public async Task TriggerProcessStep_WithNotExistingExternalId_ThrowsNotFoundExc // Arrange var externalId = Guid.NewGuid(); A.CallTo(() => _networkRepository.IsValidRegistration(externalId.ToString(), A>.That.IsSameSequenceAs(new[] { StepToRetrigger }))) - .Returns((false, _fixture.Create())); + .Returns((false, _fixture.Create>())); // Act async Task Act() => await _sut.TriggerProcessStep(externalId.ToString(), ProcessStepTypeId.RETRIGGER_SYNCHRONIZE_USER); @@ -90,21 +92,21 @@ public async Task TriggerProcessStep_WithValidData_CallsExpected(ProcessStepType // Arrange var externalId = Guid.NewGuid(); var processId = Guid.NewGuid(); - var processSteps = new List(); + var processSteps = new List>(); - var processStep = new ProcessStep(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, processId, DateTimeOffset.UtcNow); - var data = new VerifyProcessData( - new Process(processId, ProcessTypeId.PARTNER_REGISTRATION, Guid.NewGuid()), + var processStep = new ProcessStep(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.TODO, processId, DateTimeOffset.UtcNow); + var data = new VerifyProcessData( + new Process(processId, ProcessTypeId.PARTNER_REGISTRATION, Guid.NewGuid()), new[] { processStep }); A.CallTo(() => _networkRepository.IsValidRegistration(externalId.ToString(), A>.That.IsSameSequenceAs(new[] { processStepTypeId }))) .Returns((true, data)); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>>._)) .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); + processSteps.AddRange(processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); }); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action>>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdsInitializeModifyData) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>>>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdsInitializeModifyData) => { var modify = processStepIdsInitializeModifyData.SingleOrDefault(x => processStep.Id == x.ProcessStepId); if (modify == default) @@ -120,7 +122,7 @@ public async Task TriggerProcessStep_WithValidData_CallsExpected(ProcessStepType // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); processSteps.Should().ContainSingle() - .Which.Should().Match(x => + .Which.Should().Match>(x => x.ProcessStepTypeId == retriggeredStep && x.ProcessStepStatusId == ProcessStepStatusId.TODO); processStep.ProcessStepStatusId.Should().Be(ProcessStepStatusId.DONE); diff --git a/tests/processes/OfferSubscription.Executor.Tests/OfferSubscriptionProcessTypeExecutorTests.cs b/tests/processes/OfferSubscription.Executor.Tests/OfferSubscriptionProcessTypeExecutorTests.cs index 1bfff43a86..c00602dae3 100644 --- a/tests/processes/OfferSubscription.Executor.Tests/OfferSubscriptionProcessTypeExecutorTests.cs +++ b/tests/processes/OfferSubscription.Executor.Tests/OfferSubscriptionProcessTypeExecutorTests.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.OfferProvider.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/tests/processes/OfferSubscription.Library.Tests/OfferSubscriptionProcessServiceTests.cs b/tests/processes/OfferSubscription.Library.Tests/OfferSubscriptionProcessServiceTests.cs index dcde8ee289..cc3ba0d62e 100644 --- a/tests/processes/OfferSubscription.Library.Tests/OfferSubscriptionProcessServiceTests.cs +++ b/tests/processes/OfferSubscription.Library.Tests/OfferSubscriptionProcessServiceTests.cs @@ -18,12 +18,14 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library.Tests; @@ -34,7 +36,7 @@ public class OfferSubscriptionProcessServiceTests private readonly IPortalRepositories _portalRepositories; private readonly IOfferSubscriptionsRepository _offerSubscriptionsRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IOfferSubscriptionProcessService _service; @@ -47,10 +49,10 @@ public OfferSubscriptionProcessServiceTests() _portalRepositories = A.Fake(); _offerSubscriptionsRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_offerSubscriptionsRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); _service = new OfferSubscriptionProcessService(_portalRepositories); } @@ -62,21 +64,21 @@ public async Task VerifySubscriptionAndProcessSteps() { // Arrange var subscriptionId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); var processStepTypeIds = _fixture.CreateMany(Enum.GetValues().Length - 2).ToImmutableArray(); var allProcessStepTypeIds = processStepTypeIds.Append(processStepTypeId).Distinct().ToImmutableArray(); - IEnumerable? processSteps = null; + IEnumerable>? processSteps = null; A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) .ReturnsLazily((Guid id, IEnumerable processStepTypes) => { - processSteps = processStepTypes.Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); + processSteps = processStepTypes.Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); return subscriptionId == id ? - new VerifyProcessData( + new VerifyProcessData( process, processSteps) : null; @@ -107,7 +109,7 @@ public async Task VerifySubscriptionAndProcessSteps_InvalidSubscriptionId_Throws A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((false, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(null); + .Returns?>(null); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -125,14 +127,14 @@ public async Task VerifySubscriptionAndProcessSteps_WithActive_Throws() // Arrange var subscriptionId = Guid.NewGuid(); var lockExpiryDate = DateTimeOffset.UtcNow; - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; var processStepTypeId = _fixture.Create(); var processStepTypeIds = _fixture.CreateMany(Enum.GetValues().Length - 2).ToImmutableArray(); A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, true)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(process, null)); + .Returns(new VerifyProcessData(process, null)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -155,7 +157,7 @@ public async Task VerifySubscriptionAndProcessSteps_WithProcessNull_Throws() A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(null, null)); + .Returns(new VerifyProcessData(null, null)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -173,14 +175,14 @@ public async Task VerifySubscriptionAndProcessSteps_LockedProcess_Throws() // Arrange var subscriptionId = Guid.NewGuid(); var lockExpiryDate = DateTimeOffset.UtcNow; - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }; var processStepTypeId = _fixture.Create(); var processStepTypeIds = _fixture.CreateMany(Enum.GetValues().Length - 2).ToImmutableArray(); A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(process, null)); + .Returns(new VerifyProcessData(process, null)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -197,14 +199,14 @@ public async Task VerifySubscriptionAndProcessSteps_WithoutProcessSteps_Throws() { // Arrange var subscriptionId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); IEnumerable? processStepTypeIds = null; A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(process, null)); + .Returns(new VerifyProcessData(process, null)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -220,16 +222,16 @@ public async Task VerifySubscriptionAndProcessSteps_UnexpectedProcessStepData_Th { // Arrange var subscriptionId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); IEnumerable? processStepTypeIds = null; - var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.SKIPPED, process.Id, DateTimeOffset.UtcNow) }; + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), processStepTypeId, ProcessStepStatusId.SKIPPED, process.Id, DateTimeOffset.UtcNow) }; A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(process, processSteps)); + .Returns(new VerifyProcessData(process, processSteps)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -245,16 +247,16 @@ public async Task VerifySubscriptionAndProcessSteps_NoEligibleProcessStep_Throws { // Arrange var subscriptionId = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); IEnumerable? processStepTypeIds = null; - var processSteps = _fixture.CreateMany(5).Where(typeId => typeId != processStepTypeId).Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); + var processSteps = _fixture.CreateMany(5).Where(typeId => typeId != processStepTypeId).Select(typeId => new ProcessStep(Guid.NewGuid(), typeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow)).ToImmutableArray(); A.CallTo(() => _offerSubscriptionsRepository.IsActiveOfferSubscription(A._)) .Returns((true, false)); A.CallTo(() => _offerSubscriptionsRepository.GetProcessStepData(A._, A>._)) - .Returns(new VerifyProcessData(process, processSteps)); + .Returns(new VerifyProcessData(process, processSteps)); var Act = () => _service.VerifySubscriptionAndProcessSteps(subscriptionId, processStepTypeId, processStepTypeIds, true); @@ -273,41 +275,41 @@ public async Task VerifySubscriptionAndProcessSteps_NoEligibleProcessStep_Throws public void FinalizeProcessSteps_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); var processStepId = Guid.NewGuid(); - var context = new ManualProcessStepData( + var context = new ManualProcessStepData( processStepTypeId, process, - new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, + new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, _portalRepositories ); - IEnumerable? modifiedProcessSteps = null; + IEnumerable>? modifiedProcessSteps = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> stepsToModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> stepsToModify) => { modifiedProcessSteps = stepsToModify.Select( stepToModify => { - var step = new ProcessStep(processStepId, default, default, default, default); + var step = new ProcessStep(processStepId, default, default, default, default); stepToModify.Initialize?.Invoke(step); stepToModify.Modify(step); return step; }); }); - IEnumerable? newProcessSteps = null; + IEnumerable>? newProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId StepTypeId, ProcessStepStatusId StepStatusId, Guid ProcessId)> processStepTypeStatus) => { - newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); + newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); return newProcessSteps; }); - var nextProcessStepTypeIds = Enum.GetValues().Except(context.ProcessSteps.Select(step => step.ProcessStepTypeId)).ToImmutableArray(); + var nextProcessStepTypeIds = Enum.GetValues().Except(context.ProcessSteps.Select(step => (ProcessStepTypeId)step.ProcessStepTypeId)).ToImmutableArray(); // Act _service.FinalizeProcessSteps( @@ -315,12 +317,12 @@ public void FinalizeProcessSteps_ReturnsExpected() Enum.GetValues()); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustHaveHappenedOnceExactly(); - modifiedProcessSteps.Should().NotBeNull().And.ContainSingle().Which.Should().Match( + modifiedProcessSteps.Should().NotBeNull().And.ContainSingle().Which.Should().Match>( step => step.Id == processStepId && step.ProcessStepStatusId == ProcessStepStatusId.DONE @@ -341,37 +343,37 @@ public void FinalizeProcessSteps_ReturnsExpected() public void FinalizeProcessSteps_NoModifyEnty_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); var processStepId = Guid.NewGuid(); - var context = new ManualProcessStepData( + var context = new ManualProcessStepData( processStepTypeId, process, - new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, + new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, _portalRepositories ); - IEnumerable? modifiedProcessSteps = null; + IEnumerable>? modifiedProcessSteps = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> stepsToModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> stepsToModify) => { modifiedProcessSteps = stepsToModify.Select( stepToModify => { - var step = new ProcessStep(processStepId, default, default, default, default); + var step = new ProcessStep(processStepId, default, default, default, default); stepToModify.Initialize?.Invoke(step); stepToModify.Modify(step); return step; }); }); - IEnumerable? newProcessSteps = null; + IEnumerable>? newProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId StepTypeId, ProcessStepStatusId StepStatusId, Guid ProcessId)> processStepTypeStatus) => { - newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); + newProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.StepTypeId, x.StepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToList(); return newProcessSteps; }); @@ -383,13 +385,13 @@ public void FinalizeProcessSteps_NoModifyEnty_ReturnsExpected() Enum.GetValues()); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustHaveHappenedOnceExactly(); modifiedProcessSteps - .Should().NotBeNull().And.ContainSingle().Which.Should().Match( + .Should().NotBeNull().And.ContainSingle().Which.Should().Match>( step => step.Id == processStepId && step.ProcessStepStatusId == ProcessStepStatusId.DONE @@ -410,24 +412,24 @@ public void FinalizeProcessSteps_NoModifyEnty_ReturnsExpected() public void FinalizeProcessSteps_NullProcessSteps_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); + var process = new Process(Guid.NewGuid(), ProcessTypeId.OFFER_SUBSCRIPTION, Guid.NewGuid()); var processStepTypeId = _fixture.Create(); var processStepId = Guid.NewGuid(); - var context = new ManualProcessStepData( + var context = new ManualProcessStepData( processStepTypeId, process, - new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, + new ProcessStep[] { new(processStepId, processStepTypeId, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow) }, _portalRepositories ); - IEnumerable? modifiedProcessSteps = null; + IEnumerable>? modifiedProcessSteps = null; - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> stepsToModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> stepsToModify) => { modifiedProcessSteps = stepsToModify.Select( stepToModify => { - var step = new ProcessStep(processStepId, default, default, default, default); + var step = new ProcessStep(processStepId, default, default, default, default); stepToModify.Initialize?.Invoke(step); stepToModify.Modify(step); return step; @@ -440,12 +442,12 @@ public void FinalizeProcessSteps_NullProcessSteps_ReturnsExpected() null); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustNotHaveHappened(); - modifiedProcessSteps.Should().NotBeNull().And.ContainSingle().Which.Should().Match( + modifiedProcessSteps.Should().NotBeNull().And.ContainSingle().Which.Should().Match>( step => step.Id == processStepId && step.ProcessStepStatusId == ProcessStepStatusId.DONE); diff --git a/tests/processes/Processes.Library.Tests/ManualProcessDataExtensionsTests.cs b/tests/processes/Processes.Library.Tests/ManualProcessDataExtensionsTests.cs index 661672c146..d9be85c7f3 100644 --- a/tests/processes/Processes.Library.Tests/ManualProcessDataExtensionsTests.cs +++ b/tests/processes/Processes.Library.Tests/ManualProcessDataExtensionsTests.cs @@ -18,10 +18,11 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; @@ -30,8 +31,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Library.Tests; public class ManualProcessDataExtensionsTests { - private readonly IPortalRepositories _portalRepositories; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessRepositories _processRepositories; + private readonly IProcessStepRepository _processStepRepository; private readonly string _entityName; private readonly Func _getProcessEntityName; private readonly IFixture _fixture; @@ -41,10 +42,10 @@ public ManualProcessDataExtensionsTests() _fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); _fixture.ConfigureFixture(); - _portalRepositories = A.Fake(); - _processStepRepository = A.Fake(); + _processRepositories = A.Fake>(); + _processStepRepository = A.Fake>(); - A.CallTo(() => _portalRepositories.GetInstance()) + A.CallTo(() => _processRepositories.GetInstance>()) .Returns(_processStepRepository); _entityName = _fixture.Create(); @@ -57,34 +58,34 @@ public ManualProcessDataExtensionsTests() public void CreateManualProcessData_ReturnsExpected() { // Arrange - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; - var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.TODO, process.Id, x.Now)).ToImmutableArray(); + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; + var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.TODO, process.Id, x.Now)).ToImmutableArray(); var stepTypeId = processSteps[2].ProcessStepTypeId; - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.Process, process) .With(x => x.ProcessSteps, processSteps) .Create(); // Act - var result = sut.CreateManualProcessData(stepTypeId, _portalRepositories, _getProcessEntityName); + var result = sut.CreateManualProcessData(stepTypeId, _processRepositories, _getProcessEntityName); // Assert - result.Should().NotBeNull().And.BeOfType().And.Match( + result.Should().NotBeNull().And.BeOfType>().And.Match>( data => data.ProcessStepTypeId == stepTypeId && data.Process == sut.Process && data.ProcessSteps.SequenceEqual(sut.ProcessSteps!) && - data.PortalRepositories == _portalRepositories); + data.ProcessRepositories == _processRepositories); } [Fact] public void CreateManualProcessData_WithNullVerifyProcessData_Throws() { // Arrange - var sut = default(VerifyProcessData?); + var sut = default(VerifyProcessData?); - var Act = () => sut.CreateManualProcessData(_fixture.Create(), _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(_fixture.Create(), _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -97,11 +98,11 @@ public void CreateManualProcessData_WithNullVerifyProcessData_Throws() public void CreateManualProcessData_WithNullProcess_Throws() { // Arrange - var sut = _fixture.Build() - .With(x => x.Process, default(Process?)) + var sut = _fixture.Build>() + .With(x => x.Process, default(Process?)) .Create(); - var Act = () => sut.CreateManualProcessData(_fixture.Create(), _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(_fixture.Create(), _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -115,12 +116,12 @@ public void CreateManualProcessData_WithLockedProcess_Throws() { // Arrange var expiryDate = _fixture.Create(); - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = expiryDate }; - var sut = _fixture.Build() + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = expiryDate }; + var sut = _fixture.Build>() .With(x => x.Process, process) .Create(); - var Act = () => sut.CreateManualProcessData(_fixture.Create(), _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(_fixture.Create(), _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -133,14 +134,14 @@ public void CreateManualProcessData_WithLockedProcess_Throws() public void CreateManualProcessData_WithNullProcessSteps_Throws() { // Arrange - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.Process, process) - .With(x => x.ProcessSteps, default(IEnumerable?)) + .With(x => x.ProcessSteps, default(IEnumerable>?)) .Create(); - var Act = () => sut.CreateManualProcessData(_fixture.Create(), _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(_fixture.Create(), _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -153,15 +154,15 @@ public void CreateManualProcessData_WithNullProcessSteps_Throws() public void CreateManualProcessData_WithInvalidProcessStepStatus_Throws() { // Arrange - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; - var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.DONE, process.Id, x.Now)).ToImmutableArray(); + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; + var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.DONE, process.Id, x.Now)).ToImmutableArray(); - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.Process, process) .With(x => x.ProcessSteps, processSteps) .Create(); - var Act = () => sut.CreateManualProcessData(_fixture.Create(), _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(_fixture.Create(), _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -174,16 +175,16 @@ public void CreateManualProcessData_WithInvalidProcessStepStatus_Throws() public void CreateManualProcessData_WithInvalidProcessStepType_Throws() { // Arrange - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; - var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.TODO, process.Id, x.Now)).ToImmutableArray(); + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; + var processSteps = _fixture.CreateMany<(Guid ProcessStepId, DateTimeOffset Now)>(5).Select(x => new ProcessStep(x.ProcessStepId, _fixture.Create(), ProcessStepStatusId.TODO, process.Id, x.Now)).ToImmutableArray(); var stepTypeId = Enum.GetValues().Except(processSteps.Select(step => step.ProcessStepTypeId)).First(); - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.Process, process) .With(x => x.ProcessSteps, processSteps) .Create(); - var Act = () => sut.CreateManualProcessData(stepTypeId, _portalRepositories, _getProcessEntityName); + var Act = () => sut.CreateManualProcessData(stepTypeId, _processRepositories, _getProcessEntityName); // Act var result = Assert.Throws(Act); @@ -201,10 +202,10 @@ public void RequestLock_WithUnLockedProcess_ReturnsExpected() { // Arrange var expiryDate = _fixture.Create(); - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; - var sut = _fixture.Build() + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = null }; + var sut = _fixture.Build>() .With(x => x.Process, process) - .With(x => x.PortalRepositories, _portalRepositories) + .With(x => x.ProcessRepositories, _processRepositories) .Create(); // Act @@ -212,7 +213,7 @@ public void RequestLock_WithUnLockedProcess_ReturnsExpected() // Assert sut.Process.LockExpiryDate.Should().Be(expiryDate); - A.CallTo(() => _portalRepositories.Attach(process, null)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _processRepositories.Attach(process, null)).MustHaveHappenedOnceExactly(); } [Fact] @@ -220,10 +221,10 @@ public void RequestLock_WithLockedProcess_Throws() { // Arrange var expiryDate = _fixture.Create(); - var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = expiryDate }; - var sut = _fixture.Build() + var process = new Process(Guid.NewGuid(), _fixture.Create(), Guid.NewGuid()) { LockExpiryDate = expiryDate }; + var sut = _fixture.Build>() .With(x => x.Process, process) - .With(x => x.PortalRepositories, _portalRepositories) + .With(x => x.ProcessRepositories, _processRepositories) .Create(); var Act = () => sut.RequestLock(DateTimeOffset.UtcNow); @@ -233,7 +234,7 @@ public void RequestLock_WithLockedProcess_Throws() // Assert result.Message.Should().Be("process TryLock should never fail here"); sut.Process.LockExpiryDate.Should().Be(expiryDate); - A.CallTo(() => _portalRepositories.Attach(process, null)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _processRepositories.Attach(process, null)).MustHaveHappenedOnceExactly(); } #endregion @@ -244,28 +245,28 @@ public void RequestLock_WithLockedProcess_Throws() public void SkipProcessSteps_ReturnsExpected() { // Arrange - var process = _fixture.Create(); - var stepTypeIds = _fixture.CreateMany(4).ToImmutableArray(); + var process = _fixture.Create>(); + var stepTypeIds = _fixture.CreateMany(4).ToArray(); var before = DateTimeOffset.UtcNow.AddDays(-1); - var processSteps0 = new ProcessStep[] + var processSteps0 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps1 = new ProcessStep[] + var processSteps1 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps2 = new ProcessStep[] + var processSteps2 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps3 = new ProcessStep[] + var processSteps3 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[3], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[3], ProcessStepStatusId.TODO, process.Id, before), @@ -288,32 +289,32 @@ public void SkipProcessSteps_ReturnsExpected() processSteps3[2], }; - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdInitializeModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdInitializeModify) => { foreach (var (stepId, initialize, modify) in processStepIdInitializeModify) { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); } }); - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.ProcessStepTypeId, stepTypeIds[3]) .With(x => x.Process, process) - .With(x => x.PortalRepositories, _portalRepositories) + .With(x => x.ProcessRepositories, _processRepositories) .With(x => x.ProcessSteps, processSteps) .Create(); // Act - sut.SkipProcessSteps(new ProcessStepTypeId[] { stepTypeIds[1], stepTypeIds[2], stepTypeIds[3] }); + sut.SkipProcessSteps(new[] { stepTypeIds[1], stepTypeIds[2], stepTypeIds[3] }); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); modifiedProcessSteps.Should().HaveCount(6).And.Satisfy( @@ -334,28 +335,28 @@ public void SkipProcessSteps_ReturnsExpected() public void SkipProcessStepsExcept_ReturnsExpected() { // Arrange - var process = _fixture.Create(); - var stepTypeIds = _fixture.CreateMany(4).ToImmutableArray(); + var process = _fixture.Create>(); + var stepTypeIds = _fixture.CreateMany(4).ToArray(); var before = DateTimeOffset.UtcNow.AddDays(-1); - var processSteps0 = new ProcessStep[] + var processSteps0 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps1 = new ProcessStep[] + var processSteps1 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps2 = new ProcessStep[] + var processSteps2 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before) }; - var processSteps3 = new ProcessStep[] + var processSteps3 = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[3], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[3], ProcessStepStatusId.TODO, process.Id, before), @@ -378,32 +379,32 @@ public void SkipProcessStepsExcept_ReturnsExpected() processSteps3[2], }; - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdInitializeModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdInitializeModify) => { foreach (var (stepId, initialize, modify) in processStepIdInitializeModify) { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); } }); - var sut = _fixture.Build() + var sut = _fixture.Build>() .With(x => x.ProcessStepTypeId, stepTypeIds[3]) .With(x => x.Process, process) - .With(x => x.PortalRepositories, _portalRepositories) + .With(x => x.ProcessRepositories, _processRepositories) .With(x => x.ProcessSteps, processSteps) .Create(); // Act - sut.SkipProcessStepsExcept(new ProcessStepTypeId[] { stepTypeIds[1], stepTypeIds[2] }); + sut.SkipProcessStepsExcept(new[] { stepTypeIds[1], stepTypeIds[2] }); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); modifiedProcessSteps.Should().HaveCount(3).And.Satisfy( @@ -421,22 +422,19 @@ public void SkipProcessStepsExcept_ReturnsExpected() public void ScheduleProcessSteps_ReturnsExpected() { // Arrange - var stepTypeIds = _fixture.CreateMany(3).ToImmutableArray(); + var stepTypeIds = _fixture.CreateMany(3); var now = DateTimeOffset.UtcNow; - var createdSteps = new List(); + var createdSteps = new List>(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcesssStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatusProcessIds) => { - foreach (var data in processStepTypeStatusProcessIds) - { - createdSteps.Add(new ProcessStep(Guid.NewGuid(), data.ProcesssStepTypeId, data.ProcessStepStatusId, data.ProcessId, now)); - } + createdSteps.AddRange(processStepTypeStatusProcessIds.Select(data => new ProcessStep(Guid.NewGuid(), data.ProcesssStepTypeId, data.ProcessStepStatusId, data.ProcessId, now))); return createdSteps; }); - var sut = _fixture.Build() - .With(x => x.PortalRepositories, _portalRepositories) + var sut = _fixture.Build>() + .With(x => x.ProcessRepositories, _processRepositories) .Create(); // Act @@ -446,9 +444,9 @@ public void ScheduleProcessSteps_ReturnsExpected() A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustHaveHappenedOnceExactly(); createdSteps.Should().HaveCount(3).And.Satisfy( - x => x.ProcessStepTypeId == stepTypeIds[0] && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO, - x => x.ProcessStepTypeId == stepTypeIds[1] && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO, - x => x.ProcessStepTypeId == stepTypeIds[2] && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO + x => x.ProcessStepTypeId == stepTypeIds.ElementAt(0) && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO, + x => x.ProcessStepTypeId == stepTypeIds.ElementAt(1) && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO, + x => x.ProcessStepTypeId == stepTypeIds.ElementAt(2) && x.ProcessId == sut.Process.Id && x.ProcessStepStatusId == ProcessStepStatusId.TODO ); } @@ -463,47 +461,47 @@ public void FinalizeProcessStep_ReturnsExpected(bool locked) { // Arrange var version = Guid.NewGuid(); - var process = _fixture.Build() + var process = _fixture.Build>() .With(x => x.Version, version) .With(x => x.LockExpiryDate, locked ? DateTimeOffset.UtcNow : default(DateTimeOffset?)) .Create(); - var stepTypeIds = _fixture.CreateMany(3).ToImmutableArray(); + var stepTypeIds = _fixture.CreateMany(3).ToArray(); var before = DateTimeOffset.UtcNow.AddDays(-1); - var processSteps = new ProcessStep[] + var processSteps = new ProcessStep[] { new(Guid.NewGuid(), stepTypeIds[0], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[1], ProcessStepStatusId.TODO, process.Id, before), new(Guid.NewGuid(), stepTypeIds[2], ProcessStepStatusId.TODO, process.Id, before) }; - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processStepIdInitializeModify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processStepIdInitializeModify) => { foreach (var (stepId, initialize, modify) in processStepIdInitializeModify) { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); } }); - var sut = new ManualProcessStepData(stepTypeIds[1], process, processSteps, _portalRepositories); + var sut = new ManualProcessStepData(stepTypeIds[1], process, processSteps, _processRepositories); // Act - sut.FinalizeProcessStep(); + sut.FinalizeProcessStep(); // Assert - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.Attach(process, null)) + A.CallTo(() => _processRepositories.Attach(process, null)) .MustHaveHappenedOnceExactly(); process.LockExpiryDate.Should().BeNull(); process.Version.Should().NotBe(version); - modifiedProcessSteps.Should().ContainSingle().Which.Should().Match( + modifiedProcessSteps.Should().ContainSingle().Which.Should().Match>( x => x.Id == processSteps[1].Id && x.ProcessStepStatusId == ProcessStepStatusId.DONE && x.DateLastChanged != before ); } diff --git a/tests/processes/Processes.Library.Tests/Processes.Library.Tests.csproj b/tests/processes/Processes.Library.Tests/Processes.Library.Tests.csproj index 6c2331b0f7..9989ea50e0 100644 --- a/tests/processes/Processes.Library.Tests/Processes.Library.Tests.csproj +++ b/tests/processes/Processes.Library.Tests/Processes.Library.Tests.csproj @@ -42,7 +42,6 @@ - diff --git a/tests/processes/Processes.Worker.Library.Tests/ProcessExecutionServiceTests.cs b/tests/processes/Processes.Worker.Library.Tests/ProcessExecutionServiceTests.cs index b9a8d18465..b92cdb13f4 100644 --- a/tests/processes/Processes.Worker.Library.Tests/ProcessExecutionServiceTests.cs +++ b/tests/processes/Processes.Worker.Library.Tests/ProcessExecutionServiceTests.cs @@ -21,23 +21,23 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.ProcessIdentity; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library.Tests; public class ProcessExecutionServiceTests { - private readonly IProcessStepRepository _processStepRepository; - private readonly IPortalRepositories _portalRepositories; - private readonly IProcessExecutor _processExecutor; - private readonly IMockLogger _mockLogger; - private readonly ProcessExecutionService _service; + private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessRepositories _processRepositories; + private readonly IProcessExecutor _processExecutor; + private readonly IMockLogger> _mockLogger; + private readonly ProcessExecutionService _service; private readonly IFixture _fixture; private readonly IProcessIdentityDataDetermination _processIdentityDataDetermination; @@ -49,23 +49,23 @@ public ProcessExecutionServiceTests() _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); var dateTimeProvider = A.Fake(); - _portalRepositories = A.Fake(); - _processStepRepository = A.Fake(); - _processExecutor = A.Fake(); + _processRepositories = A.Fake>(); + _processStepRepository = A.Fake>(); + _processExecutor = A.Fake>(); _processIdentityDataDetermination = A.Fake(); - _mockLogger = A.Fake>(); - ILogger logger = new MockLogger(_mockLogger); + _mockLogger = A.Fake>>(); + ILogger> logger = new MockLogger>(_mockLogger); - A.CallTo(() => _portalRepositories.GetInstance()) + A.CallTo(() => _processRepositories.GetInstance>()) .Returns(_processStepRepository); var settings = _fixture.Create(); var options = Options.Create(settings); var serviceProvider = A.Fake(); - A.CallTo(() => serviceProvider.GetService(typeof(IPortalRepositories))).Returns(_portalRepositories); - A.CallTo(() => serviceProvider.GetService(typeof(IProcessExecutor))).Returns(_processExecutor); + A.CallTo(() => serviceProvider.GetService(typeof(IProcessRepositories))).Returns(_processRepositories); + A.CallTo(() => serviceProvider.GetService(typeof(IProcessExecutor))).Returns(_processExecutor); A.CallTo(() => serviceProvider.GetService(typeof(IProcessIdentityDataDetermination))).Returns(_processIdentityDataDetermination); var serviceScope = A.Fake(); A.CallTo(() => serviceScope.ServiceProvider).Returns(serviceProvider); @@ -73,7 +73,7 @@ public ProcessExecutionServiceTests() A.CallTo(() => serviceScopeFactory.CreateScope()).Returns(serviceScope); A.CallTo(() => serviceProvider.GetService(typeof(IServiceScopeFactory))).Returns(serviceScopeFactory); - _service = new ProcessExecutionService(serviceScopeFactory, dateTimeProvider, options, logger); + _service = new ProcessExecutionService(serviceScopeFactory, dateTimeProvider, options, logger); } [Fact] @@ -81,7 +81,7 @@ public async Task ExecuteAsync_WithNoPendingItems_NoServiceCall() { // Arrange A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) - .Returns(Array.Empty().ToAsyncEnumerable()); + .Returns(Array.Empty>().ToAsyncEnumerable()); // Act await _service.ExecuteAsync(CancellationToken.None); @@ -96,12 +96,12 @@ public async Task ExecuteAsync_WithNoPendingItems_NoServiceCall() public async Task ExecuteAsync_WithPendingItems_CallsProcessExpectedNumberOfTimes() { // Arrange - var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); + var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) - .Returns(Enumerable.Repeat(IProcessExecutor.ProcessExecutionResult.SaveRequested, 2).ToAsyncEnumerable()); + .Returns(Enumerable.Repeat(IProcessExecutor.ProcessExecutionResult.SaveRequested, 2).ToAsyncEnumerable()); // Act await _service.ExecuteAsync(CancellationToken.None); @@ -109,9 +109,9 @@ public async Task ExecuteAsync_WithPendingItems_CallsProcessExpectedNumberOfTime // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappened(processData.Length, Times.Exactly); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappened(processData.Length * 2, Times.Exactly); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(processData.Length * 2, Times.Exactly); } @@ -119,12 +119,12 @@ public async Task ExecuteAsync_WithPendingItems_CallsProcessExpectedNumberOfTime public async Task ExecuteAsync_ExecuteProcess_Returns_Unmodified() { // Arrange - var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); + var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) - .Returns(Enumerable.Repeat(IProcessExecutor.ProcessExecutionResult.Unmodified, 2).ToAsyncEnumerable()); + .Returns(Enumerable.Repeat(IProcessExecutor.ProcessExecutionResult.Unmodified, 2).ToAsyncEnumerable()); // Act await _service.ExecuteAsync(CancellationToken.None); @@ -132,9 +132,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_Unmodified() // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappened(processData.Length, Times.Exactly); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustNotHaveHappened(); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(processData.Length * 2, Times.Exactly); } @@ -144,24 +144,24 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLock() // Arrange var processId = Guid.NewGuid(); var processVersion = Guid.NewGuid(); - var process = new Process(processId, ProcessTypeId.APPLICATION_CHECKLIST, processVersion); + var process = new Process(processId, ProcessTypeId.APPLICATION_CHECKLIST, processVersion); var processData = new[] { process }; A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); A.CallTo(() => _processExecutor.ExecuteProcess(processId, A._, A._)) - .Returns(new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); + .Returns(new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); var changeHistory = new List<(Guid Version, DateTimeOffset? LockExpiryTime, bool Save)>(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .ReturnsLazily(() => { changeHistory.Add((process.Version, process.LockExpiryDate, true)); return 1; }); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .Invokes(() => { changeHistory.Add((process.Version, process.LockExpiryDate, false)); @@ -173,9 +173,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLock() // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappened(3, Times.Exactly); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(3, Times.Exactly); changeHistory.Should().HaveCount(6) .And.SatisfyRespectively( @@ -194,24 +194,24 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockTwice() // Arrange var processId = Guid.NewGuid(); var processVersion = Guid.NewGuid(); - var process = new Process(processId, ProcessTypeId.APPLICATION_CHECKLIST, processVersion); + var process = new Process(processId, ProcessTypeId.APPLICATION_CHECKLIST, processVersion); var processData = new[] { process }; A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); A.CallTo(() => _processExecutor.ExecuteProcess(processId, A._, A._)) - .Returns(new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); + .Returns(new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); var changeHistory = new List<(Guid Version, DateTimeOffset? LockExpiryTime, bool Save)>(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .ReturnsLazily(() => { changeHistory.Add((process.Version, process.LockExpiryDate, true)); return 1; }); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .Invokes(() => { changeHistory.Add((process.Version, process.LockExpiryDate, false)); @@ -223,9 +223,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockTwice() // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappened(3, Times.Exactly); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(4, Times.Exactly); changeHistory.Should().HaveCount(7) .And.SatisfyRespectively( @@ -247,20 +247,20 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockThenThrows() var secondId = Guid.NewGuid(); var firstVersion = Guid.NewGuid(); var secondVersion = Guid.NewGuid(); - var firstProcess = new Process(firstId, ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); - var secondProcess = new Process(secondId, ProcessTypeId.APPLICATION_CHECKLIST, secondVersion); + var firstProcess = new Process(firstId, ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); + var secondProcess = new Process(secondId, ProcessTypeId.APPLICATION_CHECKLIST, secondVersion); var processData = new[] { firstProcess, secondProcess }; A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); - IEnumerable ThrowingEnumerable() + IEnumerable.ProcessExecutionResult> ThrowingEnumerable() { - yield return IProcessExecutor.ProcessExecutionResult.LockRequested; + yield return IProcessExecutor.ProcessExecutionResult.LockRequested; throw new Exception("normal error"); } - Process? process = null; + Process? process = null; A.CallTo(() => _processExecutor.ExecuteProcess(firstId, A._, A._)) .ReturnsLazily((Guid Id, ProcessTypeId _, CancellationToken _) => @@ -273,12 +273,12 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockThenThrows() .ReturnsLazily((Guid Id, ProcessTypeId _, CancellationToken _) => { process = secondProcess; - return new[] { IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); + return new[] { IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); }); var changeHistory = new List<(Guid Id, Guid Version, DateTimeOffset? LockExpiryTime, bool Save)>(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .ReturnsLazily(() => { changeHistory.Add(process == null @@ -287,7 +287,7 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockThenThrows() return 1; }); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .Invokes(() => { changeHistory.Add(process == null @@ -303,9 +303,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLockThenThrows() .MustHaveHappenedOnceExactly(); A.CallTo(() => _processExecutor.ExecuteProcess(secondId, A._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappenedTwiceExactly(); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(3, Times.Exactly); changeHistory.Should().SatisfyRespectively( first => first.Should().Match<(Guid Id, Guid Version, DateTimeOffset? LockExpiryTime, bool Save)>(x => x.Id == firstId && x.Version != firstVersion && x.LockExpiryTime != null && x.Save), @@ -322,24 +322,24 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_UnmodifiedSafeRequested() { // Arrange var firstVersion = Guid.NewGuid(); - var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); + var process = new Process(Guid.NewGuid(), ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); var processData = new[] { process }; A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) - .Returns(new[] { IProcessExecutor.ProcessExecutionResult.Unmodified, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); + .Returns(new[] { IProcessExecutor.ProcessExecutionResult.Unmodified, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable()); var changeHistory = new List<(Guid Version, DateTimeOffset? LockExpiryTime, bool Save)>(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .ReturnsLazily(() => { changeHistory.Add((process.Version, process.LockExpiryDate, true)); return 1; }); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .Invokes(() => { changeHistory.Add((process.Version, process.LockExpiryDate, false)); @@ -351,9 +351,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_UnmodifiedSafeRequested() // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappenedTwiceExactly(); changeHistory.Should().HaveCount(3) .And.SatisfyRespectively( @@ -369,47 +369,47 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLock_SaveAsyncThrow // Arrange var firstProcessId = Guid.NewGuid(); var firstVersion = Guid.NewGuid(); - var firstProcess = new Process(firstProcessId, ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); + var firstProcess = new Process(firstProcessId, ProcessTypeId.APPLICATION_CHECKLIST, firstVersion); var secondProcessId = Guid.NewGuid(); var secondVersion = Guid.NewGuid(); - var secondProcess = new Process(secondProcessId, ProcessTypeId.APPLICATION_CHECKLIST, secondVersion); + var secondProcess = new Process(secondProcessId, ProcessTypeId.APPLICATION_CHECKLIST, secondVersion); var thirdProcessId = Guid.NewGuid(); var thirdVersion = Guid.NewGuid(); - var thirdProcess = new Process(thirdProcessId, ProcessTypeId.APPLICATION_CHECKLIST, thirdVersion); + var thirdProcess = new Process(thirdProcessId, ProcessTypeId.APPLICATION_CHECKLIST, thirdVersion); var processData = new[] { firstProcess, secondProcess, thirdProcess }; var error = new Exception("save conflict error"); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); - Process? process = null; + Process? process = null; A.CallTo(() => _processExecutor.ExecuteProcess(firstProcessId, A._, A._)) .ReturnsLazily((Guid _, ProcessTypeId _, CancellationToken _) => { process = firstProcess; - return new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); + return new[] { IProcessExecutor.ProcessExecutionResult.LockRequested, IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); }); A.CallTo(() => _processExecutor.ExecuteProcess(secondProcessId, A._, A._)) .ReturnsLazily((Guid _, ProcessTypeId _, CancellationToken _) => { process = secondProcess; - return new[] { IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); + return new[] { IProcessExecutor.ProcessExecutionResult.SaveRequested }.ToAsyncEnumerable(); }); A.CallTo(() => _processExecutor.ExecuteProcess(thirdProcessId, A._, A._)) .ReturnsLazily((Guid _, ProcessTypeId _, CancellationToken _) => { process = thirdProcess; - return new[] { IProcessExecutor.ProcessExecutionResult.Unmodified }.ToAsyncEnumerable(); + return new[] { IProcessExecutor.ProcessExecutionResult.Unmodified }.ToAsyncEnumerable(); }); var changeHistory = new List<(Guid Id, Guid Version, DateTimeOffset? LockExpiryTime)>(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .Throws(error); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .Invokes(() => { changeHistory.Add( @@ -424,9 +424,9 @@ public async Task ExecuteAsync_ExecuteProcess_Returns_RequestLock_SaveAsyncThrow // Assert A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustHaveHappened(3, Times.Exactly); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustHaveHappenedTwiceExactly(); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustHaveHappened(3, Times.Exactly); changeHistory.Should().HaveCount(3) .And.SatisfyRespectively( @@ -447,7 +447,7 @@ public async Task ExecuteAsync_IgnoresLockedProcesses_LogsInformation() { var lockExpiryDate = _fixture.Create(); // Arrange - var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }).ToImmutableArray(); + var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid()) { LockExpiryDate = lockExpiryDate }).ToImmutableArray(); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); @@ -459,9 +459,9 @@ public async Task ExecuteAsync_IgnoresLockedProcesses_LogsInformation() .MustHaveHappened(processData.Length, Times.Exactly); A.CallTo(() => _processExecutor.ExecuteProcess(A._, A._, A._)) .MustNotHaveHappened(); - A.CallTo(() => _portalRepositories.SaveAsync()) + A.CallTo(() => _processRepositories.SaveAsync()) .MustNotHaveHappened(); - A.CallTo(() => _portalRepositories.Clear()) + A.CallTo(() => _processRepositories.Clear()) .MustNotHaveHappened(); } @@ -469,7 +469,7 @@ public async Task ExecuteAsync_IgnoresLockedProcesses_LogsInformation() public async Task ExecuteAsync_WithException_LogsError() { // Arrange - var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); + var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); var error = new Exception("Only a test"); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); @@ -487,14 +487,14 @@ public async Task ExecuteAsync_WithException_LogsError() A.CallTo(() => _mockLogger.Log(LogLevel.Information, A.That.Matches(e => e != null && e.Message == error.Message), A.That.StartsWith("error processing process"))).MustHaveHappened(3, Times.Exactly); A.CallTo(() => _mockLogger.Log(LogLevel.Information, A.That.IsNull(), A.That.Matches(x => x.StartsWith("finished processing process")))).MustNotHaveHappened(); A.CallTo(() => _mockLogger.Log(LogLevel.Error, A._, A._)).MustNotHaveHappened(); - A.CallTo(() => _portalRepositories.SaveAsync()).MustNotHaveHappened(); + A.CallTo(() => _processRepositories.SaveAsync()).MustNotHaveHappened(); } [Fact] public async Task ExecuteAsync_WithSystemException_Exits() { // Arrange - var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); + var processData = _fixture.CreateMany().Select(x => new Process(x, ProcessTypeId.APPLICATION_CHECKLIST, Guid.NewGuid())).ToImmutableArray(); var error = new SystemException("unrecoverable failure"); A.CallTo(() => _processStepRepository.GetActiveProcesses(A>._, A>._, A._)) .Returns(processData.ToAsyncEnumerable()); @@ -512,6 +512,6 @@ public async Task ExecuteAsync_WithSystemException_Exits() A.CallTo(() => _mockLogger.Log(LogLevel.Information, A.That.IsNotNull(), A._)).MustNotHaveHappened(); A.CallTo(() => _mockLogger.Log(LogLevel.Information, A.That.IsNull(), A.That.Matches(x => x.StartsWith("finished processing process")))).MustNotHaveHappened(); A.CallTo(() => _mockLogger.Log(LogLevel.Error, A.That.Matches(e => e != null && e.Message == error.Message), $"processing failed with following Exception {error.Message}")).MustHaveHappenedOnceExactly(); - A.CallTo(() => _portalRepositories.SaveAsync()).MustNotHaveHappened(); + A.CallTo(() => _processRepositories.SaveAsync()).MustNotHaveHappened(); } } diff --git a/tests/processes/Processes.Worker.Library.Tests/ProcessExecutorTests.cs b/tests/processes/Processes.Worker.Library.Tests/ProcessExecutorTests.cs index 2ee29480cf..a45749ec0f 100644 --- a/tests/processes/Processes.Worker.Library.Tests/ProcessExecutorTests.cs +++ b/tests/processes/Processes.Worker.Library.Tests/ProcessExecutorTests.cs @@ -19,10 +19,12 @@ using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Worker.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using System.Collections.Immutable; @@ -30,9 +32,9 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library.Tests; public class ProcessExecutorTests { - private readonly IProcessTypeExecutor _processTypeExecutor; - private readonly IProcessStepRepository _processStepRepository; - private readonly IProcessExecutor _sut; + private readonly IProcessTypeExecutor _processTypeExecutor; + private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessExecutor _sut; private readonly IFixture _fixture; public ProcessExecutorTests() @@ -42,19 +44,19 @@ public ProcessExecutorTests() .ForEach(b => _fixture.Behaviors.Remove(b)); _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); - _processTypeExecutor = A.Fake(); - _processStepRepository = A.Fake(); + _processTypeExecutor = A.Fake>(); + _processStepRepository = A.Fake>(); var portalRepositories = A.Fake(); - var logger = A.Fake>(); + var logger = A.Fake>>(); - A.CallTo(() => portalRepositories.GetInstance()) + A.CallTo(() => portalRepositories.GetInstance>()) .Returns(_processStepRepository); A.CallTo(() => _processTypeExecutor.GetProcessTypeId()) .Returns(ProcessTypeId.APPLICATION_CHECKLIST); - _sut = new ProcessExecutor( + _sut = new ProcessExecutor( new[] { _processTypeExecutor }, portalRepositories, logger); @@ -91,42 +93,42 @@ public async Task ExecuteProcess_WithInvalidProcessTypeId_Throws() [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified })] - public async Task ExecuteProcess_WithInitialSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_WithInitialSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -144,26 +146,26 @@ public async Task ExecuteProcess_WithInitialSteps_ReturnsExpected(ProcessStepSta .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, initialStepTypeIds)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, initialStepTypeIds)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); - IEnumerable? createdProcessSteps = null; + IEnumerable>? createdProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); + createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); return createdProcessSteps; }); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -188,7 +190,7 @@ public async Task ExecuteProcess_WithInitialSteps_ReturnsExpected(ProcessStepSta if (stepStatusId == ProcessStepStatusId.DONE) { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(initialStepTypeIds.Length + 1, Times.Exactly); modifiedProcessSteps .Should().HaveCount(initialStepTypeIds.Length + 1) @@ -200,43 +202,43 @@ public async Task ExecuteProcess_WithInitialSteps_ReturnsExpected(ProcessStepSta } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); } } [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified })] - public async Task ExecuteProcess_NoScheduleOrSkippedSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_NoScheduleOrSkippedSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -252,17 +254,17 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_ReturnsExpected(Proces .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -279,7 +281,7 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_ReturnsExpected(Proces if (stepStatusId == ProcessStepStatusId.DONE) { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(processStepData.Length, Times.Exactly); modifiedProcessSteps @@ -291,7 +293,7 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_ReturnsExpected(Proces } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); } } @@ -310,13 +312,13 @@ public async Task ExecuteProcess_NoExecutableSteps_ReturnsExpected() .Returns(false); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); // Act var result = await _sut.ExecuteProcess(processId, ProcessTypeId.APPLICATION_CHECKLIST, CancellationToken.None).ToListAsync(); // Assert - result.Should().HaveCount(1).And.Contain(IProcessExecutor.ProcessExecutionResult.Unmodified); + result.Should().HaveCount(1).And.Contain(IProcessExecutor.ProcessExecutionResult.Unmodified); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) .MustNotHaveHappened(); @@ -324,30 +326,30 @@ public async Task ExecuteProcess_NoExecutableSteps_ReturnsExpected() A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustNotHaveHappened(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); } [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified })] - public async Task ExecuteProcess_NoScheduleOrSkippedSteps_SingleStepTypeWithDuplicates_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_NoScheduleOrSkippedSteps_SingleStepTypeWithDuplicates_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -364,17 +366,17 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_SingleStepTypeWithDupl .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -394,7 +396,7 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_SingleStepTypeWithDupl if (stepStatusId == ProcessStepStatusId.DONE) { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(processStepData.Length, Times.Exactly); modifiedProcessSteps .Should().HaveSameCount(processStepData) @@ -409,49 +411,49 @@ public async Task ExecuteProcess_NoScheduleOrSkippedSteps_SingleStepTypeWithDupl } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); } } [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified })] - public async Task ExecuteProcess_WithScheduledSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_WithScheduledSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -468,29 +470,29 @@ public async Task ExecuteProcess_WithScheduledSteps_ReturnsExpected(ProcessStepS .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(processStepData.StepTypeId, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, scheduleStepTypeIds, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, scheduleStepTypeIds, null, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A.That.Not.IsEqualTo(processStepData.StepTypeId), A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); - IEnumerable? createdProcessSteps = null; + IEnumerable>? createdProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); + createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); return createdProcessSteps; }); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -519,7 +521,7 @@ public async Task ExecuteProcess_WithScheduledSteps_ReturnsExpected(ProcessStepS if (stepStatusId == ProcessStepStatusId.DONE) { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(scheduleStepTypeIds.Length + 1, Times.Exactly); modifiedProcessSteps .Should().HaveCount(scheduleStepTypeIds.Length + 1) @@ -531,34 +533,34 @@ public async Task ExecuteProcess_WithScheduledSteps_ReturnsExpected(ProcessStepS } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); } } [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified })] - public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -576,29 +578,29 @@ public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(Pro .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(stepTypeId, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, scheduleStepTypeIds, null, null)) + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, scheduleStepTypeIds, null, null)) .Once() .Then - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, null, null)); - IEnumerable? createdProcessSteps = null; + IEnumerable>? createdProcessSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); + createdProcessSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableList(); return createdProcessSteps; }); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -623,7 +625,7 @@ public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(Pro A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) .MustHaveHappened(2, Times.Exactly); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(2, Times.Exactly); modifiedProcessSteps @@ -634,7 +636,7 @@ public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(Pro } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustNotHaveHappened(); @@ -643,24 +645,24 @@ public async Task ExecuteProcess_WithDuplicateScheduledSteps_ReturnsExpected(Pro [Theory] [InlineData(ProcessStepStatusId.DONE, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.DONE, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(ProcessStepStatusId.TODO, false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] - public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepStatusId stepStatusId, bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -677,17 +679,17 @@ public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepSta .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) - .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, skipStepTypeIds, null)); + .Returns(new IProcessTypeExecutor.StepExecutionResult(false, stepStatusId, null, skipStepTypeIds.Select(x => x), null)); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -707,7 +709,7 @@ public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepSta if (stepStatusId == ProcessStepStatusId.DONE) { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(skipStepTypeIds.Length + 1, Times.Exactly); modifiedProcessSteps .Should().HaveCount(skipStepTypeIds.Length + 1) @@ -718,7 +720,7 @@ public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepSta } else { - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(skipStepTypeIds.Length, Times.Exactly); modifiedProcessSteps .Should().HaveCount(skipStepTypeIds.Length) @@ -730,27 +732,27 @@ public async Task ExecuteProcess_WithSkippedSteps_ReturnsExpected(ProcessStepSta [Theory] [InlineData(true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.LockRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] [InlineData(false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested, - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.SaveRequested + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.SaveRequested })] - public async Task ExecuteProcess_ProcessThrowsTestException_ReturnsExpected(bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_ProcessThrowsTestException_ReturnsExpected(bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -767,17 +769,17 @@ public async Task ExecuteProcess_ProcessThrowsTestException_ReturnsExpected(bool .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) .Throws(error); - var modifiedProcessSteps = new List(); + var modifiedProcessSteps = new List>(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) - .Invokes((Guid stepId, Action? initialize, Action modify) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) + .Invokes((Guid stepId, Action>? initialize, Action> modify) => { - var step = new ProcessStep(stepId, default, default, Guid.Empty, default); + var step = new ProcessStep(stepId, default, default, Guid.Empty, default); initialize?.Invoke(step); modify(step); modifiedProcessSteps.Add(step); @@ -795,7 +797,7 @@ public async Task ExecuteProcess_ProcessThrowsTestException_ReturnsExpected(bool A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .MustNotHaveHappened(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustHaveHappened(processStepData.Length, Times.Exactly); modifiedProcessSteps @@ -808,13 +810,13 @@ public async Task ExecuteProcess_ProcessThrowsTestException_ReturnsExpected(bool [Theory] [InlineData(true, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, - IProcessExecutor.ProcessExecutionResult.LockRequested, + IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.LockRequested, })] [InlineData(false, new[] { - IProcessExecutor.ProcessExecutionResult.Unmodified, + IProcessExecutor.ProcessExecutionResult.Unmodified, })] - public async Task ExecuteProcess_ProcessThrowsSystemException_Throws(bool isLockRequested, IEnumerable executionResults) + public async Task ExecuteProcess_ProcessThrowsSystemException_Throws(bool isLockRequested, IEnumerable.ProcessExecutionResult> executionResults) { // Arrange var processId = Guid.NewGuid(); @@ -831,12 +833,12 @@ public async Task ExecuteProcess_ProcessThrowsSystemException_Throws(bool isLock .Returns(isLockRequested); A.CallTo(() => _processTypeExecutor.InitializeProcess(processId, A>._)) - .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); + .Returns(new IProcessTypeExecutor.InitializationResult(false, null)); A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) .Throws(error); - var stepResults = new List(); + var stepResults = new List.ProcessExecutionResult>(); var Act = async () => { @@ -857,7 +859,7 @@ public async Task ExecuteProcess_ProcessThrowsSystemException_Throws(bool isLock A.CallTo(() => _processTypeExecutor.ExecuteProcessStep(A._, A>._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>._, A>._)) + A.CallTo(() => _processStepRepository.AttachAndModifyProcessStep(A._, A>>._, A>>._)) .MustNotHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) diff --git a/tests/processes/Processes.Worker.Library.Tests/Processes.Worker.Library.Tests.csproj b/tests/processes/Processes.Worker.Library.Tests/Processes.Worker.Library.Tests.csproj index 07cf929613..792a4e954f 100644 --- a/tests/processes/Processes.Worker.Library.Tests/Processes.Worker.Library.Tests.csproj +++ b/tests/processes/Processes.Worker.Library.Tests/Processes.Worker.Library.Tests.csproj @@ -42,7 +42,8 @@ - + + diff --git a/tests/processes/SelfDescriptionCreation.Executor.Tests/SdCreationProcessTypeExecutorTests.cs b/tests/processes/SelfDescriptionCreation.Executor.Tests/SdCreationProcessTypeExecutorTests.cs index bffd9c2cf2..f2cc880fe2 100644 --- a/tests/processes/SelfDescriptionCreation.Executor.Tests/SdCreationProcessTypeExecutorTests.cs +++ b/tests/processes/SelfDescriptionCreation.Executor.Tests/SdCreationProcessTypeExecutorTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; diff --git a/tests/processes/SelfDescriptionCreation.Executor.Tests/SelfDescriptionCreation.Executor.Tests.csproj b/tests/processes/SelfDescriptionCreation.Executor.Tests/SelfDescriptionCreation.Executor.Tests.csproj index 33af9370c6..21c4a614e3 100644 --- a/tests/processes/SelfDescriptionCreation.Executor.Tests/SelfDescriptionCreation.Executor.Tests.csproj +++ b/tests/processes/SelfDescriptionCreation.Executor.Tests/SelfDescriptionCreation.Executor.Tests.csproj @@ -44,6 +44,8 @@ + + diff --git a/tests/processes/UserProvisioning.Executor.Tests/UserProvisioningProcessTypeExecutorTests.cs b/tests/processes/UserProvisioning.Executor.Tests/UserProvisioningProcessTypeExecutorTests.cs index 05519bfcea..a1611e6144 100644 --- a/tests/processes/UserProvisioning.Executor.Tests/UserProvisioningProcessTypeExecutorTests.cs +++ b/tests/processes/UserProvisioning.Executor.Tests/UserProvisioningProcessTypeExecutorTests.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs b/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs index 98c6d69bce..e29354eb9f 100644 --- a/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs +++ b/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs @@ -19,7 +19,11 @@ using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -53,7 +57,7 @@ public class ServiceAccountCreationTests private readonly IServiceAccountRepository _serviceAccountRepository; private readonly IUserRepository _userRepository; private readonly IUserRolesRepository _userRolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IProvisioningManager _provisioningManager; private readonly IPortalRepositories _portalRepositories; private readonly IProvisioningDBAccess _provisioningDbAccess; @@ -73,7 +77,7 @@ public ServiceAccountCreationTests() _serviceAccountRepository = A.Fake(); _userRepository = A.Fake(); _userRolesRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _provisioningManager = A.Fake(); _portalRepositories = A.Fake(); @@ -88,7 +92,7 @@ public ServiceAccountCreationTests() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_serviceAccountRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_userRolesRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); _sut = new ServiceAccountCreation(_provisioningManager, _portalRepositories, _provisioningDbAccess, Options.Create(settings)); } @@ -411,9 +415,9 @@ private void Setup(ICollection? serviceAccounts = null, I }.ToAsyncEnumerable()); A.CallTo(() => _processStepRepository.CreateProcess(A._)) - .ReturnsLazily((ProcessTypeId processTypeId) => new Process(_processId, processTypeId, Guid.NewGuid())).Once(); + .ReturnsLazily((ProcessTypeId processTypeId) => new Process(_processId, processTypeId, Guid.NewGuid())).Once(); A.CallTo(() => _processStepRepository.CreateProcessStep(A._, A._, A._)) - .ReturnsLazily((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId) => new ProcessStep(_processStepId, processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)).Once(); + .ReturnsLazily((ProcessStepTypeId processStepTypeId, ProcessStepStatusId processStepStatusId, Guid processId) => new ProcessStep(_processStepId, processStepTypeId, processStepStatusId, processId, DateTimeOffset.UtcNow)).Once(); } #endregion diff --git a/tests/provisioning/Provisioning.Library.Tests/Provisioning.Library.Tests.csproj b/tests/provisioning/Provisioning.Library.Tests/Provisioning.Library.Tests.csproj index 98edb97987..e092da115b 100644 --- a/tests/provisioning/Provisioning.Library.Tests/Provisioning.Library.Tests.csproj +++ b/tests/provisioning/Provisioning.Library.Tests/Provisioning.Library.Tests.csproj @@ -43,6 +43,7 @@ + diff --git a/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs b/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs index 15d866d146..8c9f72d95a 100644 --- a/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs +++ b/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs @@ -18,6 +18,7 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; diff --git a/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs b/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs index 420c1d1c5b..2b34622316 100644 --- a/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs +++ b/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs @@ -23,6 +23,9 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Notifications.Library; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; @@ -63,7 +66,7 @@ public class ApplicationActivationTests private readonly IUserBusinessPartnerRepository _businessPartnerRepository; private readonly ICompanyRepository _companyRepository; private readonly IUserRolesRepository _rolesRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IMailingProcessCreation _mailingProcessCreation; private readonly List _notifications = new(); private readonly List _notifiedUserIds = new(); @@ -90,7 +93,7 @@ public ApplicationActivationTests() _dateTimeProvider = A.Fake(); _custodianService = A.Fake(); _settings = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); var options = A.Fake>(); @@ -111,7 +114,7 @@ public ApplicationActivationTests() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_businessPartnerRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_rolesRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => options.Value).Returns(_settings); _sut = new ApplicationActivationService(_portalRepositories, _notificationService, _provisioningManager, _dateTimeProvider, _custodianService, _mailingProcessCreation, options); @@ -412,7 +415,7 @@ public async Task HandleApplicationActivation_WithExternalApplication_ApprovesRe }; var userRoleData = new UserRoleData[] { new(UserRoleId, ClientId, "Company Admin") }; - var processSteps = new List(); + var processSteps = new List>(); var companyUserAssignedRole = _fixture.Create(); var companyUserAssignedBusinessPartner = _fixture.Create(); var companyApplication = _fixture.Build() @@ -441,7 +444,7 @@ public async Task HandleApplicationActivation_WithExternalApplication_ApprovesRe x.Single().ProcessStepTypeId == ProcessStepTypeId.TRIGGER_CALLBACK_OSP_APPROVED))) .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> steps) => { - processSteps.AddRange(steps.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); + processSteps.AddRange(steps.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); }); var context = new IApplicationChecklistService.WorkerChecklistProcessStepData( diff --git a/tests/registration/Registration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs b/tests/registration/Registration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs index 7a97aadf4c..0a827245a6 100644 --- a/tests/registration/Registration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs +++ b/tests/registration/Registration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs @@ -22,13 +22,17 @@ using FakeItEasy; using FluentAssertions; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; @@ -57,7 +61,7 @@ public class NetworkBusinessLogicTests private readonly IPortalRepositories _portalRepositories; private readonly ICompanyRepository _companyRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IApplicationRepository _applicationRepository; private readonly INetworkRepository _networkRepository; private readonly IIdentityProviderRepository _identityProviderRepository; @@ -76,7 +80,7 @@ public NetworkBusinessLogicTests() _checklistService = A.Fake(); _companyRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _applicationRepository = A.Fake(); _networkRepository = A.Fake(); _identityProviderRepository = A.Fake(); @@ -93,7 +97,7 @@ public NetworkBusinessLogicTests() A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_consentRepository); - A.CallTo(() => _portalRepositories.GetInstance()).Returns(_processStepRepository); + A.CallTo(() => _portalRepositories.GetInstance>()).Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_applicationRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_networkRepository); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_identityProviderRepository); @@ -264,7 +268,7 @@ public async Task Submit_WithValidData_CallsExpected() var agreementId1 = Guid.NewGuid(); var processId = Guid.NewGuid(); var submitProcessId = Guid.NewGuid(); - var processSteps = new List(); + var processSteps = new List>(); var application = new CompanyApplication(applicationId, _identity.CompanyId, CompanyApplicationStatusId.CREATED, CompanyApplicationTypeId.EXTERNAL, DateTimeOffset.UtcNow); var data = new PartnerSubmitData( @@ -288,7 +292,7 @@ public async Task Submit_WithValidData_CallsExpected() A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .Invokes((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> steps) => { - processSteps.AddRange(steps.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); + processSteps.AddRange(steps.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow))); }); var consents = new List(); var now = DateTimeOffset.UtcNow; @@ -301,7 +305,7 @@ public async Task Submit_WithValidData_CallsExpected() } }); A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST)) - .ReturnsLazily((ProcessTypeId processTypeId) => new Process(processId, processTypeId, Guid.NewGuid())); + .ReturnsLazily((ProcessTypeId processTypeId) => new Process(processId, processTypeId, Guid.NewGuid())); A.CallTo(() => _checklistService.CreateInitialChecklistAsync(applicationId)) .Returns(new[] { @@ -355,7 +359,7 @@ public async Task DeclineOsp_WithoutExisting_ThrowsNotFoundException() ( (CompanyStatusId, IEnumerable<(Guid, UserStatusId)>), IEnumerable<(Guid, InvitationStatusId)>, - VerifyProcessData + VerifyProcessData )?)>(default); // Act @@ -377,7 +381,7 @@ public async Task DeclineOsp_WithWrongCompany_ThrowsForbiddenException() default( ((CompanyStatusId, IEnumerable<(Guid, UserStatusId)>), IEnumerable<(Guid, InvitationStatusId)>, - VerifyProcessData)))); + VerifyProcessData)))); // Act async Task Act() => await _sut.DeclineOsp(applcationId, data); @@ -398,7 +402,7 @@ public async Task DeclineOsp_WithInternalApplication_ThrowsConflictException() default( ((CompanyStatusId, IEnumerable<(Guid, UserStatusId)>), IEnumerable<(Guid, InvitationStatusId)>, - VerifyProcessData)))); + VerifyProcessData)))); // Act async Task Act() => await _sut.DeclineOsp(applicationId, data); @@ -419,7 +423,7 @@ public async Task DeclineOsp_WithInvalidApplicationState_ThrowsConflictException default( ((CompanyStatusId, IEnumerable<(Guid, UserStatusId)>), IEnumerable<(Guid, InvitationStatusId)>, - VerifyProcessData)))); + VerifyProcessData)))); // Act async Task Act() => await _sut.DeclineOsp(applicationId, data); @@ -438,12 +442,12 @@ public async Task DeclineOsp_WithValid_ExecutesExpected() var invitation = _fixture.Build().With(x => x.InvitationStatusId, InvitationStatusId.PENDING).Create(); var identityId = Guid.NewGuid(); var currentVersion = Guid.NewGuid(); - var process = _fixture.Build() + var process = _fixture.Build>() .With(x => x.LockExpiryDate, default(DateTimeOffset?)) .With(x => x.Version, currentVersion).Create(); - var currentProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.MANUAL_DECLINE_OSP, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); - var removeUsersProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.REMOVE_KEYCLOAK_USERS, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); - var otherProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.SYNCHRONIZE_USER, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); + var currentProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.MANUAL_DECLINE_OSP, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); + var removeUsersProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.REMOVE_KEYCLOAK_USERS, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); + var otherProcessStep = new ProcessStep(Guid.NewGuid(), ProcessStepTypeId.SYNCHRONIZE_USER, ProcessStepStatusId.TODO, process.Id, DateTimeOffset.UtcNow); var existingProcessSteps = new[] { currentProcessStep, removeUsersProcessStep, otherProcessStep }; var data = _fixture.Create(); A.CallTo(() => _networkRepository.GetDeclineDataForApplicationId(application.Id, CompanyApplicationTypeId.EXTERNAL, A>._, IdentityCompanyId)) @@ -451,7 +455,7 @@ public async Task DeclineOsp_WithValid_ExecutesExpected() ( (company.CompanyStatusId, Enumerable.Repeat((identityId, UserStatusId.ACTIVE), 1)), Enumerable.Repeat((invitation.Id, invitation.InvitationStatusId), 1), - new VerifyProcessData(process, existingProcessSteps) + new VerifyProcessData(process, existingProcessSteps) ) )); A.CallTo(() => _applicationRepository.AttachAndModifyCompanyApplication(application.Id, A>._)) @@ -476,8 +480,8 @@ public async Task DeclineOsp_WithValid_ExecutesExpected() ).ToList(); initial.ForEach(x => x.modify(x.Invitation)); }); - A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A?, Action)>>._)) - .Invokes((IEnumerable<(Guid ProcessStepId, Action? Initialize, Action Modify)> processSteps) => + A.CallTo(() => _processStepRepository.AttachAndModifyProcessSteps(A>?, Action>)>>._)) + .Invokes((IEnumerable<(Guid ProcessStepId, Action>? Initialize, Action> Modify)> processSteps) => { var initial = processSteps.Select(x => { diff --git a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs index adcb010543..35062b38a5 100644 --- a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs +++ b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs @@ -27,14 +27,17 @@ using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Context; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Entities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; @@ -66,7 +69,7 @@ public class RegistrationBusinessLogicTest private readonly ICompanyRolesRepository _companyRolesRepository; private readonly IMailingProcessCreation _mailingProcessCreation; private readonly IConsentRepository _consentRepository; - private readonly IProcessStepRepository _processStepRepository; + private readonly IProcessStepRepository _processStepRepository; private readonly IIdentityProviderRepository _identityProviderRepository; private readonly IApplicationChecklistCreationService _checklistService; private readonly IIdentityData _identity; @@ -104,7 +107,7 @@ public RegistrationBusinessLogicTest() _checklistService = A.Fake(); _staticDataRepository = A.Fake(); - _processStepRepository = A.Fake(); + _processStepRepository = A.Fake>(); _identityProviderRepository = A.Fake(); _dateTimeProvider = A.Fake(); @@ -2073,12 +2076,12 @@ public async Task SubmitRegistrationAsync_WithDocumentId_Success() var utcNow = DateTimeOffset.UtcNow; - Process? process = null; + Process? process = null; A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.APPLICATION_CHECKLIST)) .ReturnsLazily((ProcessTypeId processTypeId) => { - process = new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid()); + process = new Process(Guid.NewGuid(), processTypeId, Guid.NewGuid()); return process; }); @@ -2091,12 +2094,12 @@ public async Task SubmitRegistrationAsync_WithDocumentId_Success() setOptionalParameters(application); }); - IEnumerable? processSteps = null; + IEnumerable>? processSteps = null; A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepTypeStatus) => { - processSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, utcNow)).ToImmutableArray(); + processSteps = processStepTypeStatus.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, utcNow)).ToImmutableArray(); return processSteps; }); var settings = new RegistrationSettings @@ -3247,7 +3250,7 @@ private void SetupRepositories() .Returns(_consentRepository); A.CallTo(() => _portalRepositories.GetInstance()) .Returns(_staticDataRepository); - A.CallTo(() => _portalRepositories.GetInstance()) + A.CallTo(() => _portalRepositories.GetInstance>()) .Returns(_processStepRepository); A.CallTo(() => _portalRepositories.GetInstance()) .Returns(_identityProviderRepository); @@ -3409,18 +3412,18 @@ public async Task DeclineApplicationRegistrationAsync_CallsExpected() } }); - var createdProcessesBuilder = ImmutableArray.CreateBuilder(); + var createdProcessesBuilder = ImmutableArray.CreateBuilder>(); A.CallTo(() => _processStepRepository.CreateProcessRange(A>._)) .ReturnsLazily((IEnumerable processTypeIds) => { - var processes = processTypeIds.Select(x => new Process(Guid.NewGuid(), x, Guid.NewGuid())).ToImmutableArray(); + var processes = processTypeIds.Select(x => new Process(Guid.NewGuid(), x, Guid.NewGuid())).ToImmutableArray(); createdProcessesBuilder.AddRange(processes); return processes; }); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)) .ReturnsLazily((IEnumerable<(ProcessStepTypeId ProcessStepTypeId, ProcessStepStatusId ProcessStepStatusId, Guid ProcessId)> processStepStatusTypeIds) => - processStepStatusTypeIds.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableArray()); + processStepStatusTypeIds.Select(x => new ProcessStep(Guid.NewGuid(), x.ProcessStepTypeId, x.ProcessStepStatusId, x.ProcessId, DateTimeOffset.UtcNow)).ToImmutableArray()); var modifiedIdentitiesBuilder = ImmutableArray.CreateBuilder<(Identity Initial, Identity Modified)>(); A.CallTo(() => _userRepository.AttachAndModifyIdentities(A?, Action)>>._)) diff --git a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs index 4a43133816..530b8bd22f 100644 --- a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs +++ b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs @@ -21,9 +21,9 @@ using FakeItEasy; using FluentAssertions; using Microsoft.AspNetCore.Mvc; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Controllers; diff --git a/tests/registration/Registration.Service.Tests/Registration.Service.Tests.csproj b/tests/registration/Registration.Service.Tests/Registration.Service.Tests.csproj index de47357036..a042aeeb4e 100644 --- a/tests/registration/Registration.Service.Tests/Registration.Service.Tests.csproj +++ b/tests/registration/Registration.Service.Tests/Registration.Service.Tests.csproj @@ -47,6 +47,7 @@ + diff --git a/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs b/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs index e665d7de17..4f8b22f0c8 100644 --- a/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs +++ b/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs @@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Web.Identity; using System.Security.Claims; diff --git a/tests/shared/Tests.Shared/FakeIdentityService.cs b/tests/shared/Tests.Shared/FakeIdentityService.cs index c5da66bda8..b96645ef29 100644 --- a/tests/shared/Tests.Shared/FakeIdentityService.cs +++ b/tests/shared/Tests.Shared/FakeIdentityService.cs @@ -17,8 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; namespace Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; diff --git a/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs b/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs index 31a468c241..af70b45df3 100644 --- a/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs +++ b/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs @@ -25,11 +25,11 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.TestSeeds; using Testcontainers.PostgreSql; using Xunit; diff --git a/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs b/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs index bd243fee46..2ed9a9e56b 100644 --- a/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs +++ b/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; diff --git a/tests/shared/Tests.Shared/Tests.Shared.csproj b/tests/shared/Tests.Shared/Tests.Shared.csproj index e7ba157f3a..b32d341c12 100644 --- a/tests/shared/Tests.Shared/Tests.Shared.csproj +++ b/tests/shared/Tests.Shared/Tests.Shared.csproj @@ -35,6 +35,7 @@ + diff --git a/tests/web/Web.Identity.Tests/MandatoryIdentityClaimHandlerTests.cs b/tests/web/Web.Identity.Tests/MandatoryIdentityClaimHandlerTests.cs index 26ed72621b..c281ca8939 100644 --- a/tests/web/Web.Identity.Tests/MandatoryIdentityClaimHandlerTests.cs +++ b/tests/web/Web.Identity.Tests/MandatoryIdentityClaimHandlerTests.cs @@ -20,10 +20,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.Framework.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Web.Identity; using System.Security.Claims; diff --git a/tests/web/Web.Identity.Tests/Web.Identity.Tests.csproj b/tests/web/Web.Identity.Tests/Web.Identity.Tests.csproj index 83b647e7f3..70ac76310e 100644 --- a/tests/web/Web.Identity.Tests/Web.Identity.Tests.csproj +++ b/tests/web/Web.Identity.Tests/Web.Identity.Tests.csproj @@ -43,6 +43,7 @@ + diff --git a/tests/web/Web.PublicInfos.Tests/PublicInformationBusinessLogicTests.cs b/tests/web/Web.PublicInfos.Tests/PublicInformationBusinessLogicTests.cs index a868f09d1d..dccc2d3b6d 100644 --- a/tests/web/Web.PublicInfos.Tests/PublicInformationBusinessLogicTests.cs +++ b/tests/web/Web.PublicInfos.Tests/PublicInformationBusinessLogicTests.cs @@ -23,10 +23,10 @@ using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Reflection; namespace Org.Eclipse.TractusX.Portal.Backend.Web.PublicInfos.Tests; diff --git a/tests/web/Web.PublicInfos.Tests/Web.PublicInfos.Tests.csproj b/tests/web/Web.PublicInfos.Tests/Web.PublicInfos.Tests.csproj index ff93b5103a..bed0bea84e 100644 --- a/tests/web/Web.PublicInfos.Tests/Web.PublicInfos.Tests.csproj +++ b/tests/web/Web.PublicInfos.Tests/Web.PublicInfos.Tests.csproj @@ -42,6 +42,7 @@ +