From 420b5da38e8c29c3e93246bda132d6fea96f16ee Mon Sep 17 00:00:00 2001 From: AnuragNagpure Date: Mon, 7 Oct 2024 18:03:22 +0530 Subject: [PATCH] Renamed tables colums and keys added as per ticket and discussion --- docs/api/administration-service.yaml | 30 +- .../BusinessLogic/ConnectorsBusinessLogic.cs | 4 +- .../ServiceAccountBusinessLogic.cs | 20 +- .../ServiceAccountConnectorOfferData.cs | 4 +- .../Models/ServiceAccountDetails.cs | 4 +- .../OfferProviderBusinessLogic.cs | 2 +- .../Service/OfferSetupService.cs | 4 +- .../Models/CompanyServiceAccountData.cs | 6 +- .../CompanyServiceAccountDetailedData.cs | 5 +- ...mpanyServiceAccountWithRoleDataClientId.cs | 5 +- .../Repositories/AppInstanceRepository.cs | 2 +- .../Repositories/ConnectorsRepository.cs | 44 +- .../IOfferSubscriptionsRepository.cs | 2 +- .../Repositories/IServiceAccountRepository.cs | 10 +- .../OfferSubscriptionsRepository.cs | 18 +- .../Repositories/ProcessStepRepository.cs | 6 +- .../Repositories/ServiceAccountRepository.cs | 76 +- ...es_navigationproperties_latest.Designer.cs | 9776 +++++++++++++++++ ..._properties_navigationproperties_latest.cs | 599 + .../PortalDbContextModelSnapshot.cs | 542 +- .../Seeder/BatchInsertSeeder.cs | 4 +- .../Seeder/BatchUpdateSeeder.cs | 2 +- ...ice_accounts.json => technical_users.json} | 56 +- .../AuditEntities/AuditConnector20240814.cs | 2 +- ...ppInstanceAssignedCompanyServiceAccount.cs | 8 +- .../Entities/CompanyServiceAccount.cs | 18 +- .../Entities/CompanyServiceAccountKind.cs | 16 +- .../Entities/CompanyServiceAccountType.cs | 16 +- .../Entities/Connector.cs | 4 +- .../Entities/DimCompanyServiceAccount.cs | 4 +- .../Entities/DimUserCreationData.cs | 6 +- .../Entities/Identity.cs | 2 +- .../Entities/OfferSubscription.cs | 4 +- .../Enums/CompanyServiceAccountKindId.cs | 2 +- .../Enums/CompanyServiceAccountTypeId.cs | 2 +- .../PortalDbContext.cs | 78 +- .../Views/CompaniesLinkedServiceAccount.cs | 4 +- .../Service/IServiceAccountCreation.cs | 4 +- .../Service/ServiceAccountCreation.cs | 18 +- .../ServiceAccountBusinessLogicTests.cs | 58 +- .../ServiceAccountControllerTests.cs | 4 +- .../AdministrationEndpointHelper.cs | 2 +- .../ServiceAccountCUDScenarios.cs | 24 +- .../OfferProviderBusinessLogicTests.cs | 24 +- .../Service/OfferSetupServiceTests.cs | 32 +- ...est.json => technical_users.unittest.json} | 44 +- .../ServiceAccountRespotitoryTests.cs | 58 +- .../Extensions/ServiceAccountCreationTests.cs | 54 +- 48 files changed, 11043 insertions(+), 666 deletions(-) create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.Designer.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.cs rename src/portalbackend/PortalBackend.Migrations/Seeder/Data/{company_service_accounts.json => technical_users.json} (89%) rename tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/{company_service_accounts.unittest.json => technical_users.unittest.json} (72%) diff --git a/docs/api/administration-service.yaml b/docs/api/administration-service.yaml index f13ccdf7ba..c276a3a652 100644 --- a/docs/api/administration-service.yaml +++ b/docs/api/administration-service.yaml @@ -6349,9 +6349,9 @@ components: name: type: string userType: - $ref: '#/components/schemas/CompanyServiceAccountKindId' + $ref: '#/components/schemas/TechnicalUserKindId' serviceAccountType: - $ref: '#/components/schemas/CompanyServiceAccountTypeId' + $ref: '#/components/schemas/TechnicalUserTypeId' status: $ref: '#/components/schemas/UserStatusId' isOwner: @@ -6377,16 +6377,6 @@ components: items: $ref: '#/components/schemas/CompanyServiceAccountData' additionalProperties: false - CompanyServiceAccountKindId: - enum: - - INTERNAL - - EXTERNAL - type: string - CompanyServiceAccountTypeId: - enum: - - MANAGED - - OWN - type: string CompanyUniqueIdData: type: object properties: @@ -7506,9 +7496,9 @@ components: items: $ref: '#/components/schemas/UserRoleData' companyServiceAccountTypeId: - $ref: '#/components/schemas/CompanyServiceAccountTypeId' + $ref: '#/components/schemas/TechnicalUserTypeId' usertype: - $ref: '#/components/schemas/CompanyServiceAccountKindId' + $ref: '#/components/schemas/TechnicalUserKindId' authenticationServiceUrl: type: string status: @@ -7564,7 +7554,7 @@ components: items: $ref: '#/components/schemas/UserRoleData' companyServiceAccountTypeId: - $ref: '#/components/schemas/CompanyServiceAccountTypeId' + $ref: '#/components/schemas/TechnicalUserTypeId' secret: type: string nullable: true @@ -7600,6 +7590,16 @@ components: description: type: string additionalProperties: false + TechnicalUserKindId: + enum: + - INTERNAL + - EXTERNAL + type: string + TechnicalUserTypeId: + enum: + - MANAGED + - OWN + type: string UniqueIdentifierId: enum: - COMMERCIAL_REG_NUMBER diff --git a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs index c891a72ec7..e0145f64e4 100644 --- a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs @@ -232,7 +232,7 @@ private async Task CreateAndRegisterConnectorAsync( connector.StatusId = _settings.ClearinghouseConnectDisabled ? ConnectorStatusId.ACTIVE : ConnectorStatusId.PENDING; if (technicalUserId != null) { - connector.CompanyServiceAccountId = technicalUserId; + connector.TechnicalUserId = technicalUserId; } }); @@ -305,7 +305,7 @@ private async Task DeleteUpdateConnectorDetail(Guid connectorId, IConnectorsRepo { connectorsRepository.AttachAndModifyConnector(connectorId, null, con => { - con.CompanyServiceAccountId = null; + con.TechnicalUserId = null; con.StatusId = ConnectorStatusId.INACTIVE; con.DateLastChanged = DateTimeOffset.UtcNow; }); diff --git a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs index c25ebd9cfe..4d9a149e34 100644 --- a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs @@ -79,8 +79,8 @@ public async Task> CreateOwnCompanyServiceAcc serviceAccountCreationInfos.UserRoleIds.Except(result.TechnicalUserRoleIds) .IfAny(unassignable => throw ControllerArgumentException.Create(AdministrationServiceAccountErrors.SERVICE_ROLES_NOT_ASSIGN_ARGUMENT, parameters: [new("unassignable", string.Join(",", unassignable)), new("userRoleIds", string.Join(",", result.TechnicalUserRoleIds))])); - const CompanyServiceAccountTypeId CompanyServiceAccountTypeId = CompanyServiceAccountTypeId.OWN; - var (_, _, serviceAccounts) = await serviceAccountCreation.CreateServiceAccountAsync(serviceAccountCreationInfos, companyId, [result.Bpn], CompanyServiceAccountTypeId, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null)).ConfigureAwait(ConfigureAwaitOptions.None); + const TechnicalUserTypeId TechnicalUserTypeId = TechnicalUserTypeId.OWN; + var (_, _, serviceAccounts) = await serviceAccountCreation.CreateServiceAccountAsync(serviceAccountCreationInfos, companyId, [result.Bpn], TechnicalUserTypeId, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null)).ConfigureAwait(ConfigureAwaitOptions.None); await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None); return serviceAccounts.Select(sa => new ServiceAccountDetails( @@ -91,7 +91,7 @@ public async Task> CreateOwnCompanyServiceAcc sa.Status, sa.ServiceAccountData?.AuthData.IamClientAuthMethod, sa.UserRoleData, - CompanyServiceAccountTypeId, + TechnicalUserTypeId, sa.ServiceAccountData?.AuthData.Secret)); } @@ -141,11 +141,11 @@ private void ModifyConnectorForDeleteServiceAccount(Guid serviceAccountId, OwnSe portalRepositories.GetInstance().AttachAndModifyConnector(result.ConnectorId.Value, connector => { - connector.CompanyServiceAccountId = serviceAccountId; + connector.TechnicalUserId = serviceAccountId; }, connector => { - connector.CompanyServiceAccountId = null; + connector.TechnicalUserId = null; }); } } @@ -193,8 +193,8 @@ public async Task GetOwnCompanyServiceAccountD result.Description, iamClientAuthMethod, result.UserRoleDatas, - result.CompanyServiceAccountTypeId, - result.CompanyServiceAccountKindId, + result.TechnicalUserTypeId, + result.TechnicalUserKindId, authServiceUrl, result.Status, secret, @@ -227,7 +227,7 @@ public async Task ResetOwnCompanyServiceAccountSecretAsyn result.Status, authData.IamClientAuthMethod, result.UserRoleDatas, - result.CompanyServiceAccountTypeId, + result.TechnicalUserTypeId, authData.Secret); } @@ -262,7 +262,7 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAs } ClientAuthData? authData; - if (result.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL) + if (result.TechnicalUserKindId == TechnicalUserKindId.INTERNAL) { var internalClientId = await provisioningManager.UpdateCentralClientAsync( result.ClientClientId, @@ -302,7 +302,7 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAs result.UserStatusId, authData?.IamClientAuthMethod, result.UserRoleDatas, - result.CompanyServiceAccountTypeId, + result.TechnicalUserTypeId, authData?.Secret, result.OfferSubscriptionId); } diff --git a/src/administration/Administration.Service/Models/ServiceAccountConnectorOfferData.cs b/src/administration/Administration.Service/Models/ServiceAccountConnectorOfferData.cs index c955fceb07..fb8c407949 100644 --- a/src/administration/Administration.Service/Models/ServiceAccountConnectorOfferData.cs +++ b/src/administration/Administration.Service/Models/ServiceAccountConnectorOfferData.cs @@ -32,8 +32,8 @@ public record ServiceAccountConnectorOfferData( [property: JsonPropertyName("description")] string Description, [property: JsonPropertyName("authenticationType")] IamClientAuthMethod? IamClientAuthMethod, [property: JsonPropertyName("roles")] IEnumerable UserRoleDatas, - [property: JsonPropertyName("companyServiceAccountTypeId")] CompanyServiceAccountTypeId CompanyServiceAccountTypeId, - [property: JsonPropertyName("usertype")] CompanyServiceAccountKindId CompanyServiceAccountKindId, + [property: JsonPropertyName("companyServiceAccountTypeId")] TechnicalUserTypeId TechnicalUserTypeId, + [property: JsonPropertyName("usertype")] TechnicalUserKindId TechnicalUserKindId, [property: JsonPropertyName("authenticationServiceUrl")] string AuthenticationServiceUrl, [property: JsonPropertyName("status")] UserStatusId UserStatusId, [property: JsonPropertyName("secret")] string? Secret, diff --git a/src/administration/Administration.Service/Models/ServiceAccountDetails.cs b/src/administration/Administration.Service/Models/ServiceAccountDetails.cs index 7a00086778..90da471fb6 100644 --- a/src/administration/Administration.Service/Models/ServiceAccountDetails.cs +++ b/src/administration/Administration.Service/Models/ServiceAccountDetails.cs @@ -26,14 +26,14 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; public record ServiceAccountDetails( - [property: JsonPropertyName("serviceAccountId")] Guid ServiceAccountId, + [property: JsonPropertyName("serviceAccountId")] Guid TechnicalUserId, [property: JsonPropertyName("clientId")] string? ClientId, [property: JsonPropertyName("name")] string Name, [property: JsonPropertyName("description")] string Description, [property: JsonPropertyName("status")] UserStatusId Status, [property: JsonPropertyName("authenticationType")] IamClientAuthMethod? IamClientAuthMethod, [property: JsonPropertyName("roles")] IEnumerable UserRoleDatas, - [property: JsonPropertyName("companyServiceAccountTypeId")] CompanyServiceAccountTypeId CompanyServiceAccountTypeId, + [property: JsonPropertyName("companyServiceAccountTypeId")] TechnicalUserTypeId TechnicalUserTypeId, [property: JsonPropertyName("secret")] string? Secret, [property: JsonPropertyName("subscriptionId")] Guid? SubscriptionId = null ); diff --git a/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs b/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs index 04e1e30e29..1a3e59edbf 100644 --- a/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs +++ b/src/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogic.cs @@ -141,7 +141,7 @@ await _offerProviderService } technicalUserInfoData = new CallbackTechnicalUserInfoData( serviceAccount.TechnicalUserId, - serviceAccount.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL + serviceAccount.TechnicalUserKindId == TechnicalUserKindId.INTERNAL ? await GetServiceAccountSecret(serviceAccount.TechnicalClientId).ConfigureAwait(ConfigureAwaitOptions.None) : null, serviceAccount.TechnicalClientId); diff --git a/src/marketplace/Offers.Library/Service/OfferSetupService.cs b/src/marketplace/Offers.Library/Service/OfferSetupService.cs index 5a813f6bc6..0c7ed37a48 100644 --- a/src/marketplace/Offers.Library/Service/OfferSetupService.cs +++ b/src/marketplace/Offers.Library/Service/OfferSetupService.cs @@ -185,7 +185,7 @@ private async Task AutoSetupOfferMultiInstance(Offer serviceAccountCreationInfo, data.CompanyId, data.Bpn == null ? Enumerable.Empty() : Enumerable.Repeat(data.Bpn, 1), - CompanyServiceAccountTypeId.MANAGED, + TechnicalUserTypeId.MANAGED, data.EnhanceTechnicalUserName, data.Enabled, new ServiceAccountCreationProcessData(ProcessTypeId.OFFER_SUBSCRIPTION, processId), @@ -280,7 +280,7 @@ private async IAsyncEnumerable> CreateTechnic creationInfo, data.CompanyId, data.Bpn == null ? Enumerable.Empty() : [data.Bpn], - CompanyServiceAccountTypeId.MANAGED, + TechnicalUserTypeId.MANAGED, data.EnhanceTechnicalUserName, data.Enabled, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null)) diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountData.cs index a12cb3cb9d..85f9b511d2 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountData.cs @@ -24,11 +24,11 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; public record CompanyServiceAccountData( - [property: JsonPropertyName("serviceAccountId")] Guid ServiceAccountId, + [property: JsonPropertyName("serviceAccountId")] Guid TechnicalUserId, [property: JsonPropertyName("clientId")] string? ClientId, [property: JsonPropertyName("name")] string Name, - [property: JsonPropertyName("userType")] CompanyServiceAccountKindId CompanyServiceAccountKindId, - [property: JsonPropertyName("serviceAccountType")] CompanyServiceAccountTypeId CompanyServiceAccountTypeId, + [property: JsonPropertyName("userType")] TechnicalUserKindId TechnicalUserKindId, + [property: JsonPropertyName("serviceAccountType")] TechnicalUserTypeId TechnicalUserTypeId, [property: JsonPropertyName("status")] UserStatusId UserStatusId, [property: JsonPropertyName("isOwner")] bool IsOwner, [property: JsonPropertyName("isProvider")] bool IsProvider, diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountDetailedData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountDetailedData.cs index 136824ec0a..8ed6d0d79f 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountDetailedData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountDetailedData.cs @@ -18,6 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +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.Models; @@ -29,8 +30,8 @@ public record CompanyServiceAccountDetailedData( string Description, UserStatusId Status, IEnumerable UserRoleDatas, - CompanyServiceAccountTypeId CompanyServiceAccountTypeId, - CompanyServiceAccountKindId CompanyServiceAccountKindId, + TechnicalUserTypeId TechnicalUserTypeId, + TechnicalUserKindId TechnicalUserKindId, ConnectorResponseData? ConnectorData, OfferResponseData? OfferSubscriptionData, CompanyLastEditorData? CompanyLastEditorData, diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountWithRoleDataClientId.cs b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountWithRoleDataClientId.cs index c6e1f1a6bd..9b8b732ef2 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountWithRoleDataClientId.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyServiceAccountWithRoleDataClientId.cs @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +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.Models; @@ -26,8 +27,8 @@ public record CompanyServiceAccountWithRoleDataClientId( string Name, string Description, string? ClientClientId, - CompanyServiceAccountTypeId CompanyServiceAccountTypeId, - CompanyServiceAccountKindId CompanyServiceAccountKindId, + TechnicalUserTypeId TechnicalUserTypeId, + TechnicalUserKindId TechnicalUserKindId, Guid? OfferSubscriptionId, UserStatusId UserStatusId, IEnumerable UserRoleDatas); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/AppInstanceRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/AppInstanceRepository.cs index 13c7df67cc..d086743db0 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/AppInstanceRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/AppInstanceRepository.cs @@ -61,7 +61,7 @@ public Task CheckInstanceExistsForOffer(Guid offerId) => public IAsyncEnumerable GetAssignedServiceAccounts(Guid appInstanceId) => _portalDbContext.AppInstanceAssignedServiceAccounts .Where(x => x.AppInstanceId == appInstanceId) - .Select(x => x.CompanyServiceAccountId) + .Select(x => x.TechnicalUserId) .ToAsyncEnumerable(); /// diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs index 9c70f4d97b..e463d252f1 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs @@ -49,11 +49,11 @@ public class ConnectorsRepository(PortalDbContext dbContext) : IConnectorsReposi con.HostId, con.Host!.Name, con.SelfDescriptionDocumentId, - con.CompanyServiceAccountId == null ? null : new TechnicalUserData( - con.CompanyServiceAccount!.Id, - con.CompanyServiceAccount.Name, - con.CompanyServiceAccount.ClientClientId, - con.CompanyServiceAccount.Description), + con.TechnicalUserId == null ? null : new TechnicalUserData( + con.TechnicalUser!.Id, + con.TechnicalUser.Name, + con.TechnicalUser.ClientClientId, + con.TechnicalUser.Description), con.ConnectorUrl) ).SingleOrDefaultAsync(); @@ -76,11 +76,11 @@ public class ConnectorsRepository(PortalDbContext dbContext) : IConnectorsReposi c.StatusId, c.Provider!.Name, c.SelfDescriptionDocumentId, - c.CompanyServiceAccountId == default ? null : new TechnicalUserData( - c.CompanyServiceAccount!.Id, - c.CompanyServiceAccount.Name, - c.CompanyServiceAccount.ClientClientId, - c.CompanyServiceAccount.Description), + c.TechnicalUserId == default ? null : new TechnicalUserData( + c.TechnicalUser!.Id, + c.TechnicalUser.Name, + c.TechnicalUser.ClientClientId, + c.TechnicalUser.Description), c.ConnectorUrl) ).SingleOrDefaultAsync(); @@ -98,11 +98,11 @@ public class ConnectorsRepository(PortalDbContext dbContext) : IConnectorsReposi connector.HostId, connector.Host!.Name, connector.SelfDescriptionDocumentId, - connector.CompanyServiceAccountId == default ? null : new TechnicalUserData( - connector.CompanyServiceAccount!.Id, - connector.CompanyServiceAccount.Name, - connector.CompanyServiceAccount.ClientClientId, - connector.CompanyServiceAccount.Description), + connector.TechnicalUserId == default ? null : new TechnicalUserData( + connector.TechnicalUser!.Id, + connector.TechnicalUser.Name, + connector.TechnicalUser.ClientClientId, + connector.TechnicalUser.Description), connector.ConnectorUrl), connector.ProviderId == companyId )) @@ -170,17 +170,17 @@ public Connector AttachAndModifyConnector(Guid connectorId, Action? i x.OfferSubscriptionId, x.OfferSubscription!.OfferSubscriptionStatusId )), - connector.CompanyServiceAccount!.Identity!.UserStatusId, - connector.CompanyServiceAccountId, + connector.TechnicalUser!.Identity!.UserStatusId, + connector.TechnicalUserId, new DeleteServiceAccountData( - connector.CompanyServiceAccount!.Identity!.IdentityAssignedRoles.Select(r => r.UserRoleId), - connector.CompanyServiceAccount.ClientClientId, - connector.CompanyServiceAccount.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL, - connector.CompanyServiceAccount.DimUserCreationData!.Process!.ProcessSteps + connector.TechnicalUser!.Identity!.IdentityAssignedRoles.Select(r => r.UserRoleId), + connector.TechnicalUser.ClientClientId, + connector.TechnicalUser.TechnicalUserKindId == TechnicalUserKindId.EXTERNAL, + connector.TechnicalUser.DimUserCreationData!.Process!.ProcessSteps .Any(ps => ps.ProcessStepStatusId == ProcessStepStatusId.TODO && processStepsToFilter.Contains(ps.ProcessStepTypeId)), - connector.CompanyServiceAccount.DimUserCreationData == null ? null : connector.CompanyServiceAccount.DimUserCreationData!.ProcessId) + connector.TechnicalUser.DimUserCreationData == null ? null : connector.TechnicalUser.DimUserCreationData!.ProcessId) )).SingleOrDefaultAsync(); /// diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs index ba49f924f5..d29a9cb2c1 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs @@ -159,7 +159,7 @@ public interface IOfferSubscriptionsRepository 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); + Task<(IEnumerable<(Guid TechnicalUserId, string? TechnicalClientId, TechnicalUserKindId TechnicalUserKindId)> ServiceAccounts, string? ClientId, string? CallbackUrl, OfferSubscriptionStatusId Status)> GetTriggerProviderCallbackInformation(Guid offerSubscriptionId); OfferSubscriptionProcessData CreateOfferSubscriptionProcessData(Guid offerSubscriptionId, string offerUrl); void RemoveOfferSubscriptionProcessData(Guid offerSubscriptionProcessDataId); IAsyncEnumerable GetProcessStepsForSubscription(Guid offerSubscriptionId); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs index 8cb40a1ee8..0825176e9e 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs @@ -26,15 +26,15 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositorie public interface IServiceAccountRepository { - CompanyServiceAccount CreateCompanyServiceAccount(Guid identityId, + TechnicalUser CreateCompanyServiceAccount(Guid identityId, string name, string description, string? clientClientId, - CompanyServiceAccountTypeId companyServiceAccountTypeId, - CompanyServiceAccountKindId companyServiceAccountKindId, - Action? setOptionalParameters = null); + TechnicalUserTypeId technicalUserTypeId, + TechnicalUserKindId technicalUserKindId, + Action? setOptionalParameters = null); - void AttachAndModifyCompanyServiceAccount(Guid id, Guid version, Action? initialize, Action modify); + void AttachAndModifyCompanyServiceAccount(Guid id, Guid version, Action? initialize, Action modify); Task GetOwnCompanyServiceAccountWithIamClientIdAsync(Guid serviceAccountId, Guid userCompanyId); Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId, IEnumerable processStepsToFilter); Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(Guid serviceAccountId, Guid companyId); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs index bfd2be9d68..e9975890e8 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs @@ -101,8 +101,8 @@ public OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, O true, os.ConnectorAssignedOfferSubscriptions.Where(caos => caos.Connector!.StatusId != ConnectorStatusId.INACTIVE).Select(caos => caos.Connector!.Id), - os.ConnectorAssignedOfferSubscriptions.Where(caos => caos.Connector!.CompanyServiceAccountId != null && caos.Connector.CompanyServiceAccount!.Identity!.UserStatusId != UserStatusId.INACTIVE).Select(caos => - caos.Connector!.CompanyServiceAccount!.Identity!.Id) + os.ConnectorAssignedOfferSubscriptions.Where(caos => caos.Connector!.TechnicalUserId != null && caos.Connector.TechnicalUser!.Identity!.UserStatusId != UserStatusId.INACTIVE).Select(caos => + caos.Connector!.TechnicalUser!.Identity!.Id) )) .SingleOrDefaultAsync(); @@ -202,7 +202,7 @@ public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscription x.Company!.Name, x.Company.BusinessPartnerNumber, x.Company.Identities.Where(x => x.IdentityTypeId == IdentityTypeId.COMPANY_USER).Select(i => i.CompanyUser!).Where(cu => cu.Email != null && cu.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Any(ur => userRoleIds.Contains(ur.Id))).Select(cu => cu.Email!), - x.Subscription.CompanyServiceAccounts.Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.ClientClientId, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText)))) + x.Subscription.Technicalusers.Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.ClientClientId, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText)))) : null)) .SingleOrDefaultAsync(); @@ -227,7 +227,7 @@ public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscription x.Company!.Name, x.Company.BusinessPartnerNumber, x.Company.Identities.Where(i => i.IdentityTypeId == IdentityTypeId.COMPANY_USER).Select(id => id.CompanyUser!).Where(cu => cu.Email != null && cu.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Any(ur => userRoleIds.Contains(ur.Id))).Select(cu => cu.Email!), - x.Subscription.CompanyServiceAccounts.Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.Name, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText))), + x.Subscription.Technicalusers.Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.Name, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText))), x.Subscription.AppSubscriptionDetail!.AppSubscriptionUrl, x.Subscription.AppSubscriptionDetail!.AppInstance!.IamClient!.ClientClientId, x.Subscription.Process!.ProcessSteps @@ -261,7 +261,7 @@ public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscription x.Subscription.Offer!.Name, x.ProviderCompany!.Name, x.ProviderCompany.Identities.Where(x => x.IdentityTypeId == IdentityTypeId.COMPANY_USER).Select(i => i.CompanyUser!).Where(cu => cu.Email != null && cu.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Any(ur => userRoleIds.Contains(ur.Id))).Select(cu => cu.Email!), - x.Subscription.CompanyServiceAccounts.Where(x => x.Identity!.IdentityAssignedRoles.Any()).Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.Name, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText))), + x.Subscription.Technicalusers.Where(x => x.Identity!.IdentityAssignedRoles.Any()).Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.Name, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText))), x.Subscription.ConnectorAssignedOfferSubscriptions.Select(caos => new SubscriptionAssignedConnectorData( caos.Connector!.Id, caos.Connector.Name, @@ -393,7 +393,7 @@ public Task GetOfferSubscriptionDataForProcessIdAsync(Guid processId) => x.Offer.OfferTypeId == OfferTypeId.APP && (x.Offer.AppInstanceSetup == null || !x.Offer.AppInstanceSetup!.IsSingleInstance) ? x.AppSubscriptionDetail!.AppInstance!.IamClient!.ClientClientId : null, - x.CompanyServiceAccounts.Where(sa => sa.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL && sa.ClientClientId != null).Select(sa => sa.ClientClientId!), + x.Technicalusers.Where(sa => sa.TechnicalUserKindId == TechnicalUserKindId.INTERNAL && sa.ClientClientId != null).Select(sa => sa.ClientClientId!), x.Offer.ProviderCompany!.ProviderCompanyDetail!.AutoSetupCallbackUrl != null )) .SingleOrDefaultAsync(); @@ -449,11 +449,11 @@ public Task GetOfferSubscriptionDataForProcessIdAsync(Guid processId) => .SingleOrDefaultAsync(); /// - public Task<(IEnumerable<(Guid TechnicalUserId, string? TechnicalClientId, CompanyServiceAccountKindId CompanyServiceAccountKindId)> ServiceAccounts, string? ClientId, string? CallbackUrl, OfferSubscriptionStatusId Status)> GetTriggerProviderCallbackInformation(Guid offerSubscriptionId) => + public Task<(IEnumerable<(Guid TechnicalUserId, string? TechnicalClientId, TechnicalUserKindId TechnicalUserKindId)> ServiceAccounts, string? ClientId, string? CallbackUrl, OfferSubscriptionStatusId Status)> GetTriggerProviderCallbackInformation(Guid offerSubscriptionId) => dbContext.OfferSubscriptions .Where(x => x.Id == offerSubscriptionId) - .Select(x => new ValueTuple, string?, string?, OfferSubscriptionStatusId>( - x.CompanyServiceAccounts.Select(sa => new ValueTuple(sa.Id, sa.ClientClientId, sa.CompanyServiceAccountKindId)), + .Select(x => new ValueTuple, string?, string?, OfferSubscriptionStatusId>( + x.Technicalusers.Select(sa => new ValueTuple(sa.Id, sa.ClientClientId, sa.TechnicalUserKindId)), x.AppSubscriptionDetail!.AppInstance!.IamClient!.ClientClientId, x.Offer!.ProviderCompany!.ProviderCompanyDetail!.AutoSetupCallbackUrl, x.OfferSubscriptionStatusId diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs index 7c53f6d24d..e160007779 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ProcessStepRepository.cs @@ -119,8 +119,8 @@ public IAsyncEnumerable GetActiveProcesses(IEnumerable p .Where(step => processStepTypeIds.Contains(step.ProcessStepTypeId) && step.ProcessStepStatusId == ProcessStepStatusId.TODO)), - x.DimUserCreationData!.ServiceAccountId, - x.DimUserCreationData.ServiceAccount!.Version) + x.DimUserCreationData!.TechnicalUserId, + x.DimUserCreationData.TechnicalUser!.Version) ) .SingleOrDefaultAsync(); @@ -135,7 +135,7 @@ public IAsyncEnumerable GetActiveProcesses(IEnumerable p .Where(step => (processStepTypeIds == null || processStepTypeIds.Contains(step.ProcessStepTypeId)) && step.ProcessStepStatusId == ProcessStepStatusId.TODO)), - x.DimUserCreationData!.ServiceAccountId) + x.DimUserCreationData!.TechnicalUserId) ) .SingleOrDefaultAsync(); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs index 9458d35cf4..2e06dacc56 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs @@ -29,50 +29,50 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositorie public class ServiceAccountRepository(PortalDbContext portalDbContext) : IServiceAccountRepository { - public CompanyServiceAccount CreateCompanyServiceAccount( + public TechnicalUser CreateCompanyServiceAccount( Guid identityId, string name, string description, string? clientClientId, - CompanyServiceAccountTypeId companyServiceAccountTypeId, - CompanyServiceAccountKindId companyServiceAccountKindId, - Action? setOptionalParameters = null) + TechnicalUserTypeId technicalUserTypeId, + TechnicalUserKindId technicalUserKindId, + Action? setOptionalParameters = null) { - var entity = new CompanyServiceAccount( + var entity = new TechnicalUser( identityId, Guid.NewGuid(), name, description, - companyServiceAccountTypeId, - companyServiceAccountKindId) + technicalUserTypeId, + technicalUserKindId) { ClientClientId = clientClientId }; setOptionalParameters?.Invoke(entity); - return portalDbContext.CompanyServiceAccounts.Add(entity).Entity; + return portalDbContext.TechnicalUsers.Add(entity).Entity; } public void AttachAndModifyCompanyServiceAccount( Guid id, Guid version, - Action? initialize, - Action modify) + Action? initialize, + Action modify) { - var companyServiceAccount = new CompanyServiceAccount( + var technicalUser = new TechnicalUser( id, version, null!, null!, default, default); - initialize?.Invoke(companyServiceAccount); - portalDbContext.Attach(companyServiceAccount); - modify(companyServiceAccount); - companyServiceAccount.UpdateVersion(); + initialize?.Invoke(technicalUser); + portalDbContext.Attach(technicalUser); + modify(technicalUser); + technicalUser.UpdateVersion(); } public Task GetOwnCompanyServiceAccountWithIamClientIdAsync(Guid serviceAccountId, Guid userCompanyId) => - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .Where(serviceAccount => serviceAccount.Id == serviceAccountId && serviceAccount.Identity!.UserStatusId == UserStatusId.ACTIVE @@ -82,8 +82,8 @@ public void AttachAndModifyCompanyServiceAccount( serviceAccount.Name, serviceAccount.Description, serviceAccount.ClientClientId, - serviceAccount.CompanyServiceAccountTypeId, - serviceAccount.CompanyServiceAccountKindId, + serviceAccount.TechnicalUserTypeId, + serviceAccount.TechnicalUserKindId, serviceAccount.OfferSubscriptionId, serviceAccount.Identity!.UserStatusId, serviceAccount.Identity!.IdentityAssignedRoles @@ -95,7 +95,7 @@ public void AttachAndModifyCompanyServiceAccount( .SingleOrDefaultAsync(); public Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId, IEnumerable processStepsToFilter) => - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .Where(serviceAccount => serviceAccount.Id == serviceAccountId) .Select(sa => new OwnServiceAccountData( @@ -108,7 +108,7 @@ public void AttachAndModifyCompanyServiceAccount( sa.ClientClientId, sa.Connector!.StatusId, sa.OfferSubscription!.OfferSubscriptionStatusId, - sa.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL, + sa.TechnicalUserKindId == TechnicalUserKindId.EXTERNAL, sa.DimUserCreationData!.Process!.ProcessSteps .Any(ps => ps.ProcessStepStatusId == ProcessStepStatusId.TODO && @@ -117,7 +117,7 @@ public void AttachAndModifyCompanyServiceAccount( .SingleOrDefaultAsync(); public Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(Guid serviceAccountId, Guid companyId) => - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .AsNoTracking() .Select(serviceAccount => new { @@ -126,7 +126,7 @@ public void AttachAndModifyCompanyServiceAccount( serviceAccount.Connector, serviceAccount.OfferSubscription, serviceAccount.Identity!.LastEditor, - serviceAccount.DimCompanyServiceAccount, + serviceAccount.ExternalTechnicalUser, serviceAccount.CompaniesLinkedServiceAccount }) .Where(x => @@ -145,8 +145,8 @@ public void AttachAndModifyCompanyServiceAccount( userRole!.Id, userRole.Offer!.AppInstances.First().IamClient!.ClientClientId, userRole.UserRoleText)), - x.ServiceAccount.CompanyServiceAccountTypeId, - x.ServiceAccount.CompanyServiceAccountKindId, + x.ServiceAccount.TechnicalUserTypeId, + x.ServiceAccount.TechnicalUserKindId, x.Connector == null ? null : new ConnectorResponseData( @@ -164,22 +164,22 @@ public void AttachAndModifyCompanyServiceAccount( : new CompanyLastEditorData( x.LastEditor!.IdentityTypeId == IdentityTypeId.COMPANY_USER ? x.LastEditor.CompanyUser!.Lastname - : x.LastEditor.CompanyServiceAccount!.Name, + : x.LastEditor.TechnicalUser!.Name, x.LastEditor.Company!.Name), - x.ServiceAccount.DimCompanyServiceAccount == null + x.ServiceAccount.ExternalTechnicalUser == null ? null : new DimServiceAccountData( - x.DimCompanyServiceAccount!.AuthenticationServiceUrl, - x.DimCompanyServiceAccount!.ClientSecret, - x.DimCompanyServiceAccount.InitializationVector, - x.DimCompanyServiceAccount.EncryptionMode))) + x.ExternalTechnicalUser!.AuthenticationServiceUrl, + x.ExternalTechnicalUser!.ClientSecret, + x.ExternalTechnicalUser.InitializationVector, + x.ExternalTechnicalUser.EncryptionMode))) .SingleOrDefaultAsync(); public Func?>> GetOwnCompanyServiceAccountsUntracked(Guid userCompanyId, string? clientId, bool? isOwner, IEnumerable userStatusIds) => (skip, take) => Pagination.CreateSourceQueryAsync( skip, take, - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .AsNoTracking() .Select(serviceAccount => new { @@ -199,8 +199,8 @@ public void AttachAndModifyCompanyServiceAccount( x.ServiceAccount.Id, x.ServiceAccount.ClientClientId, x.ServiceAccount.Name, - x.ServiceAccount.CompanyServiceAccountKindId, - x.ServiceAccount.CompanyServiceAccountTypeId, + x.ServiceAccount.TechnicalUserKindId, + x.ServiceAccount.TechnicalUserTypeId, x.ServiceAccount.Identity!.UserStatusId, x.IsOwner, x.IsProvider, @@ -221,7 +221,7 @@ public void AttachAndModifyCompanyServiceAccount( /// public Task CheckActiveServiceAccountExistsForCompanyAsync(Guid technicalUserId, Guid companyId) => - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .Where(sa => sa.Id == technicalUserId && (sa.Identity!.UserStatusId == UserStatusId.ACTIVE || sa.Identity!.UserStatusId == UserStatusId.PENDING) && @@ -229,7 +229,7 @@ public Task CheckActiveServiceAccountExistsForCompanyAsync(Guid technicalU .AnyAsync(); public Task<(Guid IdentityId, Guid CompanyId)> GetServiceAccountDataByClientId(string clientId) => - portalDbContext.CompanyServiceAccounts + portalDbContext.TechnicalUsers .Where(sa => sa.ClientClientId == clientId) .Select(sa => new ValueTuple( sa.Id, @@ -237,7 +237,7 @@ public Task CheckActiveServiceAccountExistsForCompanyAsync(Guid technicalU .SingleOrDefaultAsync(); public void CreateDimCompanyServiceAccount(Guid serviceAccountId, string authenticationServiceUrl, byte[] secret, byte[] initializationVector, int encryptionMode) => - portalDbContext.DimCompanyServiceAccounts.Add(new DimCompanyServiceAccount(serviceAccountId, authenticationServiceUrl, secret, initializationVector, encryptionMode)); + portalDbContext.ExternalTechnicalUsers.Add(new ExternalTechnicalUser(serviceAccountId, authenticationServiceUrl, secret, initializationVector, encryptionMode)); public void CreateDimUserCreationData(Guid serviceAccountId, Guid processId) => portalDbContext.DimUserCreationData.Add(new DimUserCreationData(Guid.NewGuid(), serviceAccountId, processId)); @@ -247,8 +247,8 @@ public void CreateDimUserCreationData(Guid serviceAccountId, Guid processId) => .Where(x => x.Id == dimServiceAccountId) .Select(x => new ValueTuple( true, - x.ServiceAccount!.Identity!.Company!.BusinessPartnerNumber, - x.ServiceAccount!.Name)) + x.TechnicalUser!.Identity!.Company!.BusinessPartnerNumber, + x.TechnicalUser!.Name)) .SingleOrDefaultAsync(); public Task GetDimServiceAccountIdForProcess(Guid processId) => diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.Designer.cs new file mode 100644 index 0000000000..5d5877af19 --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.Designer.cs @@ -0,0 +1,9776 @@ +/******************************************************************************** + * 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 Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using System.Text.Json; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + [DbContext(typeof(PortalDbContext))] + [Migration("20241007103241_adjust_table_with_properties_navigationproperties_latest")] + partial class adjust_table_with_properties_navigationproperties_latest + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("portal") + .UseCollation("en_US.utf8") + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + 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("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("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_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("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + + b.HasKey("AppInstanceId", "TechnicalUserId") + .HasName("pk_app_instance_assigned_service_accounts"); + + b.HasIndex("TechnicalUserId") + .HasDatabaseName("ix_app_instance_assigned_service_accounts_technical_user_id"); + + 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") + .IsUnique() + .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("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.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") + .IsUnique() + .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("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("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("Id") + .HasName("pk_connectors"); + + 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("TechnicalUserId") + .IsUnique() + .HasDatabaseName("ix_connectors_technical_user_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\", \"technical_user_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.\"technical_user_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\", \"technical_user_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.\"technical_user_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.DimUserCreationData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ProcessId") + .HasColumnType("uuid") + .HasColumnName("process_id"); + + b.Property("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + + b.HasKey("Id") + .HasName("pk_dim_user_creation_data"); + + b.HasIndex("ProcessId") + .IsUnique() + .HasDatabaseName("ix_dim_user_creation_data_process_id"); + + b.HasIndex("TechnicalUserId") + .IsUnique() + .HasDatabaseName("ix_dim_user_creation_data_technical_user_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.ExternalTechnicalUser", 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_external_technical_users"); + + b.ToTable("external_technical_users", "portal"); + }); + + 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") + .IsUnique() + .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") + .IsUnique() + .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.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") + .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.TechnicalUser", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_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("TechnicalUserKindId") + .HasColumnType("integer") + .HasColumnName("technical_user_kind_id"); + + b.Property("TechnicalUserTypeId") + .HasColumnType("integer") + .HasColumnName("technical_user_type_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_technical_users"); + + b.HasIndex("ClientClientId") + .HasDatabaseName("ix_technical_users_client_client_id") + .HasFilter("client_client_id is not null AND company_service_account_kind_id = 1"); + + b.HasIndex("OfferSubscriptionId") + .HasDatabaseName("ix_technical_users_offer_subscription_id"); + + b.HasIndex("TechnicalUserKindId") + .HasDatabaseName("ix_technical_users_technical_user_kind_id"); + + b.HasIndex("TechnicalUserTypeId") + .HasDatabaseName("ix_technical_users_technical_user_type_id"); + + b.ToTable("technical_users", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", 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_technical_user_kinds"); + + b.ToTable("technical_user_kinds", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INTERNAL" + }, + new + { + Id = 2, + Label = "EXTERNAL" + }); + }); + + 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.TechnicalUserType", 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_technical_user_types"); + + b.ToTable("technical_user_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "MANAGED" + }, + new + { + Id = 2, + Label = "OWN" + }); + }); + + 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("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + + b.Property("Owners") + .HasColumnType("uuid") + .HasColumnName("owners"); + + b.Property("Provider") + .HasColumnType("uuid") + .HasColumnName("provider"); + + b.HasKey("TechnicalUserId"); + + 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.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.TechnicalUser", "TechnicalUser") + .WithMany("AppInstances") + .HasForeignKey("TechnicalUserId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_technical_users_tech"); + + b.Navigation("AppInstance"); + + b.Navigation("TechnicalUser"); + }); + + 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.PortalBackend.PortalEntities.Entities.Process", "SdCreationProcess") + .WithOne("SdCreationCompany") + .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.PortalBackend.PortalEntities.Entities.Process", "ChecklistProcess") + .WithOne("CompanyApplication") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyApplication", "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") + .IsRequired() + .HasConstraintName("fk_company_invitations_company_applications_application_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("CompanyInvitation") + .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.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.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("CompanyUserAssignedProcess") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUserAssignedProcess", "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.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.PortalBackend.PortalEntities.Entities.Process", "SdCreationProcess") + .WithOne("SdCreationConnector") + .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.TechnicalUser", "TechnicalUser") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "TechnicalUserId") + .HasConstraintName("fk_connectors_technical_users_technical_user_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("Host"); + + b.Navigation("LastEditor"); + + b.Navigation("Location"); + + b.Navigation("Provider"); + + b.Navigation("SdCreationProcess"); + + b.Navigation("SelfDescriptionDocument"); + + b.Navigation("Status"); + + b.Navigation("TechnicalUser"); + + 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.DimUserCreationData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("DimUserCreationData") + .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.TechnicalUser", "TechnicalUser") + .WithOne("DimUserCreationData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "TechnicalUserId") + .IsRequired() + .HasConstraintName("fk_dim_user_creation_data_technical_users_technical_user_id"); + + b.Navigation("Process"); + + b.Navigation("TechnicalUser"); + }); + + 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.ExternalTechnicalUser", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") + .WithOne("ExternalTechnicalUser") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ExternalTechnicalUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_external_technical_users_technical_users_id"); + + b.Navigation("TechnicalUser"); + }); + + 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.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("IdentityProviderAssignedProcess") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProviderAssignedProcess", "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.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("MailingInformation") + .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.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("NetworkRegistration") + .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.PortalBackend.PortalEntities.Entities.Process", "Process") + .WithOne("OfferSubscription") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "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.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") + .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.TechnicalUser", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Identity") + .WithOne("TechnicalUser") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_identities_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("Technicalusers") + .HasForeignKey("OfferSubscriptionId") + .HasConstraintName("fk_technical_users_offer_subscriptions_offer_subscription_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", "TechnicalUserKind") + .WithMany("TechnicalUsers") + .HasForeignKey("TechnicalUserKindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_technical_user_kinds_technical_user_kind_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserType", "TechnicalUserType") + .WithMany("TechnicalUsers") + .HasForeignKey("TechnicalUserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_technical_user_types_technical_user_type_id"); + + b.Navigation("Identity"); + + b.Navigation("OfferSubscription"); + + b.Navigation("TechnicalUserKind"); + + b.Navigation("TechnicalUserType"); + }); + + 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.TechnicalUser", "TechnicalUser") + .WithOne("CompaniesLinkedServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "TechnicalUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_linked_service_accounts_technical_users_technical_u"); + + b.Navigation("TechnicalUser"); + }); + + 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.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("CompanyUser"); + + b.Navigation("CreatedNotifications"); + + b.Navigation("IdentityAssignedRoles"); + + b.Navigation("TechnicalUser"); + }); + + 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("ConnectorAssignedOfferSubscriptions"); + + b.Navigation("ConsentAssignedOfferSubscriptions"); + + b.Navigation("OfferSubscriptionProcessData"); + + b.Navigation("Technicalusers"); + }); + + 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.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"); + }); + + 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.TechnicalUser", b => + { + b.Navigation("AppInstances"); + + b.Navigation("CompaniesLinkedServiceAccount"); + + b.Navigation("Connector"); + + b.Navigation("DimUserCreationData"); + + b.Navigation("ExternalTechnicalUser"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", b => + { + b.Navigation("TechnicalUsers"); + }); + + 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.TechnicalUserType", b => + { + b.Navigation("TechnicalUsers"); + }); + + 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/20241007103241_adjust_table_with_properties_navigationproperties_latest.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.cs new file mode 100644 index 0000000000..e1eba1e4a3 --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20241007103241_adjust_table_with_properties_navigationproperties_latest.cs @@ -0,0 +1,599 @@ +/******************************************************************************** + * 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 + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + /// + public partial class adjust_table_with_properties_navigationproperties_latest : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("DROP FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONNECTOR\"() CASCADE;"); + + migrationBuilder.Sql("DROP FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONNECTOR\"() CASCADE;"); + + migrationBuilder.DropForeignKey( + name: "fk_app_instance_assigned_service_accounts_company_service_acco", + schema: "portal", + table: "app_instance_assigned_service_accounts"); + + migrationBuilder.DropForeignKey( + name: "fk_connectors_company_service_accounts_company_service_account", + schema: "portal", + table: "connectors"); + + migrationBuilder.DropForeignKey( + name: "fk_dim_user_creation_data_company_service_accounts_service_acc", + schema: "portal", + table: "dim_user_creation_data"); + + //external_technical_user table creation starts + + migrationBuilder.DropForeignKey( + name: "fk_dim_company_service_accounts_company_service_accounts_id", + schema: "portal", + table: "dim_company_service_accounts"); + + migrationBuilder.DropPrimaryKey( + name: "pk_dim_company_service_accounts", + table: "dim_company_service_accounts", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "dim_company_service_accounts", + schema: "portal", + newName: "external_technical_users" + ); + + migrationBuilder.AddPrimaryKey( + name: "pk_external_technical_users", + table: "external_technical_users", + column: "id"); + + //end external_technical_user table creation + + // technical_users creation starts + + migrationBuilder.DropForeignKey( + name: "fk_company_service_accounts_company_service_account_kindes_com", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.DropForeignKey( + name: "fk_company_service_accounts_company_service_account_types_comp", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.DropForeignKey( + name: "fk_company_service_accounts_identities_id", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.DropForeignKey( + name: "fk_company_service_accounts_offer_subscriptions_offer_subscrip", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.DropPrimaryKey( + name: "pk_company_service_accounts", + table: "company_service_accounts", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "company_service_accounts", + schema: "portal", + newName: "technical_users"); + + migrationBuilder.RenameColumn( + name: "company_service_account_kind_id", + table: "technical_users", + newName: "technical_user_kind_id"); + + migrationBuilder.RenameColumn( + name: "company_service_account_type_id", + table: "technical_users", + newName: "technical_user_type_id"); + + migrationBuilder.RenameIndex( + name: "ix_company_service_accounts_client_client_id", + newName: "ix_technical_users_client_client_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.RenameIndex( + name: "ix_company_service_accounts_company_service_account_kind_id", + newName: "ix_technical_users_company_service_account_kind_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.RenameIndex( + name: "ix_company_service_accounts_company_service_account_type_id", + newName: "ix_technical_users_company_service_account_type_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.RenameIndex( + name: "ix_company_service_accounts_offer_subscription_id", + newName: "ix_technical_users_offer_subscription_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.AddPrimaryKey( + name: "pk_technical_users", + table: "technical_users", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_technical_users_identities_id", + table: "technical_users", + column: "id", + schema: "portal", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_technical_users_offer_subscriptions_offer_subscription_id", + table: "technical_users", + column: "offer_subscription_id", + schema: "portal", + principalSchema: "portal", + principalTable: "offer_subscriptions", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_external_technical_users_external_technical_users_id", + table: "external_technical_users", + column: "id", + schema: "portal", + principalSchema: "portal", + principalTable: "technical_users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //end technical_users creation + + //rename company_service_account_kindes to technical_user_kinds starts + + migrationBuilder.DropPrimaryKey( + name: "pk_company_service_account_kindes", + table: "company_service_account_kindes", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "company_service_account_kindes", + schema: "portal", + newName: "technical_user_kinds"); + + migrationBuilder.AddPrimaryKey( + name: "pk_technical_user_kinds", + table: "technical_user_kinds", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_technical_users_technical_user_kinds_technical_user_kind_id", + table: "technical_users", + column: "technical_user_kind_id", + schema: "portal", + principalSchema: "portal", + principalTable: "technical_user_kinds", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //end rename company_service_account_kindes to technical_user_kinds + + //rename company_service_account_types to technical_user_types starts + + migrationBuilder.DropPrimaryKey( + name: "pk_company_service_account_types", + table: "company_service_account_types", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "company_service_account_types", + schema: "portal", + newName: "technical_user_types"); + + migrationBuilder.AddPrimaryKey( + name: "pk_technical_user_types", + table: "technical_user_types", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_technical_users_technical_user_types_technical_user_type_id", + table: "technical_users", + column: "technical_user_type_id", + schema: "portal", + principalSchema: "portal", + principalTable: "technical_user_types", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //end rename company_service_account_types to technical_user_types starts + + migrationBuilder.RenameColumn( + name: "service_account_id", + schema: "portal", + table: "dim_user_creation_data", + newName: "technical_user_id"); + + migrationBuilder.RenameIndex( + name: "ix_dim_user_creation_data_service_account_id", + schema: "portal", + table: "dim_user_creation_data", + newName: "ix_dim_user_creation_data_technical_user_id"); + + migrationBuilder.RenameColumn( + name: "company_service_account_id", + schema: "portal", + table: "connectors", + newName: "technical_user_id"); + + migrationBuilder.RenameIndex( + name: "ix_connectors_company_service_account_id", + schema: "portal", + table: "connectors", + newName: "ix_connectors_technical_user_id"); + + migrationBuilder.RenameColumn( + name: "company_service_account_id", + schema: "portal", + table: "audit_connector20240814", + newName: "technical_user_id"); + + migrationBuilder.RenameColumn( + name: "company_service_account_id", + schema: "portal", + table: "app_instance_assigned_service_accounts", + newName: "technical_user_id"); + + migrationBuilder.RenameIndex( + name: "ix_app_instance_assigned_service_accounts_company_service_acco", + schema: "portal", + table: "app_instance_assigned_service_accounts", + newName: "ix_app_instance_assigned_service_accounts_technical_user_id"); + + migrationBuilder.AddForeignKey( + name: "fk_app_instance_assigned_service_accounts_technical_users_tech", + schema: "portal", + table: "app_instance_assigned_service_accounts", + column: "technical_user_id", + principalSchema: "portal", + principalTable: "technical_users", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_connectors_technical_users_technical_user_id", + schema: "portal", + table: "connectors", + column: "technical_user_id", + principalSchema: "portal", + principalTable: "technical_users", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_dim_user_creation_data_technical_users_technical_user_id", + schema: "portal", + table: "dim_user_creation_data", + column: "technical_user_id", + principalSchema: "portal", + principalTable: "technical_users", + principalColumn: "id"); + + migrationBuilder.Sql("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\", \"technical_user_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.\"technical_user_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\"();"); + + migrationBuilder.Sql("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\", \"technical_user_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.\"technical_user_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\"();"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("DROP FUNCTION \"portal\".\"LC_TRIGGER_AFTER_INSERT_CONNECTOR\"() CASCADE;"); + + migrationBuilder.Sql("DROP FUNCTION \"portal\".\"LC_TRIGGER_AFTER_UPDATE_CONNECTOR\"() CASCADE;"); + + migrationBuilder.DropForeignKey( + name: "fk_app_instance_assigned_service_accounts_technical_users_tech", + schema: "portal", + table: "app_instance_assigned_service_accounts"); + + migrationBuilder.DropForeignKey( + name: "fk_connectors_technical_users_technical_user_id", + schema: "portal", + table: "connectors"); + + migrationBuilder.DropForeignKey( + name: "fk_dim_user_creation_data_technical_users_technical_user_id", + schema: "portal", + table: "dim_user_creation_data"); + + //remane external_technical_user to dim_company_service_accounts table creation starts + + migrationBuilder.DropForeignKey( + name: "fk_external_technical_users_external_technical_users_id", + schema: "portal", + table: "external_technical_users"); + + migrationBuilder.DropPrimaryKey( + name: "pk_external_technical_users", + table: "external_technical_users", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "external_technical_users", + schema: "portal", + newName: "dim_company_service_accounts" + ); + + migrationBuilder.AddPrimaryKey( + name: "pk_dim_company_service_accounts", + table: "dim_company_service_accounts", + column: "id"); + + //end remane external_technical_user to dim_company_service_accounts table creation + + // rename technical_users to company_service_accounts creation starts + + migrationBuilder.DropForeignKey( + name: "fk_technical_users_technical_user_kinds_technical_user_kind_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.DropForeignKey( + name: "fk_technical_users_technical_user_types_technical_user_type_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.DropForeignKey( + name: "fk_technical_users_identities_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.DropForeignKey( + name: "fk_technical_users_offer_subscriptions_offer_subscription_id", + schema: "portal", + table: "technical_users"); + + migrationBuilder.DropPrimaryKey( + name: "pk_technical_users", + table: "technical_users", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "technical_users", + schema: "portal", + newName: "company_service_accounts"); + + migrationBuilder.RenameColumn( + name: "technical_user_kind_id", + table: "company_service_accounts", + newName: "company_service_account_kind_id"); + + migrationBuilder.RenameColumn( + name: "technical_user_type_id", + table: "company_service_accounts", + newName: "company_service_account_type_id"); + + migrationBuilder.RenameIndex( + name: "ix_technical_users_client_client_id", + newName: "ix_company_service_accounts_client_client_id", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.RenameIndex( + name: "ix_technical_users_company_service_account_kind_id", + newName: "ix_company_service_accounts_company_service_account_kind_id", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.RenameIndex( + name: "ix_technical_users_company_service_account_type_id", + newName: "ix_company_service_accounts_company_service_account_type_id", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.RenameIndex( + name: "ix_technical_users_offer_subscription_id", + newName: "ix_company_service_accounts_offer_subscription_id", + schema: "portal", + table: "company_service_accounts"); + + migrationBuilder.AddPrimaryKey( + name: "pk_company_service_accounts", + table: "company_service_accounts", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_company_service_accounts_identities_id", + table: "company_service_accounts", + column: "id", + schema: "portal", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_company_service_accounts_offer_subscriptions_offer_subscrip", + table: "company_service_accounts", + column: "offer_subscription_id", + schema: "portal", + principalSchema: "portal", + principalTable: "offer_subscriptions", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_dim_company_service_accounts_company_service_accounts_id", + table: "dim_company_service_accounts", + column: "id", + schema: "portal", + principalSchema: "portal", + principalTable: "company_service_accounts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //end rename technical_users to company_service_accounts creation + + //rename technical_user_kinds to company_service_account_kindes starts + + migrationBuilder.DropPrimaryKey( + name: "pk_technical_user_kinds", + table: "technical_user_kinds", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "technical_user_kinds", + schema: "portal", + newName: "company_service_account_kindes"); + + migrationBuilder.AddPrimaryKey( + name: "pk_company_service_account_kindes", + table: "company_service_account_kindes", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_company_service_accounts_company_service_account_kindes_com", + table: "company_service_accounts", + column: "company_service_account_kind_id", + schema: "portal", + principalSchema: "portal", + principalTable: "company_service_account_kindes", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //end rename technical_user_kinds to company_service_account_kindes + + //rename technical_user_types to company_service_account_types starts + + migrationBuilder.DropPrimaryKey( + name: "pk_technical_user_types", + table: "technical_user_types", + schema: "portal"); + + migrationBuilder.RenameTable( + name: "technical_user_types", + schema: "portal", + newName: "company_service_account_types"); + + migrationBuilder.AddPrimaryKey( + name: "pk_company_service_account_types", + table: "company_service_account_types", + column: "id" + ); + + migrationBuilder.AddForeignKey( + name: "fk_company_service_accounts_company_service_account_types_comp", + table: "technical_users", + column: "company_service_account_type_id", + schema: "portal", + principalSchema: "portal", + principalTable: "company_service_account_types", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + //rename technical_user_types to company_service_account_types starts + + migrationBuilder.RenameColumn( + name: "technical_user_id", + schema: "portal", + table: "dim_user_creation_data", + newName: "service_account_id"); + + migrationBuilder.RenameIndex( + name: "ix_dim_user_creation_data_technical_user_id", + schema: "portal", + table: "dim_user_creation_data", + newName: "ix_dim_user_creation_data_service_account_id"); + + migrationBuilder.RenameColumn( + name: "technical_user_id", + schema: "portal", + table: "connectors", + newName: "company_service_account_id"); + + migrationBuilder.RenameIndex( + name: "ix_connectors_technical_user_id", + schema: "portal", + table: "connectors", + newName: "ix_connectors_company_service_account_id"); + + migrationBuilder.RenameColumn( + name: "technical_user_id", + schema: "portal", + table: "audit_connector20240814", + newName: "company_service_account_id"); + + migrationBuilder.RenameColumn( + name: "technical_user_id", + schema: "portal", + table: "app_instance_assigned_service_accounts", + newName: "company_service_account_id"); + + migrationBuilder.RenameIndex( + name: "ix_app_instance_assigned_service_accounts_technical_user_id", + schema: "portal", + table: "app_instance_assigned_service_accounts", + newName: "ix_app_instance_assigned_service_accounts_company_service_acco"); + + migrationBuilder.AddForeignKey( + name: "fk_app_instance_assigned_service_accounts_company_service_acco", + schema: "portal", + table: "app_instance_assigned_service_accounts", + column: "company_service_account_id", + principalSchema: "portal", + principalTable: "company_service_accounts", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_connectors_company_service_accounts_company_service_account", + schema: "portal", + table: "connectors", + column: "company_service_account_id", + principalSchema: "portal", + principalTable: "company_service_accounts", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_dim_user_creation_data_company_service_accounts_service_acc", + schema: "portal", + table: "dim_user_creation_data", + column: "service_account_id", + principalSchema: "portal", + principalTable: "company_service_accounts", + principalColumn: "id"); + + migrationBuilder.Sql("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\"();"); + + migrationBuilder.Sql("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\"();"); + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 618e062cb6..adb65172c8 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -36,7 +36,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder .HasDefaultSchema("portal") .UseCollation("en_US.utf8") - .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -979,10 +979,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer") .HasColumnName("audit_v1operation_id"); - b.Property("CompanyServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("company_service_account_id"); - b.Property("ConnectorUrl") .HasColumnType("text") .HasColumnName("connector_url"); @@ -1031,6 +1027,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer") .HasColumnName("status_id"); + b.Property("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + b.Property("TypeId") .HasColumnType("integer") .HasColumnName("type_id"); @@ -2556,15 +2556,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid") .HasColumnName("app_instance_id"); - b.Property("CompanyServiceAccountId") + b.Property("TechnicalUserId") .HasColumnType("uuid") - .HasColumnName("company_service_account_id"); + .HasColumnName("technical_user_id"); - b.HasKey("AppInstanceId", "CompanyServiceAccountId") + b.HasKey("AppInstanceId", "TechnicalUserId") .HasName("pk_app_instance_assigned_service_accounts"); - b.HasIndex("CompanyServiceAccountId") - .HasDatabaseName("ix_app_instance_assigned_service_accounts_company_service_acco"); + b.HasIndex("TechnicalUserId") + .HasDatabaseName("ix_app_instance_assigned_service_accounts_technical_user_id"); b.ToTable("app_instance_assigned_service_accounts", "portal"); }); @@ -3762,124 +3762,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -4126,10 +4008,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid") .HasColumnName("id"); - b.Property("CompanyServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("company_service_account_id"); - b.Property("ConnectorUrl") .IsRequired() .HasMaxLength(255) @@ -4180,6 +4058,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer") .HasColumnName("status_id"); + b.Property("TechnicalUserId") + .HasColumnType("uuid") + .HasColumnName("technical_user_id"); + b.Property("TypeId") .HasColumnType("integer") .HasColumnName("type_id"); @@ -4187,10 +4069,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -4214,6 +4092,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("StatusId") .HasDatabaseName("ix_connectors_status_id"); + b.HasIndex("TechnicalUserId") + .IsUnique() + .HasDatabaseName("ix_connectors_technical_user_id"); + b.HasIndex("TypeId") .HasDatabaseName("ix_connectors_type_id"); @@ -4225,8 +4107,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); 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\"();"); + .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\", \"technical_user_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.\"technical_user_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\", \"technical_user_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.\"technical_user_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 => @@ -4536,36 +4418,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -4577,9 +4429,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid") .HasColumnName("process_id"); - b.Property("ServiceAccountId") + b.Property("TechnicalUserId") .HasColumnType("uuid") - .HasColumnName("service_account_id"); + .HasColumnName("technical_user_id"); b.HasKey("Id") .HasName("pk_dim_user_creation_data"); @@ -4588,9 +4440,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_dim_user_creation_data_process_id"); - b.HasIndex("ServiceAccountId") + b.HasIndex("TechnicalUserId") .IsUnique() - .HasDatabaseName("ix_dim_user_creation_data_service_account_id"); + .HasDatabaseName("ix_dim_user_creation_data_technical_user_id"); b.ToTable("dim_user_creation_data", "portal"); }); @@ -4803,6 +4655,36 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ExternalTechnicalUser", 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_external_technical_users"); + + b.ToTable("external_technical_users", "portal"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => { b.Property("Id") @@ -7113,6 +6995,94 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_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("TechnicalUserKindId") + .HasColumnType("integer") + .HasColumnName("technical_user_kind_id"); + + b.Property("TechnicalUserTypeId") + .HasColumnType("integer") + .HasColumnName("technical_user_type_id"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("uuid") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_technical_users"); + + b.HasIndex("ClientClientId") + .HasDatabaseName("ix_technical_users_client_client_id") + .HasFilter("client_client_id is not null AND company_service_account_kind_id = 1"); + + b.HasIndex("OfferSubscriptionId") + .HasDatabaseName("ix_technical_users_offer_subscription_id"); + + b.HasIndex("TechnicalUserKindId") + .HasDatabaseName("ix_technical_users_technical_user_kind_id"); + + b.HasIndex("TechnicalUserTypeId") + .HasDatabaseName("ix_technical_users_technical_user_type_id"); + + b.ToTable("technical_users", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", 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_technical_user_kinds"); + + b.ToTable("technical_user_kinds", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "INTERNAL" + }, + new + { + Id = 2, + Label = "EXTERNAL" + }); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => { b.Property("Id") @@ -7152,6 +7122,36 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("technical_user_profile_assigned_user_roles", "portal"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserType", 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_technical_user_types"); + + b.ToTable("technical_user_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "MANAGED" + }, + new + { + Id = 2, + Label = "OWN" + }); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => { b.Property("Id") @@ -7411,9 +7411,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => { - b.Property("ServiceAccountId") + b.Property("TechnicalUserId") .HasColumnType("uuid") - .HasColumnName("service_account_id"); + .HasColumnName("technical_user_id"); b.Property("Owners") .HasColumnType("uuid") @@ -7423,7 +7423,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid") .HasColumnName("provider"); - b.HasKey("ServiceAccountId"); + b.HasKey("TechnicalUserId"); b.ToTable((string)null); @@ -7716,15 +7716,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_app_instance_assigned_service_accounts_app_instances_app_in"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") .WithMany("AppInstances") - .HasForeignKey("CompanyServiceAccountId") + .HasForeignKey("TechnicalUserId") .IsRequired() - .HasConstraintName("fk_app_instance_assigned_service_accounts_company_service_acco"); + .HasConstraintName("fk_app_instance_assigned_service_accounts_technical_users_tech"); b.Navigation("AppInstance"); - b.Navigation("CompanyServiceAccount"); + b.Navigation("TechnicalUser"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => @@ -8141,43 +8141,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -8284,11 +8247,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -8329,14 +8287,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_connectors_connector_statuses_status_id"); + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "TechnicalUserId") + .HasConstraintName("fk_connectors_technical_users_technical_user_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"); @@ -8351,6 +8312,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Status"); + b.Navigation("TechnicalUser"); + b.Navigation("Type"); }); @@ -8505,18 +8468,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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.PortalBackend.PortalEntities.Entities.Process", "Process") @@ -8525,15 +8476,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_dim_user_creation_data_processes_process_id"); - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "ServiceAccount") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") .WithOne("DimUserCreationData") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "ServiceAccountId") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DimUserCreationData", "TechnicalUserId") .IsRequired() - .HasConstraintName("fk_dim_user_creation_data_company_service_accounts_service_acc"); + .HasConstraintName("fk_dim_user_creation_data_technical_users_technical_user_id"); b.Navigation("Process"); - b.Navigation("ServiceAccount"); + b.Navigation("TechnicalUser"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => @@ -8573,6 +8524,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("MediaType"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ExternalTechnicalUser", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") + .WithOne("ExternalTechnicalUser") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ExternalTechnicalUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_external_technical_users_technical_users_id"); + + b.Navigation("TechnicalUser"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => { b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") @@ -9130,6 +9093,43 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("ServiceType"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Identity") + .WithOne("TechnicalUser") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_identities_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("Technicalusers") + .HasForeignKey("OfferSubscriptionId") + .HasConstraintName("fk_technical_users_offer_subscriptions_offer_subscription_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", "TechnicalUserKind") + .WithMany("TechnicalUsers") + .HasForeignKey("TechnicalUserKindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_technical_user_kinds_technical_user_kind_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserType", "TechnicalUserType") + .WithMany("TechnicalUsers") + .HasForeignKey("TechnicalUserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_technical_users_technical_user_types_technical_user_type_id"); + + b.Navigation("Identity"); + + b.Navigation("OfferSubscription"); + + b.Navigation("TechnicalUserKind"); + + b.Navigation("TechnicalUserType"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => { b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") @@ -9261,14 +9261,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", "TechnicalUser") .WithOne("CompaniesLinkedServiceAccount") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "TechnicalUserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() - .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); + .HasConstraintName("fk_company_linked_service_accounts_technical_users_technical_u"); - b.Navigation("CompanyServiceAccount"); + b.Navigation("TechnicalUser"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => @@ -9418,29 +9418,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -9535,13 +9512,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => { - b.Navigation("CompanyServiceAccount"); - b.Navigation("CompanyUser"); b.Navigation("CreatedNotifications"); b.Navigation("IdentityAssignedRoles"); + + b.Navigation("TechnicalUser"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => @@ -9660,13 +9637,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("AppSubscriptionDetail"); - b.Navigation("CompanyServiceAccounts"); - b.Navigation("ConnectorAssignedOfferSubscriptions"); b.Navigation("ConsentAssignedOfferSubscriptions"); b.Navigation("OfferSubscriptionProcessData"); + + b.Navigation("Technicalusers"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => @@ -9731,11 +9708,34 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("ServiceDetails"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUser", b => + { + b.Navigation("AppInstances"); + + b.Navigation("CompaniesLinkedServiceAccount"); + + b.Navigation("Connector"); + + b.Navigation("DimUserCreationData"); + + b.Navigation("ExternalTechnicalUser"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserKind", b => + { + b.Navigation("TechnicalUsers"); + }); + 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.TechnicalUserType", b => + { + b.Navigation("TechnicalUsers"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => { b.Navigation("CompanyIdentifiers"); diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs index fd7ce37927..b90c97ddec 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchInsertSeeder.cs @@ -103,7 +103,7 @@ public async Task ExecuteAsync(CancellationToken cancellationToken) await SeedTable("company_identifiers", x => new { x.CompanyId, x.UniqueIdentifierId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTable("country_assigned_identifiers", x => new { x.CountryAlpha2Code, x.UniqueIdentifierId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTable("offer_assigned_privacy_policies", x => new { x.OfferId, x.PrivacyPolicyId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - await SeedTable("app_instance_assigned_company_service_accounts", x => new { x.AppInstanceId, x.CompanyServiceAccountId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await SeedTable("app_instance_assigned_company_service_accounts", x => new { x.AppInstanceId, x.TechnicalUserId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTable("technical_user_profile_assigned_user_roles", x => new { x.TechnicalUserProfileId, x.UserRoleId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTable("use_case_descriptions", x => new { x.UseCaseId, x.LanguageShortName }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTable("company_user_assigned_identity_providers", e => new { e.CompanyUserId, e.IdentityProviderId }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); @@ -125,7 +125,7 @@ private async Task SeedBaseEntity(CancellationToken cancellationToken) await SeedTableForBaseEntity("company_applications", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("identity_providers", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("user_role_collections", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - await SeedTableForBaseEntity("company_service_accounts", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await SeedTableForBaseEntity("technical_users", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("user_roles", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("connectors", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); await SeedTableForBaseEntity("consents", cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchUpdateSeeder.cs b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchUpdateSeeder.cs index 5c9d6d16db..e8c9aad9e7 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/BatchUpdateSeeder.cs +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/BatchUpdateSeeder.cs @@ -132,7 +132,7 @@ await SeedTable("company_identifiers", dbEntry.Value = entry.Value; }, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); - await SeedTable("company_service_accounts", + await SeedTable("technical_users", x => x.Id, x => x.dataEntity.Description != x.dbEntity.Description || x.dataEntity.Name != x.dbEntity.Name || x.dataEntity.ClientClientId != x.dbEntity.ClientClientId, (dbEntry, entry) => diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/technical_users.json similarity index 89% rename from src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json rename to src/portalbackend/PortalBackend.Migrations/Seeder/Data/technical_users.json index 5a00b5fa68..7625fb0dcf 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/technical_users.json @@ -3,8 +3,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201007", "name": "sa-cl5-custodian-2", "description": "Technical User for the Connection between the Portal and the Managed Identity Wallet\nAssigned Permissions: delete_wallet, add_wallets, delete_wallets, update_wallets, add_wallet, view_wallet, update_wallet, view_wallets\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and Managed Identity Wallet. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "50fa6455-a775-4683-b407-57a33a9b9f3b", "client_client_id": "sa-cl5-custodian-2" }, @@ -12,8 +12,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201023", "name": "sa-cl3-cx-1", "description": "Technical User for the Connection between the Portal and the Semantic Hub\nAssigned Permissions: Semantic Model Management, Identity Wallet Management, Dataspace Discovery\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and Semantic Hub. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "7beaee76-d447-4531-9433-fd9ce19d1460", "client_client_id": "sa-cl3-cx-1" }, @@ -21,8 +21,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201024", "name": "sa-cl7-cx-5", "description": "Technical User for the Connection between the Portal and the BPDM\nAssigned Permissions: BPDM Pool Admin, BPDM Sharing Admin\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and BPDM. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "183aae87-c9cf-4d70-934b-629aa6974c54", "client_client_id": "sa-cl7-cx-5" }, @@ -30,8 +30,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201026", "name": "sa-cl2-01", "description": "Technical User for the Connection between the Portal and the Clearinghouse\nAssigned Permissions: update_application_checklist_value\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and Clearinghouse. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "6bf6f4e5-562c-4382-945f-e5fef59423e2", "client_client_id": "sa-cl2-01" }, @@ -39,8 +39,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201027", "name": "sa-cl2-02", "description": "Technical User for the Connection between the Portal and the SD Factory\nAssigned Permissions: submit_connector_sd, update_application_checklist_value\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and SD Factory. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "2d19b59b-4970-4cc0-a561-a9dac9d49045", "client_client_id": "sa-cl2-02" }, @@ -48,8 +48,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201028", "name": "sa-cl8-cx-1", "description": "Technical User for the Connection between the Portal and the SD Factory\nAssigned Permissions: add_self_descriptions\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and SD Factory. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "c2bdc736-ca35-43c4-8e18-27e7425df9f0", "client_client_id": "sa-cl8-cx-1" }, @@ -57,8 +57,8 @@ "id": "d21d2e8a-fe35-483c-b2b8-4100ed7f0953", "name": "system-internal", "description": "Technical User for Portal ProcessWorker", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "c5709899-0415-4385-be80-76d2bfd31724", "client_client_id": "system-internal" }, @@ -66,8 +66,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201029", "name": "sa-cl1-reg-2", "description": "Technical User for the Connection between the Portal and Keycloak\nAssigned Permissions: manage-users, manage-identity-providers, manage-clients\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and Keycloak. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "cdf11dff-530a-4fd4-97b9-84e4d60ac21e", "client_client_id": "sa-cl1-reg-2" }, @@ -75,8 +75,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201030", "name": "sa-cl2-03", "description": "Technical User for the Connection between the Portal and the Vendor Autosetup\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and the Vendor Autosetup. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "cad1382b-0dd4-4ac7-8183-1c08386c84e8", "client_client_id": "sa-cl2-03" }, @@ -84,8 +84,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201031", "name": "sa-cl21-01", "description": "Technical User for the Connection between the Discovery Finder and the Portal\nAssigned Permissions: view_discovery_endpoint, delete_discovery_endpoint, add_discovery_endpoint\nNote: This user is a seeded user and is specifically designated for the technical integration between the Discovery Finder and the Portal. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "b09392dd-8b0f-4a32-bb0b-d00a4091b890", "client_client_id": "sa-cl21-01" }, @@ -93,8 +93,8 @@ "id": "7e85a0b8-0001-ab67-10d1-0ef508201032", "name": "sa-cl22-01", "description": "Technical User for the Connection between the BPN Discovery and the Portal\nAssigned Permissions: add_bpn_discovery, delete_bpn_discovery, view_bpn_discovery\nNote: This user is a seeded user and is specifically designated for the technical integration between the BPN Discovery and the Portal. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "f1806543-d0ca-41cb-b029-883cdfb11a8e", "client_client_id": "sa-cl22-01" }, @@ -102,8 +102,8 @@ "id": "33480038-9acf-40e2-9127-c9c7a9cbed99", "name": "sa-cl24-01", "description": "Technical User for the Connection between the SSI Credential Issuer and the Portal\nAssigned Permissions: update_application_membership_credential, send_mail, update_application_bpn_credential, create_notifications\nNote: This user is a seeded user and is specifically designated for the technical integration between the SSI Credential Issuer and the Portal. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "8ac37496-cca9-41ba-9684-cf7348f880d5", "client_client_id": "sa-cl24-01" }, @@ -111,8 +111,8 @@ "id": "f3498fe6-e0e5-413b-a725-39bf5c7c1959", "name": "sa-cl2-04", "description": "Technical User for the Connection between the Portal and the SSI Credential Issuer\nAssigned Permissions: decision_ssicredential, view_use_case_participation, revoke_credential, revoke_credentials_issuer, request_ssicredential, view_certificates \nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and the SSI Credential Issuer. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "beb01d13-04e2-4a2b-a909-8b4166b3dcf7", "client_client_id": "sa-cl2-04" }, @@ -120,8 +120,8 @@ "id": "ab7f01ea-cbb9-4d58-9efa-ea992395f997", "name": "sa-cl2-05", "description": "Technical User for the Connection between the Portal and the Dim Layer\nAssigned Permissions: store_didDocument, technical_roles_management\nNote: This user is a seeded user and is specifically designated for the technical integration between the Portal and the Dim Layer. As a result, dynamic user self-services such as password reset, role change, deletion, etc. are not applicable to this user. The user is exclusively available within the technical user management of the portal to ensure transparency and streamline the connection process.", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "client_id": "beb01d13-04e2-4a2b-a909-8b4166b3dcf7", "client_client_id": "sa-cl2-05" } diff --git a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditConnector20240814.cs b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditConnector20240814.cs index a6729cbd2e..518eedcad1 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditConnector20240814.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/AuditEntities/AuditConnector20240814.cs @@ -51,7 +51,7 @@ public class AuditConnector20240814 : IAuditEntityV1 public DateTimeOffset? DateLastChanged { get; private set; } - public Guid? CompanyServiceAccountId { get; set; } + public Guid? TechnicalUserId { get; set; } public Guid? SdCreationProcessId { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceAssignedCompanyServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceAssignedCompanyServiceAccount.cs index a8b516ae77..f10502589e 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceAssignedCompanyServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppInstanceAssignedCompanyServiceAccount.cs @@ -26,18 +26,18 @@ private AppInstanceAssignedCompanyServiceAccount() { } - public AppInstanceAssignedCompanyServiceAccount(Guid appInstanceId, Guid companyServiceAccountId) + public AppInstanceAssignedCompanyServiceAccount(Guid appInstanceId, Guid technicalUserId) : this() { AppInstanceId = appInstanceId; - CompanyServiceAccountId = companyServiceAccountId; + TechnicalUserId = technicalUserId; } public Guid AppInstanceId { get; private set; } - public Guid CompanyServiceAccountId { get; private set; } + public Guid TechnicalUserId { get; private set; } public virtual AppInstance? AppInstance { get; set; } - public virtual CompanyServiceAccount? CompanyServiceAccount { get; set; } + public virtual TechnicalUser? TechnicalUser { get; set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs index 4422ef2e93..d20d42bd47 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccount.cs @@ -25,15 +25,15 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -public class CompanyServiceAccount : IBaseEntity, IVersionedEntity +public class TechnicalUser : IBaseEntity, IVersionedEntity { - public CompanyServiceAccount(Guid id, Guid version, string name, string description, CompanyServiceAccountTypeId companyServiceAccountTypeId, CompanyServiceAccountKindId companyServiceAccountKindId) + public TechnicalUser(Guid id, Guid version, string name, string description, TechnicalUserTypeId technicalUserTypeId, TechnicalUserKindId technicalUserKindId) { Id = id; Name = name; Description = description; - CompanyServiceAccountTypeId = companyServiceAccountTypeId; - CompanyServiceAccountKindId = companyServiceAccountKindId; + TechnicalUserTypeId = technicalUserTypeId; + TechnicalUserKindId = technicalUserKindId; Version = version; AppInstances = new HashSet(); } @@ -49,8 +49,8 @@ public CompanyServiceAccount(Guid id, Guid version, string name, string descript public string Description { get; set; } - public CompanyServiceAccountTypeId CompanyServiceAccountTypeId { get; set; } - public CompanyServiceAccountKindId CompanyServiceAccountKindId { get; set; } + public TechnicalUserTypeId TechnicalUserTypeId { get; set; } + public TechnicalUserKindId TechnicalUserKindId { get; set; } public Guid? OfferSubscriptionId { get; set; } [ConcurrencyCheck] @@ -58,12 +58,12 @@ public CompanyServiceAccount(Guid id, Guid version, string name, string descript // Navigation properties public virtual Identity? Identity { get; set; } - public virtual CompanyServiceAccountType? CompanyServiceAccountType { get; set; } - public virtual CompanyServiceAccountKind? CompanyServiceAccountKind { get; set; } + public virtual TechnicalUserType? TechnicalUserType { get; set; } + public virtual TechnicalUserKind? TechnicalUserKind { get; set; } public virtual OfferSubscription? OfferSubscription { get; set; } public virtual Connector? Connector { get; set; } public virtual CompaniesLinkedServiceAccount? CompaniesLinkedServiceAccount { get; private set; } - public virtual DimCompanyServiceAccount? DimCompanyServiceAccount { get; private set; } + public virtual ExternalTechnicalUser? ExternalTechnicalUser { get; private set; } public virtual DimUserCreationData? DimUserCreationData { get; set; } public virtual ICollection AppInstances { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountKind.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountKind.cs index 006d195964..759afe2590 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountKind.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountKind.cs @@ -22,26 +22,26 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -public class CompanyServiceAccountKind +public class TechnicalUserKind { - private CompanyServiceAccountKind() + private TechnicalUserKind() { Label = null!; - CompanyServiceAccounts = new HashSet(); + TechnicalUsers = new HashSet(); } - public CompanyServiceAccountKind(CompanyServiceAccountKindId companyServiceAccountKindId) : this() + public TechnicalUserKind(TechnicalUserKindId technicalUserKindId) : this() { - Id = companyServiceAccountKindId; - Label = companyServiceAccountKindId.ToString(); + Id = technicalUserKindId; + Label = technicalUserKindId.ToString(); } [Key] - public CompanyServiceAccountKindId Id { get; private set; } + public TechnicalUserKindId Id { get; private set; } [MaxLength(255)] public string Label { get; private set; } // Navigation properties - public virtual ICollection CompanyServiceAccounts { get; private set; } + public virtual ICollection TechnicalUsers { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountType.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountType.cs index 187baba569..105adc542e 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountType.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyServiceAccountType.cs @@ -23,26 +23,26 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -public class CompanyServiceAccountType +public class TechnicalUserType { - private CompanyServiceAccountType() + private TechnicalUserType() { Label = null!; - CompanyServiceAccounts = new HashSet(); + TechnicalUsers = new HashSet(); } - public CompanyServiceAccountType(CompanyServiceAccountTypeId companyServiceAccountTypeId) : this() + public TechnicalUserType(TechnicalUserTypeId technicalUserTypeId) : this() { - Id = companyServiceAccountTypeId; - Label = companyServiceAccountTypeId.ToString(); + Id = technicalUserTypeId; + Label = technicalUserTypeId.ToString(); } [Key] - public CompanyServiceAccountTypeId Id { get; private set; } + public TechnicalUserTypeId Id { get; private set; } [MaxLength(255)] public string Label { get; private set; } // Navigation properties - public virtual ICollection CompanyServiceAccounts { get; private set; } + public virtual ICollection TechnicalUsers { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs index a562c312e3..8a40aa1a98 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs @@ -66,7 +66,7 @@ public Connector(Guid id, string name, string locationId, string connectorUrl) [LastChangedV1] public DateTimeOffset? DateLastChanged { get; set; } - public Guid? CompanyServiceAccountId { get; set; } + public Guid? TechnicalUserId { get; set; } public Guid? SdCreationProcessId { get; set; } @@ -79,7 +79,7 @@ public Connector(Guid id, string name, string locationId, string connectorUrl) public virtual Company? Provider { get; set; } public virtual Company? Host { get; set; } public virtual Country? Location { get; set; } - public virtual CompanyServiceAccount? CompanyServiceAccount { get; set; } + public virtual TechnicalUser? TechnicalUser { get; set; } public virtual Identity? LastEditor { get; set; } public virtual Process? SdCreationProcess { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs index 7728fb01f8..320d5f581a 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimCompanyServiceAccount.cs @@ -21,7 +21,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -public class DimCompanyServiceAccount(Guid id, string authenticationServiceUrl, byte[] clientSecret, byte[]? initializationVector, int encryptionMode) +public class ExternalTechnicalUser(Guid id, string authenticationServiceUrl, byte[] clientSecret, byte[]? initializationVector, int encryptionMode) : IBaseEntity { /// @@ -34,5 +34,5 @@ public class DimCompanyServiceAccount(Guid id, string authenticationServiceUrl, public int EncryptionMode { get; set; } = encryptionMode; // Navigation properties - public virtual CompanyServiceAccount? CompanyServiceAccount { get; private set; } + public virtual TechnicalUser? TechnicalUser { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs index a63ceb5454..ec415b99c8 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/DimUserCreationData.cs @@ -19,13 +19,13 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; -public class DimUserCreationData(Guid id, Guid serviceAccountId, Guid processId) +public class DimUserCreationData(Guid id, Guid technicalUserId, Guid processId) { public Guid Id { get; private set; } = id; - public Guid ServiceAccountId { get; set; } = serviceAccountId; + public Guid TechnicalUserId { get; set; } = technicalUserId; public Guid ProcessId { get; private set; } = processId; // Navigational Properties - public CompanyServiceAccount? ServiceAccount { get; private set; } + public TechnicalUser? TechnicalUser { get; private set; } public Process? Process { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs index a8a8791500..03238a7d7b 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs @@ -64,7 +64,7 @@ public Identity(Guid id, DateTimeOffset dateCreated, Guid companyId, UserStatusI // Navigation properties public virtual CompanyUser? CompanyUser { get; set; } - public virtual CompanyServiceAccount? CompanyServiceAccount { get; set; } + public virtual TechnicalUser? TechnicalUser { get; set; } public virtual Company? Company { get; set; } public virtual IdentityUserStatus? IdentityStatus { get; set; } public virtual IdentityType? IdentityType { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs index 8c1343451e..78ac2ea176 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs @@ -37,7 +37,7 @@ public class OfferSubscription : IAuditableV1, IBaseEntity public OfferSubscription() { ConsentAssignedOfferSubscriptions = new HashSet(); - CompanyServiceAccounts = new HashSet(); + Technicalusers = new HashSet(); ConnectorAssignedOfferSubscriptions = new HashSet(); } @@ -140,5 +140,5 @@ public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptio public virtual ICollection ConnectorAssignedOfferSubscriptions { get; private set; } public virtual ICollection ConsentAssignedOfferSubscriptions { get; private set; } - public virtual ICollection CompanyServiceAccounts { get; private set; } + public virtual ICollection Technicalusers { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountKindId.cs b/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountKindId.cs index f4b05a2191..a9d09e0a5d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountKindId.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountKindId.cs @@ -19,7 +19,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -public enum CompanyServiceAccountKindId +public enum TechnicalUserKindId { INTERNAL = 1, EXTERNAL = 2 diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountTypeId.cs b/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountTypeId.cs index 0ab1722359..031114d321 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountTypeId.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Enums/CompanyServiceAccountTypeId.cs @@ -20,7 +20,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -public enum CompanyServiceAccountTypeId +public enum TechnicalUserTypeId { MANAGED = 1, OWN = 2 diff --git a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs index fa1b72435e..c7a9d6c6aa 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs @@ -119,9 +119,9 @@ public PortalDbContext(DbContextOptions options, IAuditHandler public virtual DbSet CompanyRoleAssignedRoleCollections { get; set; } = default!; public virtual DbSet CompanyRoleDescriptions { get; set; } = default!; public virtual DbSet CompanyRoles { get; set; } = default!; - public virtual DbSet CompanyServiceAccounts { get; set; } = default!; - public virtual DbSet CompanyServiceAccountTypes { get; set; } = default!; - public virtual DbSet CompanyServiceAccountKindes { get; set; } = default!; + public virtual DbSet TechnicalUsers { get; set; } = default!; + public virtual DbSet TechnicalUserTypes { get; set; } = default!; + public virtual DbSet TechnicalUserKinds { get; set; } = default!; public virtual DbSet CompanyStatuses { get; set; } = default!; public virtual DbSet CompanyUsers { get; set; } = default!; public virtual DbSet CompanyUserAssignedAppFavourites { get; set; } = default!; @@ -139,7 +139,7 @@ public PortalDbContext(DbContextOptions options, IAuditHandler public virtual DbSet CountryLongNames { get; set; } = default!; public virtual DbSet Countries { get; set; } = default!; public virtual DbSet CountryAssignedIdentifiers { get; set; } = default!; - public virtual DbSet DimCompanyServiceAccounts { get; set; } = default!; + public virtual DbSet ExternalTechnicalUsers { get; set; } = default!; public virtual DbSet DimUserCreationData { get; set; } = default!; public virtual DbSet Documents { get; set; } = default!; public virtual DbSet DocumentTypes { get; set; } = default!; @@ -469,14 +469,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey(x => new { x.AppInstanceId, x.CompanyServiceAccountId }); + entity.HasKey(x => new { x.AppInstanceId, x.TechnicalUserId }); entity.HasOne(x => x.AppInstance) .WithMany(x => x.ServiceAccounts) .HasForeignKey(x => x.AppInstanceId) .OnDelete(DeleteBehavior.ClientSetNull); - entity.HasOne(x => x.CompanyServiceAccount) + entity.HasOne(x => x.TechnicalUser) .WithMany(x => x.AppInstances) - .HasForeignKey(x => x.CompanyServiceAccountId) + .HasForeignKey(x => x.TechnicalUserId) .OnDelete(DeleteBehavior.ClientSetNull); }); @@ -781,18 +781,18 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .Select(e => new CompanyStatus(e)) ); - modelBuilder.Entity() + modelBuilder.Entity() .HasData( - Enum.GetValues(typeof(CompanyServiceAccountTypeId)) - .Cast() - .Select(e => new CompanyServiceAccountType(e)) + Enum.GetValues(typeof(TechnicalUserTypeId)) + .Cast() + .Select(e => new TechnicalUserType(e)) ); - modelBuilder.Entity() + modelBuilder.Entity() .HasData( - Enum.GetValues(typeof(CompanyServiceAccountKindId)) - .Cast() - .Select(e => new CompanyServiceAccountKind(e)) + Enum.GetValues(typeof(TechnicalUserKindId)) + .Cast() + .Select(e => new TechnicalUserKind(e)) ); modelBuilder.Entity() @@ -859,38 +859,38 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity() .HasKey(e => new { e.CompanyUserId, e.ProcessId }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { entity.HasOne(x => x.Identity) - .WithOne(x => x.CompanyServiceAccount) - .HasForeignKey(x => x.Id); + .WithOne(x => x.TechnicalUser) + .HasForeignKey(x => x.Id); - entity.HasOne(d => d.CompanyServiceAccountType) - .WithMany(p => p.CompanyServiceAccounts) - .HasForeignKey(d => d.CompanyServiceAccountTypeId); + entity.HasOne(d => d.TechnicalUserType) + .WithMany(p => p.TechnicalUsers) + .HasForeignKey(d => d.TechnicalUserTypeId); - entity.HasOne(d => d.CompanyServiceAccountKind) - .WithMany(p => p.CompanyServiceAccounts) - .HasForeignKey(d => d.CompanyServiceAccountKindId); + entity.HasOne(d => d.TechnicalUserKind) + .WithMany(p => p.TechnicalUsers) + .HasForeignKey(d => d.TechnicalUserKindId); entity.HasOne(d => d.OfferSubscription) - .WithMany(p => p.CompanyServiceAccounts) + .WithMany(p => p.Technicalusers) .HasForeignKey(d => d.OfferSubscriptionId) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasIndex(x => x.ClientClientId) .HasFilter("client_client_id is not null AND company_service_account_kind_id = 1"); - entity.ToTable("company_service_accounts"); + entity.ToTable("technical_users"); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasOne(x => x.CompanyServiceAccount) - .WithOne(x => x.DimCompanyServiceAccount) - .HasForeignKey(x => x.Id); + entity.HasOne(x => x.TechnicalUser) + .WithOne(x => x.ExternalTechnicalUser) + .HasForeignKey(x => x.Id); - entity.ToTable("dim_company_service_accounts"); + entity.ToTable("external_technical_users"); }); modelBuilder.Entity(entity => @@ -1113,9 +1113,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasOne(d => d.Host) .WithMany(p => p.HostedConnectors); - entity.HasOne(d => d.CompanyServiceAccount) + entity.HasOne(d => d.TechnicalUser) .WithOne(p => p.Connector) - .HasForeignKey(d => d.CompanyServiceAccountId) + .HasForeignKey(d => d.TechnicalUserId) .OnDelete(DeleteBehavior.ClientSetNull); entity.HasOne(d => d.SdCreationProcess) @@ -1368,7 +1368,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity() .ToView("company_linked_service_accounts", "portal") - .HasKey(x => x.ServiceAccountId); + .HasKey(x => x.TechnicalUserId); modelBuilder.Entity(entity => { @@ -1400,11 +1400,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity() .ToView("companyrole_collectionroles_view", "portal") .HasNoKey(); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { entity.HasOne(x => x.CompaniesLinkedServiceAccount) - .WithOne(x => x.CompanyServiceAccount) - .HasForeignKey(x => x.ServiceAccountId); + .WithOne(x => x.TechnicalUser) + .HasForeignKey(x => x.TechnicalUserId); }); modelBuilder.Entity() @@ -1504,9 +1504,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasForeignKey(x => x.ProcessId) .OnDelete(DeleteBehavior.ClientSetNull); - entity.HasOne(x => x.ServiceAccount) + entity.HasOne(x => x.TechnicalUser) .WithOne(x => x.DimUserCreationData) - .HasForeignKey(x => x.ServiceAccountId) + .HasForeignKey(x => x.TechnicalUserId) .OnDelete(DeleteBehavior.ClientSetNull); }); } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Views/CompaniesLinkedServiceAccount.cs b/src/portalbackend/PortalBackend.PortalEntities/Views/CompaniesLinkedServiceAccount.cs index f856fdebb5..9070d13e2c 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Views/CompaniesLinkedServiceAccount.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Views/CompaniesLinkedServiceAccount.cs @@ -24,8 +24,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views public class CompaniesLinkedServiceAccount { - public Guid ServiceAccountId { get; private set; } + public Guid TechnicalUserId { get; private set; } public Guid Owners { get; private set; } public Guid? Provider { get; private set; } - public virtual CompanyServiceAccount? CompanyServiceAccount { get; private set; } + public virtual TechnicalUser? TechnicalUser { get; private set; } } diff --git a/src/provisioning/Provisioning.Library/Service/IServiceAccountCreation.cs b/src/provisioning/Provisioning.Library/Service/IServiceAccountCreation.cs index 815f2829e1..b76fcef51d 100644 --- a/src/provisioning/Provisioning.Library/Service/IServiceAccountCreation.cs +++ b/src/provisioning/Provisioning.Library/Service/IServiceAccountCreation.cs @@ -41,9 +41,9 @@ public interface IServiceAccountCreation ServiceAccountCreationInfo creationData, Guid companyId, IEnumerable bpns, - CompanyServiceAccountTypeId companyServiceAccountTypeId, + TechnicalUserTypeId technicalUserTypeId, bool enhanceTechnicalUserName, bool enabled, ServiceAccountCreationProcessData? processData, - Action? setOptionalParameter = null); + Action? setOptionalParameter = null); } diff --git a/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs b/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs index fd71152960..a69186f90a 100644 --- a/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs +++ b/src/provisioning/Provisioning.Library/Service/ServiceAccountCreation.cs @@ -48,11 +48,11 @@ public class ServiceAccountCreation( async Task<(bool HasExternalServiceAccount, Guid? processId, IEnumerable ServiceAccounts)> IServiceAccountCreation.CreateServiceAccountAsync(ServiceAccountCreationInfo creationData, Guid companyId, IEnumerable bpns, - CompanyServiceAccountTypeId companyServiceAccountTypeId, + TechnicalUserTypeId technicalUserTypeId, bool enhanceTechnicalUserName, bool enabled, ServiceAccountCreationProcessData? processData, - Action? setOptionalParameter) + Action? setOptionalParameter) { var (name, description, iamClientAuthMethod, userRoleIds) = creationData; var serviceAccountsRepository = portalRepositories.GetInstance(); @@ -68,7 +68,7 @@ public class ServiceAccountCreation( { var keycloakRoleData = roleData.ToImmutableList(); var (clientId, enhancedName, serviceAccountData) = await CreateKeycloakServiceAccount(bpns, enhanceTechnicalUserName, enabled, name, description, iamClientAuthMethod, keycloakRoleData).ConfigureAwait(ConfigureAwaitOptions.None); - var serviceAccountId = CreateDatabaseServiceAccount(companyId, UserStatusId.ACTIVE, companyServiceAccountTypeId, CompanyServiceAccountKindId.INTERNAL, name, clientId, description, keycloakRoleData, serviceAccountsRepository, userRolesRepository, setOptionalParameter); + var serviceAccountId = CreateDatabaseServiceAccount(companyId, UserStatusId.ACTIVE, technicalUserTypeId, TechnicalUserKindId.INTERNAL, name, clientId, description, keycloakRoleData, serviceAccountsRepository, userRolesRepository, setOptionalParameter); serviceAccounts.Add(new CreatedServiceAccountData( serviceAccountId, enhancedName, @@ -89,7 +89,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 dimServiceAccountId = CreateDatabaseServiceAccount(companyId, UserStatusId.PENDING, technicalUserTypeId, TechnicalUserKindId.EXTERNAL, dimSaName, null, description, dimRoleData, serviceAccountsRepository, userRolesRepository, setOptionalParameter); var processStepRepository = portalRepositories.GetInstance(); if (processData?.ProcessTypeId is not null) { @@ -136,15 +136,15 @@ private static async Task> GetAndValidateUserRoleData( private Guid CreateDatabaseServiceAccount( Guid companyId, UserStatusId userStatusId, - CompanyServiceAccountTypeId companyServiceAccountTypeId, - CompanyServiceAccountKindId companyServiceAccountKindId, + TechnicalUserTypeId technicalUserTypeId, + TechnicalUserKindId technicalUserKindId, string name, string? clientId, string description, IEnumerable userRoleData, IServiceAccountRepository serviceAccountsRepository, IUserRolesRepository userRolesRepository, - Action? setOptionalParameter) + Action? setOptionalParameter) { var identity = portalRepositories.GetInstance().CreateIdentity(companyId, userStatusId, IdentityTypeId.COMPANY_SERVICE_ACCOUNT, null); var serviceAccount = serviceAccountsRepository.CreateCompanyServiceAccount( @@ -152,8 +152,8 @@ private Guid CreateDatabaseServiceAccount( name, description, clientId, - companyServiceAccountTypeId, - companyServiceAccountKindId, + technicalUserTypeId, + technicalUserKindId, setOptionalParameter); userRolesRepository.CreateIdentityAssignedRoleRange( diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs index 2685551322..fb45d16d60 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs @@ -220,7 +220,7 @@ public async Task GetOwnCompanyServiceAccountDetailsAsync_WithValidInput_GetsAll result.IamClientAuthMethod.Should().Be(IamClientAuthMethod.SECRET); result.Secret.Should().Be("topsecret"); result.AuthenticationServiceUrl.Should().Be("https://auth.test/auth"); - result.CompanyServiceAccountKindId.Should().Be(CompanyServiceAccountKindId.INTERNAL); + result.TechnicalUserKindId.Should().Be(TechnicalUserKindId.INTERNAL); A.CallTo(() => _provisioningManager.GetIdOfCentralClientAsync(A._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _provisioningManager.GetCentralClientAuthDataAsync(A._)).MustHaveHappenedOnceExactly(); } @@ -240,7 +240,7 @@ public async Task GetOwnCompanyServiceAccountDetailsAsync_WithValidInputAndDimCo result.Secret.Should().Be("test"); result.IamClientAuthMethod.Should().Be(IamClientAuthMethod.SECRET); result.AuthenticationServiceUrl.Should().Be("https://example.org/auth"); - result.CompanyServiceAccountKindId.Should().Be(CompanyServiceAccountKindId.EXTERNAL); + result.TechnicalUserKindId.Should().Be(TechnicalUserKindId.EXTERNAL); A.CallTo(() => _provisioningManager.GetIdOfCentralClientAsync(A._)).MustNotHaveHappened(); A.CallTo(() => _provisioningManager.GetCentralClientAuthDataAsync(A._)).MustNotHaveHappened(); } @@ -342,15 +342,15 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAsync_WithValidData_Retur var data = new ServiceAccountEditableDetails(ValidServiceAccountId, "new name", "changed description", IamClientAuthMethod.SECRET); var sut = new ServiceAccountBusinessLogic(_provisioningManager, _portalRepositories, _options, null!, _identityService, _serviceAccountManagement); - CompanyServiceAccount? initial = null; - CompanyServiceAccount? modified = null; + TechnicalUser? initial = null; + TechnicalUser? modified = null; - A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(A._, A._, A>._, A>._)) - .Invokes((Guid id, Guid version, Action? initialize, Action modify) => + A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(A._, A._, A>._, A>._)) + .Invokes((Guid id, Guid version, Action? initialize, Action modify) => { - initial = new CompanyServiceAccount(id, version, null!, null!, default, default); + initial = new TechnicalUser(id, version, null!, null!, default, default); initialize?.Invoke(initial); - modified = new CompanyServiceAccount(id, version, null!, null!, default, default); + modified = new TechnicalUser(id, version, null!, null!, default, default); modify(modified); }); // Act @@ -361,11 +361,11 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAsync_WithValidData_Retur result.Name.Should().Be("new name"); A.CallTo(() => _provisioningManager.UpdateCentralClientAsync(A._, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(ValidServiceAccountId, ValidServiceAccountVersion, A>._, A>._)) + A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(ValidServiceAccountId, ValidServiceAccountVersion, A>._, A>._)) .MustHaveHappenedOnceExactly(); - initial.Should().NotBeNull().And.Match( + initial.Should().NotBeNull().And.Match( x => x.Id == ValidServiceAccountId && x.Version == ValidServiceAccountVersion && x.Name == "test" && x.Description == "test"); - modified.Should().NotBeNull().And.Match( + modified.Should().NotBeNull().And.Match( x => x.Name == "new name" && x.Description == "changed description"); } @@ -454,8 +454,8 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAsync_WithExternalService var external = _fixture.Build() .With(x => x.UserStatusId, UserStatusId.ACTIVE) - .With(x => x.CompanyServiceAccountTypeId, CompanyServiceAccountTypeId.OWN) - .With(x => x.CompanyServiceAccountKindId, CompanyServiceAccountKindId.EXTERNAL) + .With(x => x.TechnicalUserTypeId, TechnicalUserTypeId.OWN) + .With(x => x.TechnicalUserKindId, TechnicalUserKindId.EXTERNAL) .Create(); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamClientIdAsync(ExternalServiceAccount, ValidCompanyId)) .Returns(external); @@ -472,7 +472,7 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAsync_WithExternalService .MustHaveHappenedOnceExactly(); A.CallTo(() => _provisioningManager.UpdateCentralClientAsync(A._, A._)) .MustNotHaveHappened(); - A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(ExternalServiceAccount, external.ServiceAccountVersion, A>._, A>._)) + A.CallTo(() => _serviceAccountRepository.AttachAndModifyCompanyServiceAccount(ExternalServiceAccount, external.ServiceAccountVersion, A>._, A>._)) .MustHaveHappenedOnceExactly(); } @@ -493,10 +493,10 @@ public async Task GetOwnCompanyServiceAccountsDataAsync_GetsExpectedData(IEnumer var count = 0; var data = _fixture .Build() - .With(x => x.CompanyServiceAccountKindId, (IFixture _) => + .With(x => x.TechnicalUserKindId, (IFixture _) => { - var kind = count % 2 == 0 ? CompanyServiceAccountKindId.INTERNAL - : CompanyServiceAccountKindId.EXTERNAL; + var kind = count % 2 == 0 ? TechnicalUserKindId.INTERNAL + : TechnicalUserKindId.EXTERNAL; count++; return kind; }) @@ -514,11 +514,11 @@ public async Task GetOwnCompanyServiceAccountsDataAsync_GetsExpectedData(IEnumer result.Should().NotBeNull(); result.Content.Should().HaveCount(5); result.Content - .Where(x => x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL) + .Where(x => x.TechnicalUserKindId == TechnicalUserKindId.INTERNAL) .Should() .HaveCount(3); result.Content - .Where(x => x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL) + .Where(x => x.TechnicalUserKindId == TechnicalUserKindId.EXTERNAL) .Should() .HaveCount(2); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountsUntracked(ValidCompanyId, null, null, A>.That.IsSameSequenceAs(expectedStatusIds))) @@ -550,7 +550,7 @@ public async Task DeleteOwnCompanyServiceAccountAsync_WithNotExistingServiceAcco public async Task DeleteOwnCompanyServiceAccountAsync_WithExistingOfferSubscriptiom_ThrowsNotFoundException() { // Arrange - var serviceAccount = new CompanyServiceAccount(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL); + var serviceAccount = new TechnicalUser(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(ValidServiceAccountId, ValidCompanyId, A>._)) .Returns(new OwnServiceAccountData(_userRoleIds, serviceAccount.Id, UserStatusId.ACTIVE, true, serviceAccount.Version, null, null, ConnectorStatusId.INACTIVE, OfferSubscriptionStatusId.ACTIVE, false, false, null)); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A.That.Not.Matches(x => x == ValidServiceAccountId), A._, A>._)) @@ -570,7 +570,7 @@ public async Task DeleteOwnCompanyServiceAccountAsync_WithExistingOfferSubscript public async Task DeleteOwnCompanyServiceAccountAsync_WithInvalidConnectorStatus_ThrowsConflictException() { // Arrange - var serviceAccount = new CompanyServiceAccount(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL); + var serviceAccount = new TechnicalUser(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(ValidServiceAccountId, ValidCompanyId, A>._)) .Returns(new OwnServiceAccountData(_userRoleIds, serviceAccount.Id, UserStatusId.ACTIVE, true, serviceAccount.Version, null, null, ConnectorStatusId.ACTIVE, OfferSubscriptionStatusId.PENDING, false, false, null)); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A.That.Not.Matches(x => x == ValidServiceAccountId), A._, A>._)) @@ -633,7 +633,7 @@ public async Task DeleteOwnCompanyServiceAccountAsync_WithoutClient_CallsExpecte .With(x => x.UserStatusId, UserStatusId.ACTIVE) .Create(); var connector = _fixture.Build() - .With(x => x.CompanyServiceAccountId, ValidServiceAccountId) + .With(x => x.TechnicalUserId, ValidServiceAccountId) .Create(); var processId = Guid.NewGuid(); SetupDeleteOwnCompanyServiceAccount(connector, identity, processId); @@ -643,7 +643,7 @@ public async Task DeleteOwnCompanyServiceAccountAsync_WithoutClient_CallsExpecte await sut.DeleteOwnCompanyServiceAccountAsync(ValidServiceAccountId); A.CallTo(() => _connectorsRepository.AttachAndModifyConnector(ValidConnectorId, A>._, A>._)).MustHaveHappenedOnceExactly(); - connector.CompanyServiceAccountId.Should().BeNull(); + connector.TechnicalUserId.Should().BeNull(); A.CallTo(() => _serviceAccountManagement.DeleteServiceAccount(ValidServiceAccountId, A._)) .MustHaveHappenedOnceExactly(); } @@ -763,7 +763,7 @@ private void SetupCreateOwnCompanyServiceAccount() A.CallTo(() => _companyRepository.GetBpnAndTechnicalUserRoleIds(A.That.Not.Matches(x => x == ValidCompanyId), ClientId)) .Returns<(string?, IEnumerable)>(default); - A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A.That.Matches(x => x == ValidCompanyId), A>._, CompanyServiceAccountTypeId.OWN, A._, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), null)) + A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A.That.Matches(x => x == ValidCompanyId), A>._, TechnicalUserTypeId.OWN, A._, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), null)) .Returns((false, null, [new CreatedServiceAccountData(Guid.NewGuid(), "test", "description", UserStatusId.ACTIVE, ClientId, new(ClientId, Guid.NewGuid().ToString(), new ClientAuthData(IamClientAuthMethod.SECRET)), Enumerable.Empty())])); A.CallTo(() => _portalRepositories.GetInstance()).Returns(_companyRepository); @@ -800,8 +800,8 @@ private void SetupUpdateOwnCompanyServiceAccountDetails() .With(x => x.UserStatusId, UserStatusId.ACTIVE) .With(x => x.Name, "test") .With(x => x.Description, "test") - .With(x => x.CompanyServiceAccountTypeId, CompanyServiceAccountTypeId.OWN) - .With(x => x.CompanyServiceAccountKindId, CompanyServiceAccountKindId.INTERNAL) + .With(x => x.TechnicalUserTypeId, TechnicalUserTypeId.OWN) + .With(x => x.TechnicalUserKindId, TechnicalUserKindId.INTERNAL) .With(x => x.ClientClientId, "sa-test-1") .Create(); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamClientIdAsync(ValidServiceAccountId, ValidCompanyId)) @@ -818,7 +818,7 @@ private void SetupGetOwnCompanyServiceAccount() var data = _fixture.Build() .With(x => x.Status, UserStatusId.ACTIVE) .With(x => x.DimServiceAccountData, default(DimServiceAccountData?)) - .With(x => x.CompanyServiceAccountKindId, CompanyServiceAccountKindId.INTERNAL) + .With(x => x.TechnicalUserKindId, TechnicalUserKindId.INTERNAL) .Create(); var cryptoHelper = _options.Value.EncryptionConfigs.GetCryptoHelper(_options.Value.EncryptionConfigIndex); @@ -827,7 +827,7 @@ private void SetupGetOwnCompanyServiceAccount() var dimServiceAccountData = new DimServiceAccountData("https://example.org/auth", secret, initializationVector, _options.Value.EncryptionConfigIndex); var dataWithDim = _fixture.Build() .With(x => x.DimServiceAccountData, dimServiceAccountData) - .With(x => x.CompanyServiceAccountKindId, CompanyServiceAccountKindId.EXTERNAL) + .With(x => x.TechnicalUserKindId, TechnicalUserKindId.EXTERNAL) .Create(); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(ValidServiceAccountId, ValidCompanyId)) @@ -843,7 +843,7 @@ private void SetupGetOwnCompanyServiceAccount() private void SetupDeleteOwnCompanyServiceAccount(Connector? connector = null, Identity? identity = null, Guid? processId = null) { - var serviceAccount = new CompanyServiceAccount(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL); + var serviceAccount = new TechnicalUser(Guid.NewGuid(), Guid.NewGuid(), "test-sa", "test", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(ValidServiceAccountId, ValidCompanyId, A>._)) .Returns(new OwnServiceAccountData(_userRoleIds, serviceAccount.Id, UserStatusId.ACTIVE, true, serviceAccount.Version, ValidConnectorId, ClientId, ConnectorStatusId.INACTIVE, OfferSubscriptionStatusId.PENDING, false, false, processId)); A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A.That.Not.Matches(x => x == ValidServiceAccountId), A._, A>._)) diff --git a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs index 685090c971..f338c0c486 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs @@ -59,7 +59,7 @@ public async Task ExecuteCompanyUserCreation_CallsExpected() // Arrange var serviceAccountId = Guid.NewGuid(); var responseData = _fixture.Build() - .With(x => x.ServiceAccountId, serviceAccountId) + .With(x => x.TechnicalUserId, serviceAccountId) .CreateMany(1); var data = _fixture.Create(); A.CallTo(() => _logic.CreateOwnCompanyServiceAccountAsync(A._)) @@ -71,7 +71,7 @@ public async Task ExecuteCompanyUserCreation_CallsExpected() // Assert A.CallTo(() => _logic.CreateOwnCompanyServiceAccountAsync(data)).MustHaveHappenedOnceExactly(); - result.Should().ContainSingle(x => x.ServiceAccountId == responseData.First().ServiceAccountId); + result.Should().ContainSingle(x => x.TechnicalUserId == responseData.First().TechnicalUserId); } [Fact] diff --git a/tests/endtoend/ServiceAccountCUDScenarios/AdministrationEndpointHelper.cs b/tests/endtoend/ServiceAccountCUDScenarios/AdministrationEndpointHelper.cs index 5a8b3fa56d..6a4ae16d9d 100644 --- a/tests/endtoend/ServiceAccountCUDScenarios/AdministrationEndpointHelper.cs +++ b/tests/endtoend/ServiceAccountCUDScenarios/AdministrationEndpointHelper.cs @@ -151,7 +151,7 @@ public static async Task UpdateServiceAccountDetailsById(string serviceAccountId { var serviceAccountDetails = await GetServiceAccountDetailsById(serviceAccountId); var updateServiceAccountEditableDetails = - new ServiceAccountEditableDetails(serviceAccountDetails.ServiceAccountId, newName, newDescription, + new ServiceAccountEditableDetails(serviceAccountDetails.TechnicalUserId, newName, newDescription, serviceAccountDetails.IamClientAuthMethod ?? throw new Exception("IamClientAuthMethod is expected not to be null here")); Given() .DisableSslCertificateValidation() diff --git a/tests/endtoend/ServiceAccountCUDScenarios/ServiceAccountCUDScenarios.cs b/tests/endtoend/ServiceAccountCUDScenarios/ServiceAccountCUDScenarios.cs index 415775e140..9502dd3143 100644 --- a/tests/endtoend/ServiceAccountCUDScenarios/ServiceAccountCUDScenarios.cs +++ b/tests/endtoend/ServiceAccountCUDScenarios/ServiceAccountCUDScenarios.cs @@ -67,10 +67,10 @@ public async Task ServiceAccount_Creation(string[] permissions) if (!existingServiceAccounts.IsNullOrEmpty()) { - newServiceAccounts.Any(newAccount => existingServiceAccounts!.Any(existing => existing.ServiceAccountId == newAccount.ServiceAccountId)).Should().BeFalse(); + newServiceAccounts.Any(newAccount => existingServiceAccounts!.Any(existing => existing.TechnicalUserId == newAccount.TechnicalUserId)).Should().BeFalse(); } - newServiceAccounts.All(newAccount => updatedServiceAccounts!.Any(updated => updated.ServiceAccountId == newAccount.ServiceAccountId)).Should().BeTrue("New service account could not be found in the list of service accounts"); + newServiceAccounts.All(newAccount => updatedServiceAccounts!.Any(updated => updated.TechnicalUserId == newAccount.TechnicalUserId)).Should().BeTrue("New service account could not be found in the list of service accounts"); } catch (Exception) { @@ -89,7 +89,7 @@ public async Task ServiceAccount_Creation(string[] permissions) var jwtSecurityToken = new JwtSecurityTokenHandler().ReadJwtToken(token); jwtSecurityToken.Payload.Should().ContainKey("bpn", "Attribute BPN in user token was not found"); var result = await AdministrationEndpointHelper.DeleteServiceAccount( - newServiceAccount.ServiceAccountId.ToString()); + newServiceAccount.TechnicalUserId.ToString()); result.Should().BeTrue("Created service account could not be deleted"); } } @@ -112,15 +112,15 @@ public async Task ServiceAccount_DataUpdate(string[] permissions) var newDescription = "This is an updated description for a technical user via test automation e2e tests"; foreach (var newServiceAccount in newServiceAccounts.Where(account => account.Status == PortalBackend.PortalEntities.Enums.UserStatusId.ACTIVE)) { - await AdministrationEndpointHelper.UpdateServiceAccountDetailsById(newServiceAccount.ServiceAccountId.ToString(), + await AdministrationEndpointHelper.UpdateServiceAccountDetailsById(newServiceAccount.TechnicalUserId.ToString(), newTechUserName, newDescription); //check if the change of the serviceAccount got successfully saved - var updatedServiceAccount = await AdministrationEndpointHelper.GetServiceAccountDetailsById(newServiceAccount.ServiceAccountId.ToString()); + var updatedServiceAccount = await AdministrationEndpointHelper.GetServiceAccountDetailsById(newServiceAccount.TechnicalUserId.ToString()); updatedServiceAccount.Name.Should().Be(newTechUserName, "Updated technical user name was not stored correctly."); updatedServiceAccount.Description.Should().Be(newDescription, "Updated description of service account was not stored correctly"); - var result = await AdministrationEndpointHelper.DeleteServiceAccount(updatedServiceAccount.ServiceAccountId.ToString()); + var result = await AdministrationEndpointHelper.DeleteServiceAccount(updatedServiceAccount.TechnicalUserId.ToString()); result.Should().BeTrue("Created service account could not be deleted."); } } @@ -141,7 +141,7 @@ public async Task ServiceAccount_CredentialRefresh(string[] permissions) //reset service account credentials var updatedServiceAccount = await AdministrationEndpointHelper.ResetServiceAccountCredentialsById( - newServiceAccount.ServiceAccountId.ToString()); + newServiceAccount.TechnicalUserId.ToString()); updatedServiceAccount.Should().NotBeNull(); //check if the resetup of the credentials was successful @@ -152,7 +152,7 @@ await AdministrationEndpointHelper.ResetServiceAccountCredentialsById( var token = TechTokenRetriever.GetToken(TokenUrl, updatedServiceAccount.ClientId!, updatedServiceAccount.Secret); token.Should().NotBeNullOrEmpty("Token for new technical user could not be fetched correctly"); - var result = await AdministrationEndpointHelper.DeleteServiceAccount(updatedServiceAccount.ServiceAccountId.ToString()); + var result = await AdministrationEndpointHelper.DeleteServiceAccount(updatedServiceAccount.TechnicalUserId.ToString()); result.Should().BeTrue("Created service account could not be deleted"); } } @@ -174,20 +174,20 @@ public async Task ServiceAccount_Deletion(string[] permissions) foreach (var newServiceAccount in newServiceAccounts) { var checkAccountIsAvailable = - existingServiceAccounts.Where(t => t.ServiceAccountId == newServiceAccount.ServiceAccountId); + existingServiceAccounts.Where(t => t.TechnicalUserId == newServiceAccount.TechnicalUserId); checkAccountIsAvailable.Should().NotBeNullOrEmpty(); //delete the created service account - await AdministrationEndpointHelper.DeleteServiceAccount(newServiceAccount.ServiceAccountId.ToString()); + await AdministrationEndpointHelper.DeleteServiceAccount(newServiceAccount.TechnicalUserId.ToString()); //check the endpoint, the deleted service account should not be available anymore var updatedServiceAccounts = await AdministrationEndpointHelper.GetServiceAccounts(); var checkAccountDeleted = - updatedServiceAccounts.Where(t => t.ServiceAccountId == newServiceAccount.ServiceAccountId); + updatedServiceAccounts.Where(t => t.TechnicalUserId == newServiceAccount.TechnicalUserId); checkAccountDeleted.Should().BeEmpty(); - updatedServiceAccounts.Where(item => item.ServiceAccountId == newServiceAccount.ServiceAccountId).Should().BeEmpty(); + updatedServiceAccounts.Where(item => item.TechnicalUserId == newServiceAccount.TechnicalUserId).Should().BeEmpty(); } } diff --git a/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs b/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs index c9e4ee79fa..498741c302 100644 --- a/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs +++ b/tests/externalsystems/OfferProvider.Library/BusinessLogic/OfferProviderBusinessLogicTests.cs @@ -143,7 +143,7 @@ public async Task TriggerProviderCallback_InvalidSubscriptionId_Throws() // Arrange var fakeId = Guid.NewGuid(); A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) - .Returns<(IEnumerable<(Guid, string?, CompanyServiceAccountKindId)>, string?, string?, OfferSubscriptionStatusId)>(default); + .Returns<(IEnumerable<(Guid, string?, TechnicalUserKindId)>, string?, string?, OfferSubscriptionStatusId)>(default); async Task Act() => await _sut.TriggerProviderCallback(fakeId, CancellationToken.None); // Act @@ -159,7 +159,7 @@ public async Task TriggerProviderCallback_WithPendingSubscription_Throws() // Arrange var fakeId = Guid.NewGuid(); A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) - .Returns((Enumerable.Empty<(Guid, string?, CompanyServiceAccountKindId)>(), string.Empty, "callback", OfferSubscriptionStatusId.PENDING)); + .Returns((Enumerable.Empty<(Guid, string?, TechnicalUserKindId)>(), string.Empty, "callback", OfferSubscriptionStatusId.PENDING)); async Task Act() => await _sut.TriggerProviderCallback(fakeId, CancellationToken.None); // Act @@ -175,7 +175,7 @@ public async Task TriggerProviderCallback_WithClientIdNotSet_Throws() // Arrange var fakeId = Guid.NewGuid(); A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) - .Returns((Enumerable.Empty<(Guid, string?, CompanyServiceAccountKindId)>(), null, "callback", OfferSubscriptionStatusId.ACTIVE)); + .Returns((Enumerable.Empty<(Guid, string?, TechnicalUserKindId)>(), null, "callback", OfferSubscriptionStatusId.ACTIVE)); async Task Act() => await _sut.TriggerProviderCallback(fakeId, CancellationToken.None); // Act @@ -191,7 +191,7 @@ public async Task TriggerProviderCallback_WithCallbackUrlNotSet_Skips() // Arrange var fakeId = Guid.NewGuid(); A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) - .Returns((Enumerable.Empty<(Guid, string?, CompanyServiceAccountKindId)>(), "cl1", null, OfferSubscriptionStatusId.ACTIVE)); + .Returns((Enumerable.Empty<(Guid, string?, TechnicalUserKindId)>(), "cl1", null, OfferSubscriptionStatusId.ACTIVE)); // Act var result = await _sut.TriggerProviderCallback(fakeId, CancellationToken.None); @@ -207,7 +207,7 @@ public async Task TriggerProviderCallback_WithNoServiceAccountSet_CallsExpected( // Arrange var fakeId = Guid.NewGuid(); A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) - .Returns((Enumerable.Empty<(Guid, string?, CompanyServiceAccountKindId)>(), "cl1", "https://callback.com", OfferSubscriptionStatusId.ACTIVE)); + .Returns((Enumerable.Empty<(Guid, string?, TechnicalUserKindId)>(), "cl1", "https://callback.com", OfferSubscriptionStatusId.ACTIVE)); // Act var result = await _sut.TriggerProviderCallback(fakeId, CancellationToken.None); @@ -226,10 +226,10 @@ public async Task TriggerProviderCallback_WithMultipleServiceAccountSet_Throws() { // Arrange var fakeId = Guid.NewGuid(); - var serviceAccounts = new (Guid, string?, CompanyServiceAccountKindId)[] + var serviceAccounts = new (Guid, string?, TechnicalUserKindId)[] { - new(Guid.NewGuid(), "sa1", CompanyServiceAccountKindId.INTERNAL), - new(Guid.NewGuid(), "sa2", CompanyServiceAccountKindId.INTERNAL) + new(Guid.NewGuid(), "sa1", TechnicalUserKindId.INTERNAL), + new(Guid.NewGuid(), "sa2", TechnicalUserKindId.INTERNAL) }; A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(fakeId)) .Returns((serviceAccounts, "cl1", "https://callback.com", OfferSubscriptionStatusId.ACTIVE)); @@ -249,9 +249,9 @@ public async Task TriggerProviderCallback_WithValidData_InternalSA_ReturnsExpect var technicalUserId = Guid.NewGuid(); var technicalUserClientId = "sa1"; var technicalUserInternalClientId = Guid.NewGuid().ToString(); - var serviceAccounts = new (Guid, string?, CompanyServiceAccountKindId)[] + var serviceAccounts = new (Guid, string?, TechnicalUserKindId)[] { - new(technicalUserId, technicalUserClientId, CompanyServiceAccountKindId.INTERNAL) + new(technicalUserId, technicalUserClientId, TechnicalUserKindId.INTERNAL) }; A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(_subscriptionId)) .Returns((serviceAccounts, "cl1", "https://callback.com", OfferSubscriptionStatusId.ACTIVE)); @@ -277,9 +277,9 @@ public async Task TriggerProviderCallback_WithValidData_ExternalSA_ReturnsExpect // Arrange var technicalUserId = Guid.NewGuid(); var technicalUserClientId = "sa1"; - var serviceAccounts = new (Guid, string?, CompanyServiceAccountKindId)[] + var serviceAccounts = new (Guid, string?, TechnicalUserKindId)[] { - new(technicalUserId, technicalUserClientId, CompanyServiceAccountKindId.EXTERNAL) + new(technicalUserId, technicalUserClientId, TechnicalUserKindId.EXTERNAL) }; A.CallTo(() => _offerSubscriptionRepository.GetTriggerProviderCallbackInformation(_subscriptionId)) .Returns((serviceAccounts, "cl1", "https://callback.com", OfferSubscriptionStatusId.ACTIVE)); diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs index dfeea8f904..bc24501d0c 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs @@ -131,8 +131,8 @@ public async Task AutoSetup_WithValidData_ReturnsExpectedNotificationAndSecret(O { // Arrange var offerSubscription = new OfferSubscription(Guid.NewGuid(), Guid.Empty, Guid.Empty, OfferSubscriptionStatusId.PENDING, Guid.Empty, default); - var companyServiceAccount = new CompanyServiceAccount(Guid.NewGuid(), Guid.NewGuid(), "test", "test", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL); - var createNotificationsEnumerator = SetupAutoSetup(offerTypeId, offerSubscription, isSingleInstance, companyServiceAccount); + var technicalUser = new TechnicalUser(Guid.NewGuid(), Guid.NewGuid(), "test", "test", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL); + var createNotificationsEnumerator = SetupAutoSetup(offerTypeId, offerSubscription, isSingleInstance, technicalUser); var clientId = Guid.NewGuid(); var appInstanceId = Guid.NewGuid(); var appSubscriptionDetailId = Guid.NewGuid(); @@ -208,7 +208,7 @@ public async Task AutoSetup_WithValidData_ReturnsExpectedNotificationAndSecret(O info.TechnicalUserSecret == "katze!1234" && info.TechnicalUserPermissions.SequenceEqual(new[] { "role1", "role2" }) ); - companyServiceAccount.OfferSubscriptionId.Should().Be(_pendingSubscriptionId); + technicalUser.OfferSubscriptionId.Should().Be(_pendingSubscriptionId); } if (isSingleInstance) @@ -1091,7 +1091,7 @@ public async Task CreateTechnicalUser_WithTechnicalUserNeeded_ReturnsExpected(st : Enumerable.Empty(); var data = new OfferSubscriptionTechnicalUserCreationData(true, clientId, "Test App", "Stark Industries", CompanyUserCompanyId, Bpn, OfferTypeId.SERVICE); var serviceAccountData = _fixture.Create(); - var companyServiceAccount = _fixture.Build() + var technicalUser = _fixture.Build() .With(x => x.OfferSubscriptionId, default(Guid?)) .Create(); var roleIds = _fixture.CreateMany().AsEnumerable(); @@ -1101,19 +1101,19 @@ public async Task CreateTechnicalUser_WithTechnicalUserNeeded_ReturnsExpected(st .Returns(userRoleData.ToAsyncEnumerable()); A.CallTo(() => _technicalUserProfileService.GetTechnicalUserProfilesForOfferSubscription(A._)) .Returns([new(Guid.NewGuid().ToString(), "test", IamClientAuthMethod.SECRET, roleIds)]); - A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A._, A>.That.IsSameSequenceAs(new[] { Bpn }), CompanyServiceAccountTypeId.MANAGED, A._, A._, A._, A>._)) + A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A._, A>.That.IsSameSequenceAs(new[] { Bpn }), TechnicalUserTypeId.MANAGED, A._, A._, A._, A>._)) .Invokes((ServiceAccountCreationInfo _, Guid _, IEnumerable _, - CompanyServiceAccountTypeId _, + TechnicalUserTypeId _, bool _, bool _, ServiceAccountCreationProcessData? _, - Action? setOptionalParameter) => + Action? setOptionalParameter) => { - if (companyServiceAccount != null) + if (technicalUser != null) { - setOptionalParameter?.Invoke(companyServiceAccount); + setOptionalParameter?.Invoke(technicalUser); } }) .Returns(( @@ -1455,17 +1455,17 @@ public async Task TriggerActivateSubscription_WithNotExistingOfferSubscription_T #region Setup - private IAsyncEnumerator SetupServices(CompanyServiceAccount? companyServiceAccount = null) + private IAsyncEnumerator SetupServices(TechnicalUser? technicalUser = null) { A.CallTo(() => _provisioningManager.SetupClientAsync(A._, A._, A?>._, A._)) .Returns("cl1"); - A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A._, A>.That.Matches(x => x.Any(y => y == "CAXSDUMMYCATENAZZ")), CompanyServiceAccountTypeId.MANAGED, A._, A._, A._, A?>._)) - .Invokes((ServiceAccountCreationInfo _, Guid _, IEnumerable _, CompanyServiceAccountTypeId _, bool _, bool _, ServiceAccountCreationProcessData? _, Action? setOptionalParameter) => + A.CallTo(() => _serviceAccountCreation.CreateServiceAccountAsync(A._, A._, A>.That.Matches(x => x.Any(y => y == "CAXSDUMMYCATENAZZ")), TechnicalUserTypeId.MANAGED, A._, A._, A._, A?>._)) + .Invokes((ServiceAccountCreationInfo _, Guid _, IEnumerable _, TechnicalUserTypeId _, bool _, bool _, ServiceAccountCreationProcessData? _, Action? setOptionalParameter) => { - if (companyServiceAccount != null) + if (technicalUser != null) { - setOptionalParameter?.Invoke(companyServiceAccount); + setOptionalParameter?.Invoke(technicalUser); } }) .Returns(new ValueTuple>(false, null, [ @@ -1490,9 +1490,9 @@ private IAsyncEnumerator SetupServices(CompanyServiceAccount? companyServi return createNotificationsEnumerator; } - private IAsyncEnumerator SetupAutoSetup(OfferTypeId offerTypeId, OfferSubscription? offerSubscription = null, bool isSingleInstance = false, CompanyServiceAccount? companyServiceAccount = null) + private IAsyncEnumerator SetupAutoSetup(OfferTypeId offerTypeId, OfferSubscription? offerSubscription = null, bool isSingleInstance = false, TechnicalUser? technicalUser = null) { - var createNotificationsEnumerator = SetupServices(companyServiceAccount); + var createNotificationsEnumerator = SetupServices(technicalUser); if (offerSubscription != null) { diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_service_accounts.unittest.json b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/technical_users.unittest.json similarity index 72% rename from tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_service_accounts.unittest.json rename to tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/technical_users.unittest.json index 8634a1379e..f6866ec5d7 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_service_accounts.unittest.json +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/technical_users.unittest.json @@ -3,8 +3,8 @@ "id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f2", "name": "sa-test", "description": "SA for offer subscription", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "offer_subscription_id": "3DE6A31F-A5D1-4F60-AA3A-4B1A769BECBF", "client_client_id":"sa-x-4" }, @@ -12,16 +12,16 @@ "id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f3", "name": "sa-test", "description": "SA with offer subscription", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": "0b2ca541-206d-48ad-bc02-fb61fbcb5552" }, { "id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f4", "name": "sa-test", "description": "SA with connector", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": null, "client_client_id": "sa-x-1" }, @@ -29,16 +29,16 @@ "id": "93eecd4e-ca47-4dd2-85bf-775ea72eb000", "name": "test-user-service-account", "description": "test-user-service-account-desc", - "company_service_account_kind_id": 1, - "company_service_account_type_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": "0b2ca541-206d-48ad-bc02-fb61fbcb5552" }, { "id": "93eecd4e-ca47-4dd2-85bf-775ea72eb009", "name": "test-user-service-accounts", "description": "test-user-service-account-descs", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": "0b2ca541-206d-48ad-bc02-fb61fbcb5562", "client_client_id": "sa-x-2" }, @@ -46,8 +46,8 @@ "id": "cd436931-8399-4c1d-bd81-7dffb298c7ca", "name": "test-user-service-accounts", "description": "test-user-service-account-descs", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": null, "client_client_id": "sa-x-3" }, @@ -55,8 +55,8 @@ "id": "38c92162-6328-40ce-80f3-22e3f3e9b94d", "name": "sa-inactive", "description": "inactive service account", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": null, "client_client_id": "sa-x-inactive" }, @@ -64,8 +64,8 @@ "id": "38c92162-6328-40ce-80f3-22e3f3e9b94e", "name": "test-user-service-account-0", "description": "test-user-service-account-desc-0", - "company_service_account_type_id": 1, - "company_service_account_kind_id": 1, + "technical_user_type_id": 1, + "technical_user_kind_id": 1, "offer_subscription_id": null, "client_client_id": "sa-x-0" }, @@ -73,8 +73,8 @@ "id": "a946f314-f53e-4c72-9124-40b72bcc59aa", "name": "offersubscription-sa-0", "description": "internal test user for offersubscription", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "offer_subscription_id": "ed4de48d-fd4b-4384-a72f-ecae3c6cc5ba", "client_client_id": "sa-os-internal" }, @@ -82,8 +82,8 @@ "id": "4ce1b774-3d00-4e07-9a53-ae1f64193392", "name": "offersubscription-sa-0", "description": "internal test user for offersubscription", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 2, + "technical_user_type_id": 2, + "technical_user_kind_id": 2, "offer_subscription_id": "ed4de48d-fd4b-4384-a72f-ecae3c6cc5ba", "client_client_id": "sa-os-external" }, @@ -91,8 +91,8 @@ "id": "4ce1b774-3d00-4e07-9a53-ae1f64193394", "name": "sa-pending-0", "description": "pending service account", - "company_service_account_type_id": 2, - "company_service_account_kind_id": 1, + "technical_user_type_id": 2, + "technical_user_kind_id": 1, "offer_subscription_id": null, "client_client_id": "sa-x-4" } diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs index a6358cc529..3799b7513a 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs @@ -61,8 +61,8 @@ public async Task CreateCompanyServiceAccount_ReturnsExpectedResult() "test", "Only a test service account", "sa1", - CompanyServiceAccountTypeId.MANAGED, - CompanyServiceAccountKindId.INTERNAL, + TechnicalUserTypeId.MANAGED, + TechnicalUserKindId.INTERNAL, sa => { sa.OfferSubscriptionId = _validSubscriptionId; @@ -72,11 +72,11 @@ public async Task CreateCompanyServiceAccount_ReturnsExpectedResult() var changeTracker = context.ChangeTracker; var changedEntries = changeTracker.Entries().ToList(); result.OfferSubscriptionId.Should().Be(_validSubscriptionId); - result.CompanyServiceAccountTypeId.Should().Be(CompanyServiceAccountTypeId.MANAGED); + result.TechnicalUserTypeId.Should().Be(TechnicalUserTypeId.MANAGED); result.ClientClientId.Should().Be("sa1"); changeTracker.HasChanges().Should().BeTrue(); changedEntries.Should().ContainSingle() - .Which.Entity.Should().BeOfType().Which.OfferSubscriptionId.Should().Be(_validSubscriptionId); + .Which.Entity.Should().BeOfType().Which.OfferSubscriptionId.Should().Be(_validSubscriptionId); } #endregion @@ -94,8 +94,8 @@ public async Task GetOwnCompanyServiceAccountWithIamClientIdAsync_ReturnsExpecte // Assert result.Should().NotBeNull().And.Match( - x => x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.OWN && - x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL); + x => x.TechnicalUserTypeId == TechnicalUserTypeId.OWN && + x.TechnicalUserKindId == TechnicalUserKindId.INTERNAL); } [Fact] @@ -171,7 +171,7 @@ public async Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync_ReturnsE // Assert result.Should().NotBeNull() .And.Match(x => - x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.OWN && + x.TechnicalUserTypeId == TechnicalUserTypeId.OWN && x.Status == UserStatusId.ACTIVE && x.CompanyLastEditorData != null && x.CompanyLastEditorData.CompanyName == "CX-Test-Access" && @@ -233,7 +233,7 @@ public async Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync_WithInac result.Should().NotBeNull() .And.Match(x => x.ClientClientId == "sa-x-inactive" && - x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.MANAGED && + x.TechnicalUserTypeId == TechnicalUserTypeId.MANAGED && x.Status == UserStatusId.INACTIVE); } @@ -260,7 +260,7 @@ public async Task GetOwnCompanyServiceAccountsUntracked_ReturnsExpectedResult(in if (expected > 0) { result!.Data.First().Should().Match(y => - y.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.MANAGED && + y.TechnicalUserTypeId == TechnicalUserTypeId.MANAGED && y.IsOwner && !y.IsProvider); } @@ -278,7 +278,7 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithClientIdAndOwner_Ret // Assert result!.Count.Should().Be(1); result.Data.Should().HaveCount(1) - .And.Satisfy(x => x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.OWN); + .And.Satisfy(x => x.TechnicalUserTypeId == TechnicalUserTypeId.OWN); } [Fact] @@ -295,20 +295,20 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithOwnerTrue_ReturnsExp result!.Count.Should().Be(17); result.Data.Should().HaveCount(10) .And.AllSatisfy(x => x.Should().Match(y => - y.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.OWN && + y.TechnicalUserTypeId == TechnicalUserTypeId.OWN && y.UserStatusId == UserStatusId.ACTIVE)) .And.BeInAscendingOrder(x => x.Name) .And.Satisfy( - x => x.ServiceAccountId == new Guid("4ce1b774-3d00-4e07-9a53-ae1f64193392"), - x => x.ServiceAccountId == new Guid("a946f314-f53e-4c72-9124-40b72bcc59aa"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201029"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201026"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201027"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201030"), - x => x.ServiceAccountId == new Guid("f3498fe6-e0e5-413b-a725-39bf5c7c1959"), - x => x.ServiceAccountId == new Guid("ab7f01ea-cbb9-4d58-9efa-ea992395f997"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201031"), - x => x.ServiceAccountId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201032")); + x => x.TechnicalUserId == new Guid("4ce1b774-3d00-4e07-9a53-ae1f64193392"), + x => x.TechnicalUserId == new Guid("a946f314-f53e-4c72-9124-40b72bcc59aa"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201029"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201026"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201027"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201030"), + x => x.TechnicalUserId == new Guid("f3498fe6-e0e5-413b-a725-39bf5c7c1959"), + x => x.TechnicalUserId == new Guid("ab7f01ea-cbb9-4d58-9efa-ea992395f997"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201031"), + x => x.TechnicalUserId == new Guid("7e85a0b8-0001-ab67-10d1-0ef508201032")); } [Fact] @@ -324,7 +324,7 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithOwnerFalse_ReturnsEx result.Should().NotBeNull(); result!.Count.Should().Be(1); result.Data.Should().HaveCount(1) - .And.Satisfy(x => x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.MANAGED + .And.Satisfy(x => x.TechnicalUserTypeId == TechnicalUserTypeId.MANAGED && !x.IsOwner && x.IsProvider); } @@ -341,7 +341,7 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithClientIdAndProvider_ result.Should().NotBeNull(); result!.Count.Should().Be(1); result.Data.Should().HaveCount(1) - .And.Satisfy(x => x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.MANAGED); + .And.Satisfy(x => x.TechnicalUserTypeId == TechnicalUserTypeId.MANAGED); } [Fact] @@ -357,7 +357,7 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithOnlyClientId_Returns result.Should().NotBeNull(); result!.Count.Should().Be(1); result.Data.Should().ContainSingle() - .Which.CompanyServiceAccountTypeId.Should().Be(CompanyServiceAccountTypeId.OWN); + .Which.TechnicalUserTypeId.Should().Be(TechnicalUserTypeId.OWN); } [Fact] @@ -389,9 +389,9 @@ public async Task GetOwnCompanyServiceAccountsUntracked_WithUserStatusId_InActiv result!.Count.Should().Be(1); result.Data.Should().ContainSingle() .Which.Should().Match(x => - x.ServiceAccountId == new Guid("38c92162-6328-40ce-80f3-22e3f3e9b94d") && + x.TechnicalUserId == new Guid("38c92162-6328-40ce-80f3-22e3f3e9b94d") && x.ClientId == "sa-x-inactive" && - x.CompanyServiceAccountTypeId == CompanyServiceAccountTypeId.MANAGED && + x.TechnicalUserTypeId == TechnicalUserTypeId.MANAGED && x.UserStatusId == UserStatusId.INACTIVE); } @@ -488,7 +488,7 @@ public async Task CreateDimCompanyServiceAccount_ReturnsExpectedResult() var changeTracker = context.ChangeTracker; changeTracker.HasChanges().Should().BeTrue(); changeTracker.Entries().Should().ContainSingle() - .Which.Entity.Should().BeOfType() + .Which.Entity.Should().BeOfType() .Which.EncryptionMode.Should().Be(0); } @@ -543,8 +543,8 @@ public async Task AttachAndModifyServiceAccount_ReturnsExpected() var changeTracker = context.ChangeTracker; changeTracker.HasChanges().Should().BeTrue(); changeTracker.Entries().Should().ContainSingle() - .Which.Entity.Should().BeOfType() - .Which.Should().Match( + .Which.Entity.Should().BeOfType() + .Which.Should().Match( x => x.Id == id && x.Version != version && x.Description == "test" && x.ClientClientId == "bar" ); } diff --git a/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs b/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs index 98c6d69bce..0d8398964f 100644 --- a/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs +++ b/tests/provisioning/Provisioning.Library.Tests/Extensions/ServiceAccountCreationTests.cs @@ -93,7 +93,7 @@ public ServiceAccountCreationTests() _sut = new ServiceAccountCreation(_provisioningManager, _portalRepositories, _provisioningDbAccess, Options.Create(settings)); } - private void ServiceAccountCreationAction(CompanyServiceAccount _) { } + private void ServiceAccountCreationAction(TechnicalUser _) { } [Fact] public async Task CreateServiceAccountAsync_WithInvalidRole_ThrowsNotFoundException() @@ -103,7 +103,7 @@ public async Task CreateServiceAccountAsync_WithInvalidRole_ThrowsNotFoundExcept Setup(); // Act - async Task Act() => await _sut.CreateServiceAccountAsync(creationData, _companyId, Enumerable.Empty(), CompanyServiceAccountTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); + async Task Act() => await _sut.CreateServiceAccountAsync(creationData, _companyId, Enumerable.Empty(), TechnicalUserTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -111,7 +111,7 @@ public async Task CreateServiceAccountAsync_WithInvalidRole_ThrowsNotFoundExcept A.CallTo(() => _userRepository.CreateIdentity(A._, A._, A._, A>._)) .MustNotHaveHappened(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, A._, A>._)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, A._, A>._)) .MustNotHaveHappened(); A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>._)) .MustNotHaveHappened(); @@ -130,7 +130,7 @@ public async Task CreateServiceAccountAsync_WithInvalidRole_ThrowsNotFoundExcept public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool enhance, string serviceAccountName) { // Arrange - var serviceAccounts = new List(); + var serviceAccounts = new List(); var identities = new List(); var creationData = new ServiceAccountCreationInfo("testName", "abc", IamClientAuthMethod.SECRET, [_validUserRoleId]); var bpns = new[] @@ -140,7 +140,7 @@ public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool e Setup(serviceAccounts, identities); // Act - var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, CompanyServiceAccountTypeId.OWN, enhance, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); + var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, TechnicalUserTypeId.OWN, enhance, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); // Assert @@ -158,7 +158,7 @@ public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool e A.CallTo(() => _userRepository.CreateIdentity(_companyId, UserStatusId.ACTIVE, IdentityTypeId.COMPANY_SERVICE_ACCOUNT, null)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "testName", "abc", "sa1", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL, ServiceAccountCreationAction)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "testName", "abc", "sa1", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL, ServiceAccountCreationAction)) .MustHaveHappenedOnceExactly(); var expectedRolesIds = new[] { (_identityId, _validUserRoleId) }; A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.IsSameSequenceAs(expectedRolesIds))) @@ -182,7 +182,7 @@ public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool e A.CallTo(() => _userRepository.CreateIdentity(A._, UserStatusId.PENDING, A._, A>._)) .MustNotHaveHappened(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, CompanyServiceAccountKindId.EXTERNAL, A>._)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, TechnicalUserKindId.EXTERNAL, A>._)) .MustNotHaveHappened(); A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.Matches(x => x.Any(y => y.Item2 != _validUserRoleId)))) .MustNotHaveHappened(); @@ -194,10 +194,10 @@ public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool e .MustNotHaveHappened(); A.CallTo(() => _portalRepositories.SaveAsync()) .MustNotHaveHappened(); - serviceAccounts.Should().ContainSingle().Which.Should().Match( + serviceAccounts.Should().ContainSingle().Which.Should().Match( x => x.Name == "testName" && x.ClientClientId == "sa1" && - x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL); + x.TechnicalUserKindId == TechnicalUserKindId.INTERNAL); identities.Should().ContainSingle().Which.Should().Match( x => x.CompanyId == _companyId && x.UserStatusId == UserStatusId.ACTIVE && @@ -208,7 +208,7 @@ public async Task CreateServiceAccountAsync_WithValidData_ReturnsExpected(bool e public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() { // Arrange - var serviceAccounts = new List(); + var serviceAccounts = new List(); var identities = new List(); var creationData = new ServiceAccountCreationInfo("testName", "abc", IamClientAuthMethod.SECRET, [_dimUserRoleId]); var bpns = new[] @@ -218,7 +218,7 @@ public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() Setup(serviceAccounts, identities); // Act - var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, CompanyServiceAccountTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); + var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, TechnicalUserTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); // Assert result.ServiceAccounts.Should().ContainSingle() @@ -233,7 +233,7 @@ public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() A.CallTo(() => _userRepository.CreateIdentity(A._, UserStatusId.ACTIVE, A._, A>._)) .MustNotHaveHappened(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, CompanyServiceAccountKindId.INTERNAL, A>._)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, TechnicalUserKindId.INTERNAL, A>._)) .MustNotHaveHappened(); A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.Matches(x => x.Any(y => y.Item2 != _dimUserRoleId)))) .MustNotHaveHappened(); @@ -247,7 +247,7 @@ public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() A.CallTo(() => _userRepository.CreateIdentity(_companyId, UserStatusId.PENDING, IdentityTypeId.COMPANY_SERVICE_ACCOUNT, null)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "dim-testName", "abc", null, CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.EXTERNAL, ServiceAccountCreationAction)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "dim-testName", "abc", null, TechnicalUserTypeId.OWN, TechnicalUserKindId.EXTERNAL, ServiceAccountCreationAction)) .MustHaveHappenedOnceExactly(); var expectedRolesIds = new[] { (_identityId, _dimUserRoleId) }; A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.IsSameSequenceAs(expectedRolesIds))) @@ -262,10 +262,10 @@ public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() A.CallTo(() => _portalRepositories.SaveAsync()) .MustNotHaveHappened(); - serviceAccounts.Should().ContainSingle().Which.Should().Match( + serviceAccounts.Should().ContainSingle().Which.Should().Match( x => x.Name == "dim-testName" && x.ClientClientId == null && - x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL); + x.TechnicalUserKindId == TechnicalUserKindId.EXTERNAL); identities.Should().ContainSingle().Which.Should().Match( x => x.CompanyId == _companyId && x.UserStatusId == UserStatusId.PENDING && @@ -276,7 +276,7 @@ public async Task CreateServiceAccountAsync_WithValidDimData_ReturnsExpected() public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() { // Arrange - var serviceAccounts = new List(); + var serviceAccounts = new List(); var identities = new List(); var creationData = new ServiceAccountCreationInfo("testName", "abc", IamClientAuthMethod.SECRET, [_validUserRoleId, _dimUserRoleId]); var bpns = new[] @@ -286,7 +286,7 @@ public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() Setup(serviceAccounts, identities); // Act - var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, CompanyServiceAccountTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); + var result = await _sut.CreateServiceAccountAsync(creationData, _companyId, bpns, TechnicalUserTypeId.OWN, false, true, new ServiceAccountCreationProcessData(ProcessTypeId.DIM_TECHNICAL_USER, null), ServiceAccountCreationAction); // Assert result.ServiceAccounts.Should().HaveCount(2) @@ -307,7 +307,7 @@ public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() A.CallTo(() => _userRepository.CreateIdentity(_companyId, UserStatusId.ACTIVE, IdentityTypeId.COMPANY_SERVICE_ACCOUNT, null)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "testName", "abc", "sa1", CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.INTERNAL, ServiceAccountCreationAction)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_identityId, "testName", "abc", "sa1", TechnicalUserTypeId.OWN, TechnicalUserKindId.INTERNAL, ServiceAccountCreationAction)) .MustHaveHappenedOnceExactly(); var expectedRolesIds = new[] { (_identityId, _validUserRoleId) }; A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.IsSameSequenceAs(expectedRolesIds))) @@ -331,7 +331,7 @@ public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() A.CallTo(() => _userRepository.CreateIdentity(_companyId, UserStatusId.ACTIVE, IdentityTypeId.COMPANY_SERVICE_ACCOUNT, null)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_secondId, "dim-testName", "abc", null, CompanyServiceAccountTypeId.OWN, CompanyServiceAccountKindId.EXTERNAL, ServiceAccountCreationAction)) + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(_secondId, "dim-testName", "abc", null, TechnicalUserTypeId.OWN, TechnicalUserKindId.EXTERNAL, ServiceAccountCreationAction)) .MustHaveHappenedOnceExactly(); var expectedDimRolesIds = new[] { (_secondId, _dimUserRoleId) }; A.CallTo(() => _userRolesRepository.CreateIdentityAssignedRoleRange(A>.That.IsSameSequenceAs(expectedDimRolesIds))) @@ -342,8 +342,8 @@ public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() serviceAccounts.Should().HaveCount(2) .And.Satisfy( - x => x.Name == "testName" && x.ClientClientId == "sa1" && x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.INTERNAL, - x => x.Name == "dim-testName" && x.ClientClientId == null && x.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL + x => x.Name == "testName" && x.ClientClientId == "sa1" && x.TechnicalUserKindId == TechnicalUserKindId.INTERNAL, + x => x.Name == "dim-testName" && x.ClientClientId == null && x.TechnicalUserKindId == TechnicalUserKindId.EXTERNAL ); identities.Should().HaveCount(2) .And.AllSatisfy(x => x.Should().Match(x => x.CompanyId == _companyId && x.IdentityTypeId == IdentityTypeId.COMPANY_SERVICE_ACCOUNT)) @@ -355,7 +355,7 @@ public async Task CreateServiceAccountAsync_WithValidDataPlus_ReturnsExpected() #region Setup - private void Setup(ICollection? serviceAccounts = null, ICollection? identities = null) + private void Setup(ICollection? serviceAccounts = null, ICollection? identities = null) { A.CallTo(() => _provisioningDbAccess.GetNextClientSequenceAsync()) .Returns(1).Once(); @@ -379,16 +379,16 @@ private void Setup(ICollection? serviceAccounts = null, I return identity; }).Once(); - A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, A._, A>._)) - .ReturnsLazily((Guid identityId, string name, string description, string clientClientId, CompanyServiceAccountTypeId companyServiceAccountTypeId, CompanyServiceAccountKindId companyServiceAccountKindId, Action? setOptionalParameters) => + A.CallTo(() => _serviceAccountRepository.CreateCompanyServiceAccount(A._, A._, A._, A._, A._, A._, A>._)) + .ReturnsLazily((Guid identityId, string name, string description, string clientClientId, TechnicalUserTypeId technicalUserTypeId, TechnicalUserKindId technicalUserKindId, Action? setOptionalParameters) => { - var sa = new CompanyServiceAccount( + var sa = new TechnicalUser( identityId, Guid.NewGuid(), name, description, - companyServiceAccountTypeId, - companyServiceAccountKindId) + technicalUserTypeId, + technicalUserKindId) { ClientClientId = clientClientId };