From 7d9dafd0df60d222e4702a490e2a1364aa16d38f Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Thu, 27 Jul 2023 21:11:05 +0200 Subject: [PATCH 01/10] fix(notification): link creatorId to identity (#170) * fix an error that occurred when autoSetup was executed by a service-account caused by the the creator of a notification being linked to a companyUser instead of identities --------- Refs: CPLP-3042 Reviewed-By: Norbert Truchsess --- ...3042-ChangeNotificationCreator.Designer.cs | 7077 +++++++++++++++++ ...020_CPLP-3042-ChangeNotificationCreator.cs | 65 + .../PortalDbContextModelSnapshot.cs | 32 +- .../Entities/CompanyUser.cs | 2 - .../Entities/Identity.cs | 2 + .../Entities/Notification.cs | 2 +- 6 files changed, 7168 insertions(+), 12 deletions(-) create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs new file mode 100644 index 0000000000..a0370b240c --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs @@ -0,0 +1,7077 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + [DbContext(typeof(PortalDbContext))] + [Migration("20230726140020_CPLP-3042-ChangeNotificationCreator")] + partial class CPLP3042ChangeNotificationCreator + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("portal") + .UseCollation("en_US.utf8") + .HasAnnotation("ProductVersion", "6.0.7") + .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.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.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.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.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.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.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.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.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"); + + 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("AgreementType") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("agreement_type"); + + 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("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("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.AppAssignedUseCase", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("AppId", "UseCaseId") + .HasName("pk_app_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .HasDatabaseName("ix_app_assigned_use_cases_use_case_id"); + + b.ToTable("app_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("IamClientId") + .HasColumnType("uuid") + .HasColumnName("iam_client_id"); + + b.HasKey("Id") + .HasName("pk_app_instances"); + + b.HasIndex("AppId") + .HasDatabaseName("ix_app_instances_app_id"); + + b.HasIndex("IamClientId") + .HasDatabaseName("ix_app_instances_iam_client_id"); + + b.ToTable("app_instances", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.HasKey("AppInstanceId", "CompanyServiceAccountId") + .HasName("pk_app_instance_assigned_service_accounts"); + + b.HasIndex("CompanyServiceAccountId") + .HasDatabaseName("ix_app_instance_assigned_service_accounts_company_service_acco"); + + b.ToTable("app_instance_assigned_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("InstanceUrl") + .HasColumnType("text") + .HasColumnName("instance_url"); + + b.Property("IsSingleInstance") + .HasColumnType("boolean") + .HasColumnName("is_single_instance"); + + b.HasKey("Id") + .HasName("pk_app_instance_setups"); + + b.HasIndex("AppId") + .IsUnique() + .HasDatabaseName("ix_app_instance_setups_app_id"); + + b.ToTable("app_instance_setups", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.HasKey("AppId", "LanguageShortName") + .HasName("pk_app_languages"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_app_languages_language_short_name"); + + b.ToTable("app_languages", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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" + }); + }); + + 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 = "CLEARING_HOUSE" + }, + new + { + Id = 5, + Label = "SELF_DESCRIPTION_LP" + }, + new + { + Id = 6, + Label = "APPLICATION_ACTIVATION" + }); + }); + + 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("OfferSubscriptionId") + .IsUnique() + .HasDatabaseName("ix_app_subscription_details_offer_subscription_id"); + + b.ToTable("app_subscription_details", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_app_subscription_detail20221118 (\"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 OLD.id, \r\n OLD.offer_subscription_id, \r\n OLD.app_instance_id, \r\n OLD.app_subscription_url, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL AFTER DELETE\r\nON portal.app_subscription_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL();") + .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_detail20221118 (\"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_DATE, \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_detail20221118 (\"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_DATE, \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.AuditCompanySsiDetail20230621", 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("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_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("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_use_case_detail_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_ssi_detail20230621"); + + b.ToTable("audit_company_ssi_detail20230621", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_identity20230526"); + + b.ToTable("audit_identity20230526", "portal"); + }); + + 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("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + 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("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("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_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("CompanyId") + .HasDatabaseName("ix_company_applications_company_id"); + + b.ToTable("company_applications", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$\r\nBEGIN\r\n INSERT INTO portal.audit_company_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.date_created, \r\n OLD.date_last_changed, \r\n OLD.application_status_id, \r\n OLD.company_id, \r\n OLD.checklist_process_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION AFTER DELETE\r\nON portal.company_applications\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION();") + .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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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" + }); + }); + + 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.ToTable("company_assigned_roles", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.company_id, \r\n OLD.company_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE AFTER DELETE\r\nON portal.company_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE();") + .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_DATE, \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_DATE, \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.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.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" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("UserRoleCollectionId") + .HasColumnType("uuid") + .HasColumnName("user_role_collection_id"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_assigned_role_collections"); + + b.HasIndex("UserRoleCollectionId") + .IsUnique() + .HasDatabaseName("ix_company_role_assigned_role_collections_user_role_collection"); + + b.ToTable("company_role_assigned_role_collections", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleDescription", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.HasKey("CompanyRoleId", "LanguageShortName") + .HasName("pk_company_role_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_company_role_descriptions_language_short_name"); + + b.ToTable("company_role_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("IsRegistrationRole") + .HasColumnType("boolean") + .HasColumnName("is_registration_role"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_registration_data"); + + b.ToTable("company_role_registration_data", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_id"); + + b.Property("ClientId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("client_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.HasKey("Id") + .HasName("pk_company_service_accounts"); + + b.HasIndex("ClientClientId") + .IsUnique() + .HasDatabaseName("ix_company_service_accounts_client_client_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.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.CompanySsiDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_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("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_use_case_detail_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("Id") + .HasName("pk_company_ssi_details"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_company_ssi_details_company_id"); + + b.HasIndex("CompanySsiDetailStatusId") + .HasDatabaseName("ix_company_ssi_details_company_ssi_detail_status_id"); + + b.HasIndex("CreatorUserId") + .HasDatabaseName("ix_company_ssi_details_creator_user_id"); + + b.HasIndex("DocumentId") + .IsUnique() + .HasDatabaseName("ix_company_ssi_details_document_id"); + + b.HasIndex("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_external_type_use_c"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_type_id"); + + b.ToTable("company_ssi_details", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.verified_credential_type_id, \r\n OLD.company_ssi_detail_status_id, \r\n OLD.document_id, \r\n OLD.date_created, \r\n OLD.creator_user_id, \r\n OLD.expiry_date, \r\n OLD.verified_credential_external_type_use_case_detail_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL AFTER DELETE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL();") + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL AFTER INSERT\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL AFTER UPDATE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", 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_ssi_detail_statuses"); + + b.ToTable("company_ssi_detail_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.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.ToTable("company_users", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYUSER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.id, \r\n OLD.email, \r\n OLD.firstname, \r\n OLD.lastlogin, \r\n OLD.lastname, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYUSER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYUSER AFTER DELETE\r\nON portal.company_users\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER();") + .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_DATE, \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_DATE, \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.Connector", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("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("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("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("Id") + .HasName("pk_connectors"); + + b.HasIndex("CompanyServiceAccountId") + .IsUnique() + .HasDatabaseName("ix_connectors_company_service_account_id"); + + b.HasIndex("HostId") + .HasDatabaseName("ix_connectors_host_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_connectors_last_editor_id"); + + b.HasIndex("LocationId") + .HasDatabaseName("ix_connectors_location_id"); + + b.HasIndex("ProviderId") + .HasDatabaseName("ix_connectors_provider_id"); + + b.HasIndex("SelfDescriptionDocumentId") + .IsUnique() + .HasDatabaseName("ix_connectors_self_description_document_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("ix_connectors_status_id"); + + b.HasIndex("TypeId") + .HasDatabaseName("ix_connectors_type_id"); + + b.ToTable("connectors", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONNECTOR", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.daps_registration_successful, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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.ConnectorClientDetail", b => + { + b.Property("ConnectorId") + .HasColumnType("uuid") + .HasColumnName("connector_id"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("client_id"); + + b.HasKey("ConnectorId") + .HasName("pk_connector_client_details"); + + b.ToTable("connector_client_details", "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.ToTable("consents", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONSENT", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONSENT() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONSENT$\r\nBEGIN\r\n INSERT INTO portal.audit_consent20230412 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.comment, \r\n OLD.consent_status_id, \r\n OLD.target, \r\n OLD.agreement_id, \r\n OLD.company_id, \r\n OLD.document_id, \r\n OLD.company_user_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONSENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONSENT AFTER DELETE\r\nON portal.consents\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONSENT();") + .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_consent20230412 (\"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_DATE, \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_consent20230412 (\"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_DATE, \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(); + + b.Property("Alpha3Code") + .HasMaxLength(3) + .HasColumnType("character(3)") + .HasColumnName("alpha3code") + .IsFixedLength(); + + b.Property("CountryNameDe") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("country_name_de"); + + b.Property("CountryNameEn") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("country_name_en"); + + 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"); + + 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.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("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("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"); + }); + + 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" + }); + }); + + 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.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"); + + 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("UserEntityId") + .IsUnique() + .HasDatabaseName("ix_identities_user_entity_id"); + + b.HasIndex("UserStatusId") + .HasDatabaseName("ix_identities_user_status_id"); + + b.ToTable("identities", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITY", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITY() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_IDENTITY$\r\nBEGIN\r\n INSERT INTO portal.audit_identity20230526 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.company_id, \r\n OLD.user_status_id, \r\n OLD.user_entity_id, \r\n OLD.identity_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITY$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITY AFTER DELETE\r\nON portal.identities\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITY();") + .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_identity20230526 (\"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_DATE, \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_identity20230526 (\"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_DATE, \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("UserRoleId") + .HasDatabaseName("ix_identity_assigned_roles_user_role_id"); + + b.ToTable("identity_assigned_roles", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.identity_id, \r\n OLD.user_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE AFTER DELETE\r\nON portal.identity_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE();") + .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_DATE, \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_DATE, \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.HasKey("Id") + .HasName("pk_identity_providers"); + + b.HasIndex("IdentityProviderCategoryId") + .HasDatabaseName("ix_identity_providers_identity_provider_category_id"); + + b.ToTable("identity_providers", "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 = 1, + Label = "KEYCLOAK_SHARED" + }, + new + { + Id = 2, + Label = "KEYCLOAK_OIDC" + }, + new + { + Id = 3, + Label = "KEYCLOAK_SAML" + }); + }); + + 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" + }); + }); + + 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.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.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" + }); + }); + + 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("Provider") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("provider"); + + 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("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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFER$\r\nBEGIN\r\n INSERT INTO portal.audit_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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 OLD.id, \r\n OLD.name, \r\n OLD.date_created, \r\n OLD.date_released, \r\n OLD.marketing_url, \r\n OLD.contact_email, \r\n OLD.contact_number, \r\n OLD.provider, \r\n OLD.offer_type_id, \r\n OLD.sales_manager_id, \r\n OLD.provider_company_id, \r\n OLD.offer_status_id, \r\n OLD.license_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFER AFTER DELETE\r\nON portal.offers\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFER();") + .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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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("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("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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$\r\nBEGIN\r\n INSERT INTO portal.audit_offer_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.offer_id, \r\n OLD.offer_subscription_status_id, \r\n OLD.display_name, \r\n OLD.description, \r\n OLD.requester_id, \r\n OLD.last_editor_id, \r\n OLD.process_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION AFTER DELETE\r\nON portal.offer_subscriptions\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION();") + .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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.Property("OfferUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("offer_url"); + + b.HasKey("OfferSubscriptionId") + .HasName("pk_offer_subscriptions_process_datas"); + + 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"); + + 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.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 = "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 = "END_CLEARING_HOUSE" + }, + 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 = 15, + Label = "OVERRIDE_BUSINESS_PARTNER_NUMBER" + }, + new + { + Id = 16, + Label = "TRIGGER_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 17, + Label = "START_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 18, + Label = "FINISH_SELF_DESCRIPTION_LP" + }, + new + { + Id = 19, + Label = "DECLINE_APPLICATION" + }, + new + { + Id = 100, + Label = "TRIGGER_PROVIDER" + }, + new + { + Id = 101, + Label = "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" + }); + }); + + 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" + }); + }); + + 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.ToTable("provider_company_details", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_provider_company_detail20230614 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.auto_setup_url, \r\n OLD.auto_setup_callback_url, \r\n OLD.company_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL AFTER DELETE\r\nON portal.provider_company_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL();") + .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_detail20230614 (\"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_DATE, \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_detail20230614 (\"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_DATE, \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 = "CONSULTANCE_SERVICE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.HasKey("Id") + .HasName("pk_technical_user_profiles"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_technical_user_profiles_offer_id"); + + b.ToTable("technical_user_profiles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => + { + b.Property("TechnicalUserProfileId") + .HasColumnType("uuid") + .HasColumnName("technical_user_profile_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.HasKey("TechnicalUserProfileId", "UserRoleId") + .HasName("pk_technical_user_profile_assigned_user_roles"); + + b.HasIndex("UserRoleId") + .HasDatabaseName("ix_technical_user_profile_assigned_user_roles_user_role_id"); + + b.ToTable("technical_user_profile_assigned_user_roles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_unique_identifiers"); + + b.ToTable("unique_identifiers", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMMERCIAL_REG_NUMBER" + }, + new + { + Id = 2, + Label = "VAT_ID" + }, + new + { + Id = 3, + Label = "LEI_CODE" + }, + new + { + Id = 4, + Label = "VIES" + }, + new + { + Id = 5, + Label = "EORI" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Shortname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("shortname"); + + b.HasKey("Id") + .HasName("pk_use_cases"); + + b.ToTable("use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCaseDescription", b => + { + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasColumnName("description"); + + b.HasKey("UseCaseId", "LanguageShortName") + .HasName("pk_use_case_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_use_case_descriptions_language_short_name"); + + b.ToTable("use_case_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("UserRoleText") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_role"); + + b.HasKey("Id") + .HasName("pk_user_roles"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_user_roles_offer_id"); + + b.ToTable("user_roles", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_USERROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_USERROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_USERROLE$\r\nBEGIN\r\n INSERT INTO portal.audit_user_role20221017 (\"id\", \"user_role\", \"offer_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.user_role, \r\n OLD.offer_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_USERROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_USERROLE AFTER DELETE\r\nON portal.user_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_USERROLE();") + .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_role20221017 (\"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_DATE, \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_role20221017 (\"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_DATE, \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.Entities.VerifiedCredentialExternalType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_types"); + + b.ToTable("verified_credential_external_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_CREDENTIAL" + }, + new + { + Id = 2, + Label = "PCF_CREDENTIAL" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_CREDENTIAL" + }, + new + { + Id = 4, + Label = "VEHICLE_DISMANTLE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Expiry") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry"); + + b.Property("Template") + .IsRequired() + .HasColumnType("text") + .HasColumnName("template"); + + b.Property("ValidFrom") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_from"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_type_use_case_detail_versions"); + + b.HasIndex("VerifiedCredentialExternalTypeId", "Version") + .IsUnique() + .HasDatabaseName("ix_verified_credential_external_type_use_case_detail_versions_"); + + b.ToTable("verified_credential_external_type_use_case_detail_versions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", 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_verified_credential_types"); + + b.ToTable("verified_credential_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_FRAMEWORK" + }, + new + { + Id = 2, + Label = "PCF_FRAMEWORK" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_FRAMEWORK" + }, + new + { + Id = 4, + Label = "DISMANTLER_CERTIFICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialExternalTypeId") + .HasName("pk_verified_credential_type_assigned_external_types"); + + b.HasIndex("VerifiedCredentialExternalTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c1"); + + b.ToTable("verified_credential_type_assigned_external_types", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialTypeKindId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_kind_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialTypeKindId") + .HasName("pk_verified_credential_type_assigned_kinds"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasIndex("VerifiedCredentialTypeKindId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential1"); + + b.ToTable("verified_credential_type_assigned_kinds", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("VerifiedCredentialTypeId", "UseCaseId") + .HasName("pk_verified_credential_type_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_use_case_id"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_verified_creden"); + + b.ToTable("verified_credential_type_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", 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_verified_credential_type_kinds"); + + b.ToTable("verified_credential_type_kinds", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "USE_CASE" + }, + new + { + Id = 2, + Label = "CERTIFICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.Property("ServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("service_account_id"); + + b.Property("Owners") + .HasColumnType("uuid") + .HasColumnName("owners"); + + b.Property("Provider") + .HasColumnType("uuid") + .HasColumnName("provider"); + + b.HasKey("ServiceAccountId"); + + b.ToTable((string)null); + + b.ToView("company_linked_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.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_temp_id"); + + 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.Document", "Document") + .WithMany("Agreements") + .HasForeignKey("DocumentId") + .HasConstraintName("fk_agreements_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "IssuerCompany") + .WithMany("Agreements") + .HasForeignKey("IssuerCompanyId") + .IsRequired() + .HasConstraintName("fk_agreements_companies_issuer_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany("Agreements") + .HasForeignKey("UseCaseId") + .HasConstraintName("fk_agreements_use_cases_use_case_id"); + + b.Navigation("AgreementCategory"); + + b.Navigation("Document"); + + b.Navigation("IssuerCompany"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedCompanyRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("CompanyRoleId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_company_roles_company_role"); + + b.Navigation("Agreement"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOffer", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_offers_offer_id"); + + b.Navigation("Agreement"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOfferType", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", "OfferType") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("OfferTypeId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_offer_types_offer_type_id"); + + b.Navigation("Agreement"); + + b.Navigation("OfferType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany() + .HasForeignKey("UseCaseId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_use_cases_use_case_id"); + + b.Navigation("App"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany("AppInstances") + .HasForeignKey("AppId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", "IamClient") + .WithMany("AppInstances") + .HasForeignKey("IamClientId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_iam_clients_iam_client_id"); + + b.Navigation("App"); + + b.Navigation("IamClient"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", "AppInstance") + .WithMany("ServiceAccounts") + .HasForeignKey("AppInstanceId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_app_instances_app_in"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithMany("AppInstances") + .HasForeignKey("CompanyServiceAccountId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_company_service_acco"); + + b.Navigation("AppInstance"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithOne("AppInstanceSetup") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", "AppId") + .IsRequired() + .HasConstraintName("fk_app_instance_setups_offers_app_id"); + + b.Navigation("App"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_languages_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany() + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_app_languages_languages_language_temp_id"); + + b.Navigation("App"); + + b.Navigation("Language"); + }); + + 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.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.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("OfferSubscription"); + }); + + 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.Document", "SelfDescriptionDocument") + .WithMany("Companies") + .HasForeignKey("SelfDescriptionDocumentId") + .HasConstraintName("fk_companies_documents_self_description_document_id"); + + b.Navigation("Address"); + + b.Navigation("CompanyStatus"); + + 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.Company", "Company") + .WithMany("CompanyApplications") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_applications_companies_company_id"); + + b.Navigation("ApplicationStatus"); + + b.Navigation("ChecklistProcess"); + + b.Navigation("Company"); + }); + + 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.Navigation("Company"); + + b.Navigation("CompanyRole"); + }); + + 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.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") + .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") + .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.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_temp_id1"); + + b.Navigation("CompanyRole"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithOne("CompanyRoleRegistrationData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", "CompanyRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_registration_data_company_roles_company_role_id"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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_identity_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("CompanyServiceAccountType"); + + b.Navigation("Identity"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanySsiDetails") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", "CompanySsiDetailStatus") + .WithMany("CompanySsiDetails") + .HasForeignKey("CompanySsiDetailStatusId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_company_ssi_detail_statuses_company_ssi"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CreatorUser") + .WithMany("CompanySsiDetails") + .HasForeignKey("CreatorUserId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_company_users_creator_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithOne("CompanySsiDetail") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", "DocumentId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", "VerifiedCredentialExternalTypeUseCaseDetailVersion") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasConstraintName("fk_company_ssi_details_verified_credential_external_type_use_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_verified_credential_types_verified_cred"); + + b.Navigation("Company"); + + b.Navigation("CompanySsiDetailStatus"); + + b.Navigation("CreatorUser"); + + b.Navigation("Document"); + + b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersion"); + + b.Navigation("VerifiedCredentialType"); + }); + + 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_identity_id"); + + b.Navigation("Identity"); + }); + + 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.Connector", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "CompanyServiceAccountId") + .HasConstraintName("fk_connectors_company_service_accounts_company_service_account"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Host") + .WithMany("HostedConnectors") + .HasForeignKey("HostId") + .HasConstraintName("fk_connectors_companies_host_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_connectors_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Location") + .WithMany("Connectors") + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_connectors_countries_location_temp_id1"); + + 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.Document", "SelfDescriptionDocument") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SelfDescriptionDocumentId") + .HasConstraintName("fk_connectors_documents_self_description_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", "Status") + .WithMany("Connectors") + .HasForeignKey("StatusId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_statuses_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", "Type") + .WithMany("Connectors") + .HasForeignKey("TypeId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_types_type_id"); + + b.Navigation("CompanyServiceAccount"); + + b.Navigation("Host"); + + b.Navigation("LastEditor"); + + b.Navigation("Location"); + + b.Navigation("Provider"); + + b.Navigation("SelfDescriptionDocument"); + + b.Navigation("Status"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorAssignedOfferSubscription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("ConnectorId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_connectors_connector"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("OfferSubscriptionId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_offer_subscriptions_"); + + b.Navigation("Connector"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") + .WithOne("ClientDetails") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", "ConnectorId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_connector_client_details_connectors_connector_id"); + + b.Navigation("Connector"); + }); + + 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.Navigation("Agreement"); + + b.Navigation("Company"); + + b.Navigation("CompanyUser"); + + b.Navigation("ConsentStatus"); + + b.Navigation("Document"); + }); + + 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.Document", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("Documents") + .HasForeignKey("CompanyUserId") + .HasConstraintName("fk_documents_company_users_company_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", "DocumentStatus") + .WithMany("Documents") + .HasForeignKey("DocumentStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_status_document_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", "DocumentType") + .WithMany("Documents") + .HasForeignKey("DocumentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_types_document_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", "MediaType") + .WithMany("Documents") + .HasForeignKey("MediaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_media_types_media_type_id"); + + b.Navigation("CompanyUser"); + + b.Navigation("DocumentStatus"); + + b.Navigation("DocumentType"); + + b.Navigation("MediaType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithOne("IamIdentityProvider") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", "IdentityProviderId") + .IsRequired() + .HasConstraintName("fk_iam_identity_providers_identity_providers_identity_provider"); + + b.Navigation("IdentityProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("Identities") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_identities_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", "IdentityType") + .WithMany("Identities") + .HasForeignKey("IdentityTypeId") + .IsRequired() + .HasConstraintName("fk_identities_identity_type_identity_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", "IdentityStatus") + .WithMany("Identities") + .HasForeignKey("UserStatusId") + .IsRequired() + .HasConstraintName("fk_identities_identity_user_statuses_identity_status_id"); + + b.Navigation("Company"); + + b.Navigation("IdentityStatus"); + + b.Navigation("IdentityType"); + }); + + 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.UserRole", "UserRole") + .WithMany("IdentityAssignedRoles") + .HasForeignKey("UserRoleId") + .IsRequired() + .HasConstraintName("fk_identity_assigned_roles_user_roles_user_role_id"); + + b.Navigation("Identity"); + + 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.Navigation("IdentityProviderCategory"); + }); + + 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_long_name_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_language_short_name"); + + b.Navigation("Language"); + + b.Navigation("LongNameLanguage"); + }); + + 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_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_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.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") + .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("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.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("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.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.Navigation("Company"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Service") + .WithMany("ServiceDetails") + .HasForeignKey("ServiceId") + .IsRequired() + .HasConstraintName("fk_service_details_offers_service_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceType", "ServiceType") + .WithMany("ServiceDetails") + .HasForeignKey("ServiceTypeId") + .IsRequired() + .HasConstraintName("fk_service_details_service_types_service_type_id"); + + b.Navigation("Service"); + + b.Navigation("ServiceType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("TechnicalUserProfiles") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_technical_user_profiles_offers_offer_id"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", "TechnicalUserProfile") + .WithMany("TechnicalUserProfileAssignedUserRoles") + .HasForeignKey("TechnicalUserProfileId") + .IsRequired() + .HasConstraintName("fk_technical_user_profile_assigned_user_roles_technical_user_p"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") + .WithMany("TechnicalUserProfileAssignedUserRole") + .HasForeignKey("UserRoleId") + .IsRequired() + .HasConstraintName("fk_technical_user_profile_assigned_user_roles_user_roles_user_r"); + + 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.Offer", "Offer") + .WithMany("UserRoles") + .HasForeignKey("OfferId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_roles_offers_offer_id"); + + 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.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialExternalTypeUseCaseDetailVersions") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_external_type_use_case_detail_versions_"); + + b.Navigation("VerifiedCredentialExternalType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialTypeAssignedExternalTypes") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedExternalType") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c1"); + + b.Navigation("VerifiedCredentialExternalType"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedKind") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", "VerifiedCredentialTypeKind") + .WithMany("VerifiedCredentialTypeAssignedKinds") + .HasForeignKey("VerifiedCredentialTypeKindId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential1"); + + b.Navigation("VerifiedCredentialType"); + + b.Navigation("VerifiedCredentialTypeKind"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithOne("VerifiedCredentialAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "UseCaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_use_cases_use_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "VerifiedCredentialTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_verified_creden"); + + b.Navigation("UseCase"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("CompaniesLinkedServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.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.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("CompanyIdentifiers"); + + b.Navigation("CompanySsiDetails"); + + b.Navigation("Consents"); + + b.Navigation("HostedConnectors"); + + b.Navigation("Identities"); + + b.Navigation("OfferSubscriptions"); + + 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("Invitations"); + }); + + 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.CompanyRole", b => + { + b.Navigation("AgreementAssignedCompanyRoles"); + + b.Navigation("CompanyAssignedRoles"); + + b.Navigation("CompanyRoleAssignedRoleCollection"); + + b.Navigation("CompanyRoleDescriptions"); + + b.Navigation("CompanyRoleRegistrationData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Navigation("AppInstances"); + + b.Navigation("CompaniesLinkedServiceAccount"); + + b.Navigation("Connector"); + }); + + 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.CompanySsiDetailStatus", b => + { + b.Navigation("CompanySsiDetails"); + }); + + 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("CompanySsiDetails"); + + b.Navigation("CompanyUserAssignedBusinessPartners"); + + 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("ClientDetails"); + + 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"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => + { + b.Navigation("Agreements"); + + b.Navigation("Companies"); + + b.Navigation("CompanySsiDetail"); + + b.Navigation("Connector"); + + b.Navigation("Consents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => + { + b.Navigation("AppInstances"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.Navigation("CompanyServiceAccount"); + + b.Navigation("CompanyUser"); + + b.Navigation("CreatedNotifications"); + + b.Navigation("IdentityAssignedRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => + { + b.Navigation("CompanyIdentityProviders"); + + b.Navigation("IamIdentityProvider"); + }); + + 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.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("CompanyRoleDescriptions"); + + 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.MediaType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", b => + { + b.Navigation("NotificationTypeAssignedTopics"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", b => + { + b.Navigation("NotificationTypeAssignedTopic"); + + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => + { + b.Navigation("AgreementAssignedOffers"); + + b.Navigation("AppInstanceSetup"); + + b.Navigation("AppInstances"); + + b.Navigation("ConsentAssignedOffers"); + + b.Navigation("OfferAssignedPrivacyPolicies"); + + b.Navigation("OfferDescriptions"); + + b.Navigation("OfferSubscriptions"); + + b.Navigation("ServiceDetails"); + + b.Navigation("Tags"); + + b.Navigation("TechnicalUserProfiles"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", b => + { + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => + { + b.Navigation("AppSubscriptionDetail"); + + b.Navigation("CompanyServiceAccounts"); + + b.Navigation("ConnectorAssignedOfferSubscriptions"); + + b.Navigation("ConsentAssignedOfferSubscriptions"); + + b.Navigation("OfferSubscriptionProcessData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => + { + b.Navigation("OfferSubscriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", b => + { + b.Navigation("AgreementAssignedOfferTypes"); + + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", b => + { + b.Navigation("OfferAssignedPrivacyPolicies"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => + { + b.Navigation("CompanyApplication"); + + b.Navigation("OfferSubscription"); + + b.Navigation("ProcessSteps"); + }); + + 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.TechnicalUserProfile", b => + { + b.Navigation("TechnicalUserProfileAssignedUserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Navigation("CompanyIdentifiers"); + + b.Navigation("CountryAssignedIdentifiers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Navigation("Agreements"); + + b.Navigation("CompanyAssignedUseCase"); + + b.Navigation("UseCaseDescriptions"); + + b.Navigation("VerifiedCredentialAssignedUseCase"); + }); + + 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"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", b => + { + b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersions"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalTypes"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.Navigation("CompanySsiDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", b => + { + b.Navigation("CompanySsiDetails"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalType"); + + b.Navigation("VerifiedCredentialTypeAssignedKind"); + + b.Navigation("VerifiedCredentialTypeAssignedUseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", b => + { + b.Navigation("VerifiedCredentialTypeAssignedKinds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs new file mode 100644 index 0000000000..e7dbaae581 --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs @@ -0,0 +1,65 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + public partial class CPLP3042ChangeNotificationCreator : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications"); + + migrationBuilder.AddForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications"); + + migrationBuilder.Sql("UPDATE portal.notifications as n SET creator_user_id = null FROM (SELECT id FROM portal.identities where identity_type_id = 2) AS i WHERE i.id = n.creator_user_id"); + + migrationBuilder.AddForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "company_users", + principalColumn: "id"); + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index bae34a5213..7ae55d25c7 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -21,8 +21,6 @@ // using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; #nullable disable @@ -5189,6 +5187,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => { + b.Property("ServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("service_account_id"); + b.Property("Owners") .HasColumnType("uuid") .HasColumnName("owners"); @@ -5197,9 +5199,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid") .HasColumnName("provider"); - b.Property("ServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("service_account_id"); + b.HasKey("ServiceAccountId"); b.ToTable((string)null); @@ -6131,10 +6131,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Notification", b => { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "Creator") + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "Creator") .WithMany("CreatedNotifications") .HasForeignKey("CreatorUserId") - .HasConstraintName("fk_notifications_company_users_creator_id"); + .HasConstraintName("fk_notifications_identities_creator_id"); b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", "NotificationType") .WithMany("Notifications") @@ -6621,6 +6621,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("VerifiedCredentialType"); }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("CompaniesLinkedServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); + + b.Navigation("CompanyServiceAccount"); + }); + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address", b => { b.Navigation("Companies"); @@ -6722,6 +6734,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("AppInstances"); + b.Navigation("CompaniesLinkedServiceAccount"); + b.Navigation("Connector"); }); @@ -6748,8 +6762,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Consents"); - b.Navigation("CreatedNotifications"); - b.Navigation("Documents"); b.Navigation("Invitations"); @@ -6833,6 +6845,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("CompanyUser"); + b.Navigation("CreatedNotifications"); + b.Navigation("IdentityAssignedRoles"); }); diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs index debae0673f..820960a3e0 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs @@ -40,7 +40,6 @@ public CompanyUser(Guid id, Guid? lastEditorId) SalesManagerOfOffers = new HashSet(); CompanyUserAssignedBusinessPartners = new HashSet(); Notifications = new HashSet(); - CreatedNotifications = new HashSet(); RequestedSubscriptions = new HashSet(); CompanySsiDetails = new HashSet(); } @@ -72,7 +71,6 @@ public CompanyUser(Guid id, Guid? lastEditorId) public virtual ICollection SalesManagerOfOffers { get; private set; } public virtual ICollection CompanyUserAssignedBusinessPartners { get; private set; } public virtual ICollection Notifications { get; private set; } - public virtual ICollection CreatedNotifications { get; private set; } public virtual ICollection RequestedSubscriptions { get; private set; } public virtual ICollection CompanySsiDetails { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs index 155ef29eff..305eef8a92 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs @@ -18,6 +18,7 @@ public Identity(Guid id, DateTimeOffset dateCreated, Guid companyId, UserStatusI IdentityTypeId = identityTypeId; IdentityAssignedRoles = new HashSet(); + CreatedNotifications = new HashSet(); } public Guid Id { get; set; } @@ -48,5 +49,6 @@ public Identity(Guid id, DateTimeOffset dateCreated, Guid companyId, UserStatusI public virtual IdentityType? IdentityType { get; set; } + public virtual ICollection CreatedNotifications { get; private set; } public virtual ICollection IdentityAssignedRoles { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs index aee453cfd0..4de1b85b4e 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Notification.cs @@ -66,5 +66,5 @@ public Notification(Guid id, Guid receiverUserId, DateTimeOffset dateCreated, No // Navigation properties public virtual CompanyUser? Receiver { get; set; } public virtual NotificationType? NotificationType { get; set; } - public virtual CompanyUser? Creator { get; set; } + public virtual Identity? Creator { get; set; } } From 02ea78723a3c6d98116ff9cc4f0b66c584e4129e Mon Sep 17 00:00:00 2001 From: VPrasannaK94 <117351802+VPrasannaK94@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:54:57 +0530 Subject: [PATCH 02/10] fix: resolved apps-business endpoint empty results (#172) Ref: CPLP-3048 --------- Co-authored-by: Norbert Truchsess Reviewed-By: Norbert Truchsess --- .../Apps.Service/BusinessLogic/AppsBusinessLogic.cs | 4 ++-- .../Apps.Service/BusinessLogic/IAppsBusinessLogic.cs | 4 ++-- src/marketplace/Apps.Service/Controllers/AppsController.cs | 4 ++-- .../Apps.Service.Tests/Controllers/AppsControllerTests.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs index 5457d95358..1406a84305 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs @@ -85,9 +85,9 @@ public IAsyncEnumerable GetAllActiveAppsAsync(string? languageShortName app.UseCaseNames)); /// - public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid companyId) => + public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid userId) => _portalRepositories.GetInstance() - .GetAllBusinessAppDataForUserIdAsync(companyId) + .GetAllBusinessAppDataForUserIdAsync(userId) .Select(x => new BusinessAppData( x.OfferId, diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs index bf69e52ef0..eddfea0c13 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs @@ -41,9 +41,9 @@ public interface IAppsBusinessLogic /// /// Get all apps that a user has been assigned roles in. /// - /// Id of the user to get available apps for. + /// Id of the user to get available apps for. /// List of available apps for user. - public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid companyId); + public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid userId); /// /// Get detailed application data for a single app by id. diff --git a/src/marketplace/Apps.Service/Controllers/AppsController.cs b/src/marketplace/Apps.Service/Controllers/AppsController.cs index 4588c1e182..8cf4f58acf 100644 --- a/src/marketplace/Apps.Service/Controllers/AppsController.cs +++ b/src/marketplace/Apps.Service/Controllers/AppsController.cs @@ -74,11 +74,11 @@ public IAsyncEnumerable GetAllActiveAppsAsync([FromQuery] string? lang [HttpGet] [Route("business")] [Authorize(Roles = "view_apps")] - [Authorize(Policy = PolicyTypes.ValidCompany)] + [Authorize(Policy = PolicyTypes.CompanyUser)] [ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] public IAsyncEnumerable GetAllBusinessAppsForCurrentUserAsync() => - this.WithCompanyId(companyId => _appsBusinessLogic.GetAllUserUserBusinessAppsAsync(companyId)); + this.WithUserId(userId => _appsBusinessLogic.GetAllUserUserBusinessAppsAsync(userId)); /// /// Retrieves app details for an app referenced by id. diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs index a318c9ff3e..5659085032 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs @@ -85,7 +85,7 @@ public async Task GetAllBusinessAppsForCurrentUserAsync_ReturnsExpectedCount() var result = await this._controller.GetAllBusinessAppsForCurrentUserAsync().ToListAsync().ConfigureAwait(false); //Assert - A.CallTo(() => _logic.GetAllUserUserBusinessAppsAsync(_identity.CompanyId)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.GetAllUserUserBusinessAppsAsync(_identity.UserId)).MustHaveHappenedOnceExactly(); result.Should().HaveCount(5); } From 0d4372f6b55fe6513e0185a107a76c0936aac002 Mon Sep 17 00:00:00 2001 From: Md Majid Akhter <101315579+qxz2mqe@users.noreply.github.com> Date: Fri, 28 Jul 2023 15:58:30 +0530 Subject: [PATCH 03/10] fix(apps and services):- post offerId/agreementconsent (#173) * fix violation of companyUserId foreign key constraint using id of calling user instead of any user belonging to provider-company. --------- Co-authored-by: Norbert Truchsess Reviewed-By: Norbert Truchsess --- .../BusinessLogic/AppReleaseBusinessLogic.cs | 7 ++-- .../BusinessLogic/IAppReleaseBusinessLogic.cs | 4 +-- .../AppReleaseProcessController.cs | 4 +-- .../Offers.Library/Service/IOfferService.cs | 4 +-- .../Offers.Library/Service/OfferService.cs | 8 ++--- .../IServiceReleaseBusinessLogic.cs | 4 +-- .../ServiceReleaseBusinessLogic.cs | 7 ++-- .../Controllers/ServiceReleaseController.cs | 4 +-- .../Models/OfferAgreementConsent.cs | 2 +- .../Repositories/AgreementRepository.cs | 1 - .../AppReleaseBusinessLogicTest.cs | 8 +++-- .../AppReleaseProcessControllerTest.cs | 35 +++++-------------- .../Service/OfferServiceTests.cs | 18 +++++----- .../ServiceReleaseBusinessLogicTest.cs | 24 +++++++------ .../ServiceReleaseControllerTest.cs | 25 ++++--------- 15 files changed, 63 insertions(+), 92 deletions(-) diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs index 19066207ac..a646c3a9db 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs @@ -158,18 +158,15 @@ public async Task GetOfferAgreementConsentById(Guid appId } /// - public Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId) + public Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity) { if (appId == Guid.Empty) { throw new ControllerArgumentException($"AppId must not be empty"); } - return SubmitOfferConsentInternalAsync(appId, offerAgreementConsents, companyId); + return _offerService.CreateOrUpdateProviderOfferAgreementConsent(appId, offerAgreementConsents, identity, OfferTypeId.APP); } - private Task> SubmitOfferConsentInternalAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId) => - _offerService.CreateOrUpdateProviderOfferAgreementConsent(appId, offerAgreementConsents, companyId, OfferTypeId.APP); - /// public async Task GetAppDetailsForStatusAsync(Guid appId, Guid companyId) { diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs index 1864efd453..a5a29eb53c 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs @@ -80,9 +80,9 @@ public interface IAppReleaseBusinessLogic /// /// /// - /// + /// /// - Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId); + Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity); /// /// Return Offer with Consent Status diff --git a/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs b/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs index e17b5140de..a899763281 100644 --- a/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs +++ b/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs @@ -174,14 +174,14 @@ public Task GetOfferAgreementConsentById([FromRoute] Guid /// App Id is incorrect. [HttpPost] [Authorize(Roles = "edit_apps")] - [Authorize(Policy = PolicyTypes.ValidCompany)] + [Authorize(Policy = PolicyTypes.CompanyUser)] [Route("consent/{appId}/agreementConsents")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] public Task> SubmitOfferConsentToAgreementsAsync([FromRoute] Guid appId, [FromBody] OfferAgreementConsent offerAgreementConsents) => - this.WithCompanyId(companyId => _appReleaseBusinessLogic.SubmitOfferConsentAsync(appId, offerAgreementConsents, companyId)); + this.WithUserIdAndCompanyId(identity => _appReleaseBusinessLogic.SubmitOfferConsentAsync(appId, offerAgreementConsents, identity)); /// /// Return app detail with status diff --git a/src/marketplace/Offers.Library/Service/IOfferService.cs b/src/marketplace/Offers.Library/Service/IOfferService.cs index 0bba7d3c83..9930e27deb 100644 --- a/src/marketplace/Offers.Library/Service/IOfferService.cs +++ b/src/marketplace/Offers.Library/Service/IOfferService.cs @@ -91,10 +91,10 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId, /// /// /// - /// + /// /// OfferTypeId the agreements are associated with /// - Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, Guid companyId, OfferTypeId offerTypeId); + Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, (Guid UserId, Guid CompanyId) identity, OfferTypeId offerTypeId); /// /// Creates a new service offering diff --git a/src/marketplace/Offers.Library/Service/OfferService.cs b/src/marketplace/Offers.Library/Service/OfferService.cs index 28835f48f5..1fd71a4829 100644 --- a/src/marketplace/Offers.Library/Service/OfferService.cs +++ b/src/marketplace/Offers.Library/Service/OfferService.cs @@ -163,9 +163,9 @@ public async Task GetProviderOfferAgreementConsentById(Gu return result.OfferAgreementConsent; } - public async Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, Guid companyId, OfferTypeId offerTypeId) + public async Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, (Guid UserId, Guid CompanyId) identity, OfferTypeId offerTypeId) { - var (companyUserId, dbAgreements, requiredAgreementIds) = await GetProviderOfferAgreementConsent(offerId, companyId, OfferStatusId.CREATED, offerTypeId).ConfigureAwait(false); + var (dbAgreements, requiredAgreementIds) = await GetProviderOfferAgreementConsent(offerId, identity.CompanyId, OfferStatusId.CREATED, offerTypeId).ConfigureAwait(false); var invalidConsents = offerAgreementConsent.Agreements.ExceptBy(requiredAgreementIds, consent => consent.AgreementId); if (invalidConsents.Any()) { @@ -177,8 +177,8 @@ public async Task> CreateOrUpdateProviderOfferAgr dbAgreements, offerAgreementConsent.Agreements, offerId, - companyId, - companyUserId, + identity.CompanyId, + identity.UserId, DateTimeOffset.UtcNow) .Select(consent => new ConsentStatusData(consent.AgreementId, consent.ConsentStatusId)); diff --git a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs index 0d26d94033..1597e1ada5 100644 --- a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs @@ -71,8 +71,8 @@ public interface IServiceReleaseBusinessLogic /// /// Id of the service /// Data of the consents for the agreements - /// Id of the users company - Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId); + /// Id of the users company + Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity); /// /// Retrieves all in review status offer in the marketplace. diff --git a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs index 091ff0a0a7..6f545228f3 100644 --- a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs @@ -123,19 +123,16 @@ public async Task GetServiceDetailsForStatusAsync(Guid } /// - public Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId) + public Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity) { if (serviceId == Guid.Empty) { throw new ControllerArgumentException("ServiceId must not be empty"); } - return SubmitOfferConsentInternalAsync(serviceId, offerAgreementConsents, companyId); + return _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, offerAgreementConsents, identity, OfferTypeId.SERVICE); } - private Task> SubmitOfferConsentInternalAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId) => - _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, offerAgreementConsents, companyId, OfferTypeId.SERVICE); - /// public Task> GetAllInReviewStatusServiceAsync(int page, int size, OfferSorting? sorting, string? serviceName, string? languageShortName, ServiceReleaseStatusIdFilter? statusId) => Pagination.CreateResponseAsync(page, size, 15, diff --git a/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs b/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs index 917871e679..5714ee1217 100644 --- a/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs +++ b/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs @@ -143,13 +143,13 @@ public Task GetServiceDetailsForStatusAsync([FromRoute] [HttpPost] [Route("consent/{serviceId}/agreementConsents")] [Authorize(Roles = "add_service_offering")] - [Authorize(Policy = PolicyTypes.ValidCompany)] + [Authorize(Policy = PolicyTypes.CompanyUser)] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] public async Task> SubmitOfferConsentToAgreementsAsync([FromRoute] Guid serviceId, [FromBody] OfferAgreementConsent offerAgreementConsents) => - await this.WithCompanyId(companyId => _serviceReleaseBusinessLogic.SubmitOfferConsentAsync(serviceId, offerAgreementConsents, companyId)); + await this.WithUserIdAndCompanyId(identity => _serviceReleaseBusinessLogic.SubmitOfferConsentAsync(serviceId, offerAgreementConsents, identity)); /// /// Retrieves all in review status service in the marketplace . diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs index 902a47788e..7c244cb71b 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs @@ -26,4 +26,4 @@ public record OfferAgreementConsent(IEnumerable Agreemen public record AppAgreementConsentStatus(Guid AgreementId, Guid ConsentId, ConsentStatusId ConsentStatusId); -public record OfferAgreementConsentUpdate(Guid CompanyUserId, IEnumerable ExistingAgreements, IEnumerable RequiredAgreementIds); +public record OfferAgreementConsentUpdate(IEnumerable ExistingAgreements, IEnumerable RequiredAgreementIds); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs index 15deee5e15..3ece9ba54c 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs @@ -101,7 +101,6 @@ public IAsyncEnumerable GetAgreementDataForOfferType(Offe offer.OfferTypeId == offerTypeId) .Select(offer => new ValueTuple( new OfferAgreementConsentUpdate( - offer.ProviderCompany!.Identities.Select(companyUser => companyUser.Id).SingleOrDefault(), offer.ConsentAssignedOffers.Select(consentAssignedOffer => new AppAgreementConsentStatus( consentAssignedOffer.Consent!.AgreementId, consentAssignedOffer.Consent.Id, diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs index 30349a18b4..6442509a29 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs @@ -528,7 +528,8 @@ public async Task SubmitAppReleaseRequestAsync_CallsOfferService() public async Task SubmitOfferConsentAsync_WithEmptyAppId_ThrowsControllerArgumentException() { // Act - async Task Act() => await _sut.SubmitOfferConsentAsync(Guid.Empty, _fixture.Create(), _identity.CompanyId).ConfigureAwait(false); + var identitytestdata = (_identity.UserId, _identity.CompanyId); + async Task Act() => await _sut.SubmitOfferConsentAsync(Guid.Empty, _fixture.Create(), identitytestdata).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -539,13 +540,14 @@ public async Task SubmitOfferConsentAsync_WithEmptyAppId_ThrowsControllerArgumen public async Task SubmitOfferConsentAsync_WithAppId_CallsOfferService() { // Arrange + var identitytestdata = (_identity.UserId, _identity.CompanyId); var data = _fixture.Create(); // Act - await _sut.SubmitOfferConsentAsync(_existingAppId, data, _identity.CompanyId).ConfigureAwait(false); + await _sut.SubmitOfferConsentAsync(_existingAppId, data, identitytestdata).ConfigureAwait(false); // Assert - A.CallTo(() => _offerService.CreateOrUpdateProviderOfferAgreementConsent(_existingAppId, data, _identity.CompanyId, OfferTypeId.APP)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _offerService.CreateOrUpdateProviderOfferAgreementConsent(_existingAppId, data, identitytestdata, OfferTypeId.APP)).MustHaveHappenedOnceExactly(); } #endregion diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs index 109e5f0e05..70a18140e1 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs @@ -21,7 +21,6 @@ using AutoFixture; using FakeItEasy; using FluentAssertions; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; @@ -64,8 +63,6 @@ public async Task UpdateApp_ReturnsNoContent() "https://test.provider.com", null, null); - A.CallTo(() => _logic.UpdateAppAsync(A._, A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); // Act var result = await this._controller.UpdateApp(appId, data).ConfigureAwait(false); @@ -83,9 +80,6 @@ public async Task UpdateAppDocument_ReturnsExpectedResult() var documentTypeId = DocumentTypeId.ADDITIONAL_DETAILS; var file = FormFileHelper.GetFormFile("this is just a test", "superFile.pdf", "application/pdf"); - A.CallTo(() => _logic.CreateAppDocumentAsync(A._, A._, A._, A>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), A._)) - .ReturnsLazily(() => Task.CompletedTask); - //Act await this._controller.UpdateAppDocumentAsync(appId, documentTypeId, file, CancellationToken.None).ConfigureAwait(false); @@ -155,15 +149,16 @@ public async Task SubmitOfferConsentToAgreementsAsync_ReturnsExpectedResult() var appId = Guid.NewGuid(); var data = _fixture.Create(); var consentStatusData = new ConsentStatusData(Guid.NewGuid(), ConsentStatusId.ACTIVE); - A.CallTo(() => _logic.SubmitOfferConsentAsync(A._, A._, A._)) - .ReturnsLazily(() => Enumerable.Repeat(consentStatusData, 1)); + var identitydatas = (_identity.UserId, _identity.CompanyId); + A.CallTo(() => _logic.SubmitOfferConsentAsync(A._, A._, A<(Guid, Guid)>._)) + .Returns(Enumerable.Repeat(consentStatusData, 1)); //Act var result = await this._controller.SubmitOfferConsentToAgreementsAsync(appId, data).ConfigureAwait(false); // Assert result.Should().HaveCount(1); - A.CallTo(() => _logic.SubmitOfferConsentAsync(appId, data, _identity.CompanyId)) + A.CallTo(() => _logic.SubmitOfferConsentAsync(appId, data, identitydatas)) .MustHaveHappenedOnceExactly(); } @@ -174,7 +169,7 @@ public async Task GetAppDetailsForStatusAsync_ReturnsExpectedResult() var appId = Guid.NewGuid(); var data = _fixture.Create(); A.CallTo(() => _logic.GetAppDetailsForStatusAsync(A._, A._)) - .ReturnsLazily(() => data); + .Returns(data); //Act var result = await this._controller.GetAppDetailsForStatusAsync(appId).ConfigureAwait(false); @@ -191,8 +186,6 @@ public async Task DeleteAppRoleAsync_ReturnsExpectedResult() //Arrange var appId = Guid.NewGuid(); var roleId = Guid.NewGuid(); - A.CallTo(() => _logic.DeleteAppRoleAsync(A._, A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeleteAppRoleAsync(appId, roleId).ConfigureAwait(false); @@ -209,7 +202,7 @@ public async Task GetAppProviderSalesManagerAsync_ReturnsExpectedResult() //Arrange var data = _fixture.CreateMany(5).ToAsyncEnumerable(); A.CallTo(() => _logic.GetAppProviderSalesManagersAsync(A._)) - .ReturnsLazily(() => data); + .Returns(data); //Act var result = await this._controller.GetAppProviderSalesManagerAsync().ToListAsync().ConfigureAwait(false); @@ -227,7 +220,7 @@ public async Task ExecuteAppCreation_ReturnsExpectedId() var appId = _fixture.Create(); var data = _fixture.Create(); A.CallTo(() => _logic.AddAppAsync(A._, _identity.CompanyId)) - .ReturnsLazily(() => appId); + .Returns(appId); //Act var result = await this._controller.ExecuteAppCreation(data).ConfigureAwait(false); @@ -268,8 +261,6 @@ public async Task UpdateAppRelease_ReturnsNoContent() "test@gmail.com", "9456321678" ); - A.CallTo(() => _logic.UpdateAppReleaseAsync(A._, A._, _identity.CompanyId)) - .ReturnsLazily(() => Task.CompletedTask); // Act var result = await this._controller.UpdateAppRelease(appId, data).ConfigureAwait(false); @@ -285,7 +276,7 @@ public async Task GetAllInReviewStatusAppsAsync_ReturnsExpectedCount() //Arrange var paginationResponse = new Pagination.Response(new Pagination.Metadata(15, 1, 1, 15), _fixture.CreateMany(5)); A.CallTo(() => _logic.GetAllInReviewStatusAppsAsync(A._, A._, A._, null)) - .ReturnsLazily(() => paginationResponse); + .Returns(paginationResponse); //Act var result = await this._controller.GetAllInReviewStatusAppsAsync().ConfigureAwait(false); @@ -300,8 +291,6 @@ public async Task SubmitAppReleaseRequest_ReturnsExpectedCount() { //Arrange var appId = _fixture.Create(); - A.CallTo(() => _logic.SubmitAppReleaseRequestAsync(appId, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.SubmitAppReleaseRequest(appId).ConfigureAwait(false); @@ -316,8 +305,6 @@ public async Task ApproveAppRequest_ReturnsExpectedCount() { //Arrange var appId = _fixture.Create(); - A.CallTo(() => _logic.ApproveAppRequestAsync(appId, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.ApproveAppRequest(appId).ConfigureAwait(false); @@ -333,8 +320,6 @@ public async Task DeclineAppRequest_ReturnsNoContent() //Arrange var appId = _fixture.Create(); var data = new OfferDeclineRequest("Just a test"); - A.CallTo(() => _logic.DeclineAppRequestAsync(A._, A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeclineAppRequest(appId, data).ConfigureAwait(false); @@ -368,8 +353,6 @@ public async Task DeleteAppDocumentsAsync_ReturnsExpectedResult() { //Arrange var documentId = Guid.NewGuid(); - A.CallTo(() => _logic.DeleteAppDocumentsAsync(A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeleteAppDocumentsAsync(documentId).ConfigureAwait(false); @@ -385,8 +368,6 @@ public async Task DeleteAppAsync_ReturnsExpectedResult() { //Arrange var appId = _fixture.Create(); - A.CallTo(() => _logic.DeleteAppAsync(A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeleteAppAsync(appId).ConfigureAwait(false); diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs index b0c5b29805..9e09a50f63 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs @@ -1322,12 +1322,13 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithNoService_Thro //Arrange var offerId = Guid.NewGuid(); var agreementId = Guid.NewGuid(); + var identitytestdata = (_identity.UserId, _identity.CompanyId); var consentData = new OfferAgreementConsent(new[] { new AgreementConsentStatus(agreementId, ConsentStatusId.ACTIVE) }); A.CallTo(() => _agreementRepository.GetOfferAgreementConsent(offerId, _identity.CompanyId, OfferStatusId.CREATED, offerTypeId)) .Returns(((OfferAgreementConsentUpdate, bool))default); // Act - async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, _identity.CompanyId, offerTypeId).ConfigureAwait(false); + async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, identitytestdata, offerTypeId).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -1342,12 +1343,13 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithUserNotInProvi //Arrange var offerId = Guid.NewGuid(); var agreementId = Guid.NewGuid(); + var identitytestdata = (_identity.UserId, _identity.CompanyId); var consentData = new OfferAgreementConsent(new[] { new AgreementConsentStatus(agreementId, ConsentStatusId.ACTIVE) }); A.CallTo(() => _agreementRepository.GetOfferAgreementConsent(offerId, _identity.CompanyId, OfferStatusId.CREATED, offerTypeId)) - .Returns((new OfferAgreementConsentUpdate(_companyUser.Id, Enumerable.Empty(), Enumerable.Empty()), false)); + .Returns((new OfferAgreementConsentUpdate(Enumerable.Empty(), Enumerable.Empty()), false)); // Act - async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, _identity.CompanyId, offerTypeId).ConfigureAwait(false); + async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, identitytestdata, offerTypeId).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -1364,9 +1366,9 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithInvalidData_Th var agreementId = Guid.NewGuid(); var additionalAgreementId = Guid.NewGuid(); var consentId = Guid.NewGuid(); + var identitytestdata = (_identity.UserId, _identity.CompanyId); var consentData = new OfferAgreementConsent(new[] { new AgreementConsentStatus(agreementId, ConsentStatusId.ACTIVE), new AgreementConsentStatus(additionalAgreementId, ConsentStatusId.ACTIVE) }); var offerAgreementConsent = new OfferAgreementConsentUpdate( - _companyUser.Id, new[] { new AppAgreementConsentStatus(agreementId, consentId, ConsentStatusId.INACTIVE) @@ -1379,7 +1381,7 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithInvalidData_Th .Returns((offerAgreementConsent, true)); // Act - async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, _identity.CompanyId, offerTypeId).ConfigureAwait(false); + async Task Act() => await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, identitytestdata, offerTypeId).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -1400,9 +1402,9 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithValidData_Retu var consentId = Guid.NewGuid(); var newCreatedConsentId = Guid.NewGuid(); var utcNow = DateTimeOffset.UtcNow; + var identitytestdata = (_identity.UserId, _identity.CompanyId); var consentData = new OfferAgreementConsent(new[] { new AgreementConsentStatus(agreementId, ConsentStatusId.ACTIVE), new AgreementConsentStatus(additionalAgreementId, ConsentStatusId.ACTIVE) }); var offerAgreementConsent = new OfferAgreementConsentUpdate( - _companyUser.Id, new[] { new AppAgreementConsentStatus(agreementId, consentId, ConsentStatusId.INACTIVE) @@ -1428,10 +1430,10 @@ public async Task CreateOrUpdateProviderOfferAgreementConsent_WithValidData_Retu setOptionalParameters(existingOffer); }); // Act - var result = await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, _identity.CompanyId, offerTypeId).ConfigureAwait(false); + var result = await _sut.CreateOrUpdateProviderOfferAgreementConsent(offerId, consentData, identitytestdata, offerTypeId).ConfigureAwait(false); // Assert - A.CallTo(() => _consentRepository.AddAttachAndModifyOfferConsents(A>._, A>._, offerId, CompanyUserCompanyId, _companyUser.Id, A._)) + A.CallTo(() => _consentRepository.AddAttachAndModifyOfferConsents(A>._, A>._, offerId, _identity.CompanyId, _identity.UserId, A._)) .MustHaveHappenedOnceExactly(); result.Should() .HaveCount(2) diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs index 193f432b38..c5950d409b 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs @@ -314,21 +314,25 @@ public async Task SubmitOfferConsentAsync_WithValidData_ReturnsExpected() { var serviceId = Guid.NewGuid(); var iamUserId = Guid.NewGuid().ToString(); + var identitytestData = (_identity.UserId, _identity.CompanyId); var data = new OfferAgreementConsent(new List()); - A.CallTo(() => _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, data, _identity.CompanyId, OfferTypeId.SERVICE)) - .ReturnsLazily(() => new[] { new ConsentStatusData(Guid.NewGuid(), ConsentStatusId.ACTIVE) }); + A.CallTo(() => _offerService.CreateOrUpdateProviderOfferAgreementConsent(A._, A._, A<(Guid, Guid)>._, A._)) + .Returns(new[] { new ConsentStatusData(Guid.NewGuid(), ConsentStatusId.ACTIVE) }); - var result = await _sut.SubmitOfferConsentAsync(serviceId, data, _identity.CompanyId).ConfigureAwait(false); + var result = await _sut.SubmitOfferConsentAsync(serviceId, data, identitytestData).ConfigureAwait(false); result.Should().ContainSingle().Which.ConsentStatus.Should().Be(ConsentStatusId.ACTIVE); + A.CallTo(() => _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, data, identitytestData, OfferTypeId.SERVICE)) + .MustHaveHappenedOnceExactly(); } [Fact] public async Task SubmitOfferConsentAsync_WithEmptyGuid_ThrowsControllerArgumentException() { var data = new OfferAgreementConsent(new List()); - async Task Act() => await _sut.SubmitOfferConsentAsync(Guid.Empty, data, _fixture.Create()).ConfigureAwait(false); + var identitytestData = (_identity.UserId, _identity.CompanyId); + async Task Act() => await _sut.SubmitOfferConsentAsync(Guid.Empty, data, identitytestData).ConfigureAwait(false); var ex = await Assert.ThrowsAsync(Act); ex.Message.Should().Be("ServiceId must not be empty"); @@ -364,7 +368,7 @@ public async Task CreateServiceOffering_WithValidDataAndEmptyDescriptions_Return var serviceId = Guid.NewGuid(); var offerService = A.Fake(); _fixture.Inject(offerService); - A.CallTo(() => offerService.CreateServiceOfferingAsync(A._, A>._, A._)).ReturnsLazily(() => serviceId); + A.CallTo(() => offerService.CreateServiceOfferingAsync(A._, A<(Guid, Guid)>._, A._)).Returns(serviceId); var sut = _fixture.Create(); // Act @@ -551,7 +555,7 @@ public async Task CreateServiceDocument_ExecutesSuccessfully() await sut.CreateServiceDocumentAsync(serviceId, DocumentTypeId.ADDITIONAL_DETAILS, file, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); // Assert - A.CallTo(() => _offerDocumentService.UploadDocumentAsync(serviceId, DocumentTypeId.ADDITIONAL_DETAILS, file, A>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), OfferTypeId.SERVICE, settings.UploadServiceDocumentTypeIds, CancellationToken.None)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _offerDocumentService.UploadDocumentAsync(serviceId, DocumentTypeId.ADDITIONAL_DETAILS, file, A<(Guid, Guid)>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), OfferTypeId.SERVICE, settings.UploadServiceDocumentTypeIds, CancellationToken.None)).MustHaveHappenedOnceExactly(); } #endregion @@ -620,13 +624,13 @@ await sut private void SetupUpdateService() { A.CallTo(() => _offerRepository.GetServiceUpdateData(_notExistingServiceId, A>._, _identity.CompanyId)) - .ReturnsLazily(() => (ServiceUpdateData?)null); + .Returns((ServiceUpdateData?)null); A.CallTo(() => _offerRepository.GetServiceUpdateData(_activeServiceId, A>._, _identity.CompanyId)) - .ReturnsLazily(() => new ServiceUpdateData(OfferStatusId.ACTIVE, false, Array.Empty<(ServiceTypeId serviceTypeId, bool IsMatch)>(), new ValueTuple(), Array.Empty(), null)); + .Returns(new ServiceUpdateData(OfferStatusId.ACTIVE, false, Array.Empty<(ServiceTypeId serviceTypeId, bool IsMatch)>(), ((Guid, string, bool))default, Array.Empty(), null)); A.CallTo(() => _offerRepository.GetServiceUpdateData(_differentCompanyServiceId, A>._, _identity.CompanyId)) - .ReturnsLazily(() => new ServiceUpdateData(OfferStatusId.CREATED, false, Array.Empty<(ServiceTypeId serviceTypeId, bool IsMatch)>(), new ValueTuple(), Array.Empty(), null)); + .Returns(new ServiceUpdateData(OfferStatusId.CREATED, false, Array.Empty<(ServiceTypeId serviceTypeId, bool IsMatch)>(), ((Guid, string, bool))default, Array.Empty(), null)); A.CallTo(() => _offerRepository.GetServiceUpdateData(_existingServiceId, A>._, _identity.CompanyId)) - .ReturnsLazily(() => new ServiceUpdateData(OfferStatusId.CREATED, true, Enumerable.Repeat(new ValueTuple(ServiceTypeId.DATASPACE_SERVICE, false), 1), new ValueTuple(Guid.NewGuid(), "123", false), Array.Empty(), Guid.NewGuid())); + .Returns(new ServiceUpdateData(OfferStatusId.CREATED, true, new[] { (ServiceTypeId.DATASPACE_SERVICE, false) }, (Guid.NewGuid(), "123", false), Array.Empty(), Guid.NewGuid())); } private void SetupRepositories() diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs index c538688788..d3e9eeb8e8 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs @@ -21,7 +21,6 @@ using AutoFixture; using FakeItEasy; using FluentAssertions; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; @@ -128,7 +127,7 @@ public async Task GetServiceDetailsForStatusAsync_ReturnsExpectedResult() var serviceId = Guid.NewGuid(); var data = _fixture.Create(); A.CallTo(() => _logic.GetServiceDetailsForStatusAsync(A._, A._)) - .ReturnsLazily(() => data); + .Returns(data); //Act var result = await this._controller.GetServiceDetailsForStatusAsync(serviceId).ConfigureAwait(false); @@ -145,16 +144,17 @@ public async Task SubmitOfferConsentToAgreementsAsync_ReturnsExpectedId() //Arrange var serviceId = Guid.NewGuid(); var agreementId = Guid.NewGuid(); + var identitytestData = (_identity.UserId, _identity.CompanyId); var consentStatusData = new ConsentStatusData(Guid.NewGuid(), ConsentStatusId.ACTIVE); var offerAgreementConsentData = new OfferAgreementConsent(new[] { new AgreementConsentStatus(agreementId, ConsentStatusId.ACTIVE) }); - A.CallTo(() => _logic.SubmitOfferConsentAsync(serviceId, A._, A._)) - .ReturnsLazily(() => Enumerable.Repeat(consentStatusData, 1)); + A.CallTo(() => _logic.SubmitOfferConsentAsync(A._, A._, A<(Guid, Guid)>._)) + .Returns(Enumerable.Repeat(consentStatusData, 1)); //Act var result = await this._controller.SubmitOfferConsentToAgreementsAsync(serviceId, offerAgreementConsentData).ConfigureAwait(false); //Assert - A.CallTo(() => _logic.SubmitOfferConsentAsync(serviceId, offerAgreementConsentData, _identity.CompanyId)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.SubmitOfferConsentAsync(serviceId, offerAgreementConsentData, identitytestData)).MustHaveHappenedOnceExactly(); result.Should().HaveCount(1); } @@ -164,7 +164,7 @@ public async Task GetAllInReviewStatusServiceAsync_ReturnsExpectedCount() //Arrange var paginationResponse = new Pagination.Response(new Pagination.Metadata(15, 1, 1, 15), _fixture.CreateMany(5)); A.CallTo(() => _logic.GetAllInReviewStatusServiceAsync(A._, A._, A._, A._, A._, A._)) - .ReturnsLazily(() => paginationResponse); + .Returns(paginationResponse); //Act var result = await this._controller.GetAllInReviewStatusServiceAsync().ConfigureAwait(false); @@ -179,8 +179,6 @@ public async Task DeleteServiceDocumentsAsync_ReturnsExpectedCount() { //Arrange var documentId = Guid.NewGuid(); - A.CallTo(() => _logic.DeleteServiceDocumentsAsync(A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeleteServiceDocumentsAsync(documentId).ConfigureAwait(false); @@ -229,10 +227,6 @@ public async Task UpdateService_ReturnsExpected() [Fact] public async Task SubmitService_ReturnsExpectedCount() { - //Arrange - A.CallTo(() => _logic.SubmitServiceAsync(A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); - //Act await this._controller.SubmitService(ServiceId).ConfigureAwait(false); @@ -260,8 +254,6 @@ public async Task DeclineServiceRequest_ReturnsNoContent() //Arrange var serviceId = _fixture.Create(); var data = new OfferDeclineRequest("Just a test"); - A.CallTo(() => _logic.DeclineServiceRequestAsync(A._, A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeclineServiceRequest(serviceId, data).ConfigureAwait(false); @@ -277,16 +269,13 @@ public async Task UpdateServiceDocumentAsync_CallExpected() // Arrange var serviceId = _fixture.Create(); var file = FormFileHelper.GetFormFile("this is just a test", "superFile.pdf", "application/pdf"); - A.CallTo(() => _logic.CreateServiceDocumentAsync(A._, - A._, A._, A>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), CancellationToken.None)) - .ReturnsLazily(() => Task.CompletedTask); // Act await this._controller.UpdateServiceDocumentAsync(serviceId, DocumentTypeId.ADDITIONAL_DETAILS, file, CancellationToken.None).ConfigureAwait(false); // Assert A.CallTo(() => _logic.CreateServiceDocumentAsync(serviceId, - DocumentTypeId.ADDITIONAL_DETAILS, file, A>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), CancellationToken.None)).MustHaveHappened(); + DocumentTypeId.ADDITIONAL_DETAILS, file, A>.That.Matches(x => x.Item1 == _identity.UserId && x.Item2 == _identity.CompanyId), CancellationToken.None)).MustHaveHappenedOnceExactly(); } [Fact] From fef1c2ce37d2cf700b2a18355e363b0fb313ecbb Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 28 Jul 2023 13:37:52 +0200 Subject: [PATCH 04/10] fix(ssi): ignore existing inactive ssi entries (#168) ignore inactive ssi entries when creating a new entry Refs: CPLP-3022 Reviewed-By: Norbert Truchsess --- .../CompanySsiDetailsRepository.cs | 1 + .../CompanySsiDetailsRepositoryTests.cs | 26 ++++++++++++++----- .../Seeder/Data/company_ssi_details.test.json | 11 ++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs index 5bc20b8004..9e19c28645 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs @@ -130,6 +130,7 @@ public Task CheckSsiDetailsExistsForCompany(Guid companyId, VerifiedCreden x.CompanyId == companyId && x.VerifiedCredentialTypeId == verifiedCredentialTypeId && x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedKind!.VerifiedCredentialTypeKindId == kindId && + x.CompanySsiDetailStatusId != CompanySsiDetailStatusId.INACTIVE && (verifiedCredentialExternalTypeUseCaseDetailId == null || x.VerifiedCredentialExternalTypeUseCaseDetailId == verifiedCredentialExternalTypeUseCaseDetailId)); /// diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs index 55bd8fea5e..2dedd57756 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs @@ -82,13 +82,14 @@ public async Task GetAllCredentialDetails_WithValidData_ReturnsExpected() // Assert result.Should().NotBeNull(); - result.Count.Should().Be(4); - result.Should().HaveCount(4); - result.Where(x => x.CompanyId == _validCompanyId).Should().HaveCount(3) + result.Count.Should().Be(5); + result.Should().HaveCount(5); + result.Where(x => x.CompanyId == _validCompanyId).Should().HaveCount(4) .And.Satisfy( - x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.TRACEABILITY_FRAMEWORK, - x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.PCF_FRAMEWORK, - x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.DISMANTLER_CERTIFICATE); + x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.TRACEABILITY_FRAMEWORK && x.CompanySsiDetailStatusId == CompanySsiDetailStatusId.PENDING, + x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.PCF_FRAMEWORK && x.CompanySsiDetailStatusId == CompanySsiDetailStatusId.PENDING, + x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.DISMANTLER_CERTIFICATE && x.CompanySsiDetailStatusId == CompanySsiDetailStatusId.PENDING, + x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.BEHAVIOR_TWIN_FRAMEWORK && x.CompanySsiDetailStatusId == CompanySsiDetailStatusId.INACTIVE); result.Where(x => x.CompanyId == new Guid("3390c2d7-75c1-4169-aa27-6ce00e1f3cdd")).Should().ContainSingle() .And.Satisfy(x => x.VerifiedCredentialTypeId == VerifiedCredentialTypeId.TRACEABILITY_FRAMEWORK); } @@ -227,6 +228,19 @@ public async Task CheckCredentialDetailsExistsForCompany_WithWrongTypeKindId_Ret result.Should().BeFalse(); } + [Fact] + public async Task CheckCredentialDetailsExistsForCompany_WithInactive_ReturnsFalse() + { + // Arrange + var sut = await CreateSut(); + + // Act + var result = await sut.CheckSsiDetailsExistsForCompany(_validCompanyId, VerifiedCredentialTypeId.BEHAVIOR_TWIN_FRAMEWORK, VerifiedCredentialTypeKindId.USE_CASE, new Guid("1268a76a-ca19-4dd8-b932-01f24071d562")).ConfigureAwait(false); + + // Assert + result.Should().BeFalse(); + } + #endregion #region CheckUseCaseCredentialAndExternalTypeDetails diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_ssi_details.test.json b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_ssi_details.test.json index 3e0ddf72b4..1afa6c8b1f 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_ssi_details.test.json +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_ssi_details.test.json @@ -41,5 +41,16 @@ "creator_user_id": "ac1cf001-7fbc-1f2f-817f-bce058020006", "date_created": "2023-06-01 00:00:00.000000 +00:00", "verified_credential_external_type_use_case_detail_id": "1268a76a-ca19-4dd8-b932-01f24071d560" + }, + { + "id": "9f5b9934-4014-4099-91e9-7b1aee696b07", + "company_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87", + "verified_credential_type_id": 3, + "company_ssi_detail_status_id": 3, + "document_id": "e020787d-1e04-4c0b-9c06-bd1cd44724b2", + "expiry_date": null, + "creator_user_id": "ac1cf001-7fbc-1f2f-817f-bce058020006", + "date_created": "2023-06-01 00:00:00.000000 +00:00", + "verified_credential_external_type_use_case_detail_id": "1268a76a-ca19-4dd8-b932-01f24071d562" } ] From c522032b408107d21fc875c2934d33938324e43e Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 28 Jul 2023 13:39:57 +0200 Subject: [PATCH 05/10] fix(app): change appInstanceId to iamClientId for provider endpoint (#158) Refs: CPLP-2983 Reviewed-By: Norbert Truchsess --- .../Models/OfferSubscriptionDetailData.cs | 2 +- .../Repositories/OfferSubscriptionsRepository.cs | 4 ++-- .../OfferSubscriptionRepositoryTest.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs index 8ce7fca43a..fa05500faf 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs @@ -69,7 +69,7 @@ public record AppProviderSubscriptionDetailData( IEnumerable Contact, IEnumerable TechnicalUserData, string? TenantUrl, - Guid? AppInstanceId + string AppInstanceId ); /// diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs index a47e65b0e9..d6421ec9b4 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs @@ -237,10 +237,10 @@ public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscription x.Subscription.Offer!.Name, 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.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.AppSubscriptionDetail!.AppSubscriptionUrl, - x.Subscription.AppSubscriptionDetail!.AppInstanceId) + x.Subscription.AppSubscriptionDetail!.AppInstance!.IamClient!.ClientClientId) : null)) .SingleOrDefaultAsync(); diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs index 98bbbab433..eb85f6bcdb 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs @@ -272,7 +272,7 @@ public async Task GetAppSubscriptionDetailForProviderAsync_ReturnsExpected() x.Contact.SequenceEqual(new[] { "tobeadded@cx.com" }) && x.OfferSubscriptionStatus == OfferSubscriptionStatusId.ACTIVE && x.TenantUrl == "https://ec-qas.d13fe27.kyma.ondemand.com" && - x.AppInstanceId == new Guid("ab25c218-9ab3-4f1a-b6f4-6394fbc33c5b")); + x.AppInstanceId == "https://catenax-int-dismantler-s66pftcc.authentication.eu10.hana.ondemand.com"); } [Fact] From 3f3a9f76f501b65a03b757e3977396e0c5a999fa Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 28 Jul 2023 13:44:18 +0200 Subject: [PATCH 06/10] chore: adjust logging for serilog (#157) Reviewed-By: Norbert Truchsess --- .../Administration.Service/appsettings.json | 11 +++---- src/marketplace/Apps.Service/appsettings.json | 13 ++++----- .../Services.Service/appsettings.json | 29 +++++++++---------- .../Notifications.Service/appsettings.json | 11 +++---- .../PortalBackend.Migrations/appsettings.json | 11 +++---- .../Processes.Worker/appsettings.json | 11 +++---- .../Provisioning.Migrations/appsettings.json | 11 +++---- .../Registration.Service/appsettings.json | 11 +++---- 8 files changed, 42 insertions(+), 66 deletions(-) diff --git a/src/administration/Administration.Service/appsettings.json b/src/administration/Administration.Service/appsettings.json index d241dc1a72..36d98cd105 100644 --- a/src/administration/Administration.Service/appsettings.json +++ b/src/administration/Administration.Service/appsettings.json @@ -1,15 +1,12 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ "Serilog.Sinks.Console" ], + "MinimumLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", "Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic": "Information" - } - }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + }, "WriteTo": [ { "Name": "Console" } ], diff --git a/src/marketplace/Apps.Service/appsettings.json b/src/marketplace/Apps.Service/appsettings.json index 658dd9f25f..a13c14064b 100644 --- a/src/marketplace/Apps.Service/appsettings.json +++ b/src/marketplace/Apps.Service/appsettings.json @@ -1,14 +1,11 @@ { "SwaggerEnabled": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, "Serilog": { "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + "MinimumLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + }, "WriteTo": [ { "Name": "Console" } ], @@ -96,7 +93,7 @@ "Setting": { "Subject": "Decline of app {offerName}", "EmailTemplateType": "AppRequestDecline" - } + } } ], "Mail": { diff --git a/src/marketplace/Services.Service/appsettings.json b/src/marketplace/Services.Service/appsettings.json index 6ca1e86fd7..9f1a71985c 100644 --- a/src/marketplace/Services.Service/appsettings.json +++ b/src/marketplace/Services.Service/appsettings.json @@ -1,14 +1,11 @@ { "SwaggerEnabled": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, "Serilog": { "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + "MinimumLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + }, "WriteTo": [ { "Name": "Console" } ], @@ -109,15 +106,15 @@ "name": "BPN", "_ProtocolMapper": "oidc-usermodel-attribute-mapper", "config": { - "userAttribute": "bpn", - "claimName": "bpn", - "jsonTypelabel": "String", - "idTokenClaim": "true", - "accessTokenClaim": "true", - "userInfoTokenClaim": "true", - "attributeName": "true", - "multivalued": "" - } + "userAttribute": "bpn", + "claimName": "bpn", + "jsonTypelabel": "String", + "idTokenClaim": "true", + "accessTokenClaim": "true", + "userInfoTokenClaim": "true", + "attributeName": "true", + "multivalued": "" + } }, "CentralOIDCClient": { "surrogateAuthRequired": false, diff --git a/src/notifications/Notifications.Service/appsettings.json b/src/notifications/Notifications.Service/appsettings.json index 75bdbfb322..b3bbdb0384 100644 --- a/src/notifications/Notifications.Service/appsettings.json +++ b/src/notifications/Notifications.Service/appsettings.json @@ -1,14 +1,11 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ "Serilog.Sinks.Console" ], + "MinimumLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + }, "WriteTo": [ { "Name": "Console" } ], diff --git a/src/portalbackend/PortalBackend.Migrations/appsettings.json b/src/portalbackend/PortalBackend.Migrations/appsettings.json index f484b5fabc..0701ec1b9c 100644 --- a/src/portalbackend/PortalBackend.Migrations/appsettings.json +++ b/src/portalbackend/PortalBackend.Migrations/appsettings.json @@ -1,14 +1,11 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ "Serilog.Sinks.Console" ], + "MinimumLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning", "Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations": "Warning" - } - }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Warning", + }, "WriteTo": [ { "Name": "Console" } ], diff --git a/src/processes/Processes.Worker/appsettings.json b/src/processes/Processes.Worker/appsettings.json index 63001556f5..cda1bc089e 100644 --- a/src/processes/Processes.Worker/appsettings.json +++ b/src/processes/Processes.Worker/appsettings.json @@ -1,6 +1,7 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ "Serilog.Sinks.Console" ], + "MinimumLevel": { "Default": "Information", "Microsoft.Hosting.Lifetime": "Information", "Microsoft.EntityFrameworkCore.Database.Command": "Information", @@ -9,11 +10,7 @@ "Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library": "Information", "Org.Eclipse.TractusX.Portal.Backend.Custodian.Library": "Information", "Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library": "Information" - } - }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + }, "WriteTo": [ { "Name": "Console" } ], diff --git a/src/provisioning/Provisioning.Migrations/appsettings.json b/src/provisioning/Provisioning.Migrations/appsettings.json index 8e1e6adf19..c175f80d68 100644 --- a/src/provisioning/Provisioning.Migrations/appsettings.json +++ b/src/provisioning/Provisioning.Migrations/appsettings.json @@ -1,13 +1,10 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, "Serilog": { "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + "MinimumLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + }, "WriteTo": [ { "Name": "Console" } ], diff --git a/src/registration/Registration.Service/appsettings.json b/src/registration/Registration.Service/appsettings.json index ac25131090..1f605c2dbf 100644 --- a/src/registration/Registration.Service/appsettings.json +++ b/src/registration/Registration.Service/appsettings.json @@ -1,14 +1,11 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ "Serilog.Sinks.Console" ], + "MinimumLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console" ], - "MinimumLevel": "Information", + }, "WriteTo": [ { "Name": "Console" } ], From 45a131b81d32be44b894d95d026ef5c48fc746b9 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 31 Jul 2023 14:29:20 +0200 Subject: [PATCH 07/10] feat(audit): set lastEditorId when changing auditable entities (#147) * feat(audit): add IdentityService to get lastEditor * lastEditorId is now set whenever a auditable entity is changed * index for lastEditorId columns created * chore: remove manual set of lastEditorId * add technical user to run processes * feat(lastEditor): add seeding for technical user * chore: remove duplicate policy check Refs: CPLP-2960 --------- Co-authored-by: Norbert Truchsess Reviewed-By: Norbert Truchsess --- docker/Dockerfile-maintenance-service | 1 + docker/Dockerfile-portal-migrations | 1 + src/Portal.Backend.sln | 15 + .../BusinessLogic/CompanyDataBusinessLogic.cs | 2 - .../BusinessLogic/ConnectorsBusinessLogic.cs | 58 +- .../BusinessLogic/IConnectorsBusinessLogic.cs | 12 +- .../IIdentityProviderBusinessLogic.cs | 2 +- .../BusinessLogic/IInvitationBusinessLogic.cs | 2 +- ...ISubscriptionConfigurationBusinessLogic.cs | 4 +- .../BusinessLogic/IUserBusinessLogic.cs | 2 +- .../IdentityProviderBusinessLogic.cs | 16 +- .../BusinessLogic/InvitationBusinessLogic.cs | 7 +- .../SubscriptionConfigurationBusinessLogic.cs | 18 +- .../BusinessLogic/UserBusinessLogic.cs | 19 +- .../Controllers/CompanyDataController.cs | 3 - .../Controllers/ConnectorsController.cs | 6 +- .../Controllers/IdentityProviderController.cs | 2 +- .../Controllers/InvitationController.cs | 2 +- .../Controllers/RegistrationController.cs | 4 +- .../SubscriptionConfigurationController.cs | 2 +- .../Controllers/UserController.cs | 2 +- .../BusinessLogic/SdFactoryBusinessLogic.cs | 1 - .../Framework.DBAccess.csproj | 1 + ...cessIdentityServiceCollectionExtensions.cs | 37 + .../ProcessIdentitySettings.cs | 39 + .../Framework.ProcessIdentity.csproj | 35 + .../ProcessIdentityService.cs | 37 + .../Framework.Web/Framework.Web.csproj | 1 + .../Framework.Web/IdentityService.cs | 41 + .../Framework.Web/StartupServiceExtensions.cs | 3 +- .../StartupServiceWebApplicationExtensions.cs | 1 - .../ControllerExtensions.cs | 14 +- .../Maintenance.App/Maintenance.App.csproj | 1 + src/maintenance/Maintenance.App/Program.cs | 7 +- .../Maintenance.App/appsettings.json | 8 +- .../BusinessLogic/AppsBusinessLogic.cs | 5 +- .../BusinessLogic/IAppChangeBusinessLogic.cs | 2 +- .../Controllers/AppChangeController.cs | 1 + .../Offers.Library/Service/IOfferService.cs | 3 +- .../Offers.Library/Service/OfferService.cs | 1 + .../Service/OfferSetupService.cs | 1 - .../Service/OfferSubscriptionService.cs | 6 +- .../IServiceChangeBusinessLogic.cs | 2 +- .../IServiceReleaseBusinessLogic.cs | 2 +- .../Repositories/ConnectorsRepository.cs | 5 +- .../Repositories/ConsentRepository.cs | 2 - .../Repositories/IConnectorsRepository.cs | 3 +- .../IOfferSubscriptionsRepository.cs | 2 +- .../Repositories/IUserRepository.cs | 3 +- .../OfferSubscriptionsRepository.cs | 6 +- .../Repositories/UserRepository.cs | 9 +- ...91716_AddLastEditorConstraints.Designer.cs | 7197 +++++++++++++++++ ...20230727191716_AddLastEditorConstraints.cs | 335 + .../PortalDbContextModelSnapshot.cs | 120 + .../PortalBackend.Migrations.csproj | 1 + .../PortalBackend.Migrations/Program.cs | 2 + .../Seeder/Data/company_service_accounts.json | 8 + .../Seeder/Data/identities.json | 8 + .../PortalBackend.Migrations/appsettings.json | 6 + .../Entities/AppSubscriptionDetail.cs | 5 +- .../Entities/CompanyApplication.cs | 4 +- .../Entities/CompanyAssignedRole.cs | 3 +- .../Entities/CompanySsiDetail.cs | 3 +- .../Entities/CompanyUser.cs | 6 +- .../Entities/CompanyUserAssignedRole.cs | 4 +- .../Entities/Connector.cs | 2 +- .../Entities/Consent.cs | 3 +- .../Entities/Identity.cs | 6 +- .../Entities/Offer.cs | 4 +- .../Entities/OfferSubscription.cs | 6 +- .../Entities/ProviderCompanyDetail.cs | 3 +- .../Entities/UserRole.cs | 3 +- .../Identities/IIdentityService.cs | 29 + .../Identities}/IdentityData.cs | 2 +- .../PortalBackend.PortalEntities.csproj | 1 + .../PortalDbContext.cs | 42 +- .../Processes.Worker/Processes.Worker.csproj | 1 + src/processes/Processes.Worker/Program.cs | 6 +- .../Processes.Worker/appsettings.json | 6 + .../Models/CompanyNameIdpAliasData.cs | 2 +- .../Service/UserProvisioningService.cs | 11 +- .../RegistrationBusinessLogic.cs | 11 +- .../Controllers/RegistrationController.cs | 3 +- .../CompanyDataBusinessLogicTests.cs | 5 +- .../ConnectorsBusinessLogicTests.cs | 87 +- .../DocumentsBusinessLogicTests.cs | 1 + .../IdentityProviderBusinessLogicTests.cs | 20 +- .../InvitationBusinessLogicTests.cs | 15 +- .../ServiceAccountBusinessLogicTests.cs | 1 + ...criptionConfigurationBusinessLogicTests.cs | 12 +- .../BusinessLogic/UserBusinessLogicTests.cs | 12 +- .../UserUploadBusinessLogicTests.cs | 1 + .../Controllers/CompanyDataControllerTests.cs | 1 + .../Controllers/ConnectorsControllerTests.cs | 16 +- .../Controllers/DocumentsControllerTests.cs | 1 + .../Controllers/RegistrationControllerTest.cs | 5 +- .../ServiceAccountControllerTests.cs | 1 + ...ubscriptionConfigurationControllerTests.cs | 3 +- .../Controllers/UserControllerTest.cs | 1 + .../Setup/TestDbFixture.cs | 5 +- .../BusinessLogic/AppBusinessLogicTests.cs | 1 + .../AppChangeBusinessLogicTest.cs | 1 + .../AppReleaseBusinessLogicTest.cs | 1 + .../Controllers/AppChangeControllerTest.cs | 3 +- .../AppReleaseProcessControllerTest.cs | 1 + .../Controllers/AppsControllerTests.cs | 6 +- .../OfferDocumentServiceTests.cs | 2 +- .../Service/OfferServiceTests.cs | 1 + .../Service/OfferSetupServiceTests.cs | 7 +- .../Service/OfferSubscriptionServiceTests.cs | 23 +- .../ServiceBusinessLogicTests.cs | 1 + .../ServiceChangeBusinessLogicTests.cs | 2 +- .../ServiceReleaseBusinessLogicTest.cs | 1 + .../ServiceChangeControllerTest.cs | 2 +- .../Controllers/ServiceControllerTest.cs | 6 +- .../ServiceReleaseControllerTest.cs | 6 +- .../NotificationBusinessLogicTests.cs | 1 + .../Controllers/NotificationControllerTest.cs | 3 +- .../ApplicationChecklistRepositoryTests.cs | 2 +- .../ConnectorRepositoryTests.cs | 30 +- .../ConsentRepositoryTests.cs | 32 +- .../PortalDbContextTests.cs | 45 + .../ServiceAccountRespotitoryTests.cs | 4 +- .../Setup/TestDbFixture.cs | 5 +- .../ConsortiaDataDbFixture.cs | 5 +- ...UserProvisioningServiceCreateUsersTests.cs | 19 +- .../RegistrationBusinessLogicTest.cs | 15 +- .../Controller/RegistrationControllerTest.cs | 3 +- .../Extensions/ControllerExtensions.cs | 16 +- .../Tests.Shared/FakeIdentityService.cs} | 21 +- .../IntegrationTestFactory.cs | 7 + .../shared/Tests.Shared/TestSeeds/BaseSeed.cs | 18 +- tests/shared/Tests.Shared/Tests.Shared.csproj | 2 + 133 files changed, 8422 insertions(+), 359 deletions(-) create mode 100644 src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs create mode 100644 src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs create mode 100644 src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj create mode 100644 src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs create mode 100644 src/framework/Framework.Web/IdentityService.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs create mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs create mode 100644 src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs rename src/portalbackend/{PortalBackend.DBAccess/Models => PortalBackend.PortalEntities/Identities}/IdentityData.cs (92%) create mode 100644 tests/portalbackend/PortalBackend.DBAccess.Tests/PortalDbContextTests.cs rename tests/{portalbackend/PortalBackend.DBAccess.Tests/InMemoryDbContextFactory.cs => shared/Tests.Shared/FakeIdentityService.cs} (66%) diff --git a/docker/Dockerfile-maintenance-service b/docker/Dockerfile-maintenance-service index 9404302127..c8fbc7c185 100644 --- a/docker/Dockerfile-maintenance-service +++ b/docker/Dockerfile-maintenance-service @@ -30,6 +30,7 @@ COPY src/framework/Framework.Linq/ src/framework/Framework.Linq/ COPY src/framework/Framework.Models/ src/framework/Framework.Models/ COPY src/framework/Framework.Logging/ src/framework/Framework.Logging/ COPY src/framework/Framework.ErrorHandling.Library/ src/framework/Framework.ErrorHandling.Library/ +COPY src/framework/Framework.ProcessIdentity/ src/framework/Framework.ProcessIdentity/ RUN dotnet restore "src/maintenance/Maintenance.App/Maintenance.App.csproj" WORKDIR /src/maintenance/Maintenance.App RUN dotnet build "Maintenance.App.csproj" -c Release -o /app/build diff --git a/docker/Dockerfile-portal-migrations b/docker/Dockerfile-portal-migrations index e736286b56..04f73b1dd4 100644 --- a/docker/Dockerfile-portal-migrations +++ b/docker/Dockerfile-portal-migrations @@ -29,6 +29,7 @@ COPY /src/framework/Framework.Models /src/framework/Framework.Models COPY /src/framework/Framework.Linq /src/framework/Framework.Linq COPY /src/framework/Framework.ErrorHandling.Library /src/framework/Framework.ErrorHandling.Library COPY /src/framework/Framework.BaseDependencies /src/framework/Framework.BaseDependencies +COPY /src/framework/Framework.ProcessIdentity /src/framework/Framework.ProcessIdentity/ COPY /src/framework/Framework.Seeding /src/framework/Framework.Seeding WORKDIR /src/portalbackend/PortalBackend.Migrations RUN dotnet build "PortalBackend.Migrations.csproj" -c Release -o /migrations/build diff --git a/src/Portal.Backend.sln b/src/Portal.Backend.sln index 8ebfb4c400..b808785626 100644 --- a/src/Portal.Backend.sln +++ b/src/Portal.Backend.sln @@ -208,6 +208,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Authorization", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Models.Tests", "..\tests\framework\Framework.Models.Tests\Framework.Models.Tests.csproj", "{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.ProcessIdentity", "framework\Framework.ProcessIdentity\Framework.ProcessIdentity.csproj", "{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1298,6 +1300,18 @@ Global {EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x64.Build.0 = Release|Any CPU {EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x86.ActiveCfg = Release|Any CPU {EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x86.Build.0 = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x64.ActiveCfg = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x64.Build.0 = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x86.ActiveCfg = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x86.Build.0 = Debug|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|Any CPU.Build.0 = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x64.ActiveCfg = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x64.Build.0 = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.ActiveCfg = Release|Any CPU + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1396,5 +1410,6 @@ Global {1694E75F-ABCE-4573-B805-18ED50F148FD} = {323C198D-A8C6-4EB0-8B79-72624275E35F} {031237BF-7B2A-4B37-9E37-4D4C575FDD22} = {23500169-FC01-4D2B-A997-E7FAE2169FC0} {CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6} = {23500169-FC01-4D2B-A997-E7FAE2169FC0} + {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A} = {23500169-FC01-4D2B-A997-E7FAE2169FC0} EndGlobalSection EndGlobal diff --git a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs index 16116d6a85..4e1d8ad0db 100644 --- a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs @@ -412,7 +412,6 @@ public async Task ApproveCredential(Guid userId, Guid credentialId, Cancellation { c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.ACTIVE; c.DateLastChanged = _dateTimeProvider.OffsetNow; - c.LastEditorId = userId; }); switch (data.Kind) @@ -475,7 +474,6 @@ public async Task RejectCredential(Guid userId, Guid credentialId) { c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.INACTIVE; c.DateLastChanged = _dateTimeProvider.OffsetNow; - c.LastEditorId = userId; }); await _portalRepositories.SaveAsync().ConfigureAwait(false); diff --git a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs index 7a7a28ef1c..5cd9ee8183 100644 --- a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs @@ -114,16 +114,16 @@ public async Task GetCompanyConnectorData(Guid connectorId, Guid } /// - public Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + public Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken) { ValidateCertificationType(connectorInputModel.Certificate); - return CreateConnectorInternalAsync(connectorInputModel, identity, cancellationToken); + return CreateConnectorInternalAsync(connectorInputModel, companyId, cancellationToken); } - public Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + public Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken) { ValidateCertificationType(connectorInputModel.Certificate); - return CreateManagedConnectorInternalAsync(connectorInputModel, identity, cancellationToken); + return CreateManagedConnectorInternalAsync(connectorInputModel, companyId, cancellationToken); } private void ValidateCertificationType(IFormFile? certificate) @@ -135,45 +135,44 @@ private void ValidateCertificationType(IFormFile? certificate) } } - private async Task CreateConnectorInternalAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + private async Task CreateConnectorInternalAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken) { var (name, connectorUrl, location, certificate, technicalUserId) = connectorInputModel; await CheckLocationExists(location); var result = await _portalRepositories .GetInstance() - .GetCompanyBpnAndSelfDescriptionDocumentByIdAsync(identity.CompanyId) + .GetCompanyBpnAndSelfDescriptionDocumentByIdAsync(companyId) .ConfigureAwait(false); if (string.IsNullOrEmpty(result.Bpn)) { - throw new UnexpectedConditionException($"provider company {identity.CompanyId} has no businessPartnerNumber assigned"); + throw new UnexpectedConditionException($"provider company {companyId} has no businessPartnerNumber assigned"); } if (result.SelfDescriptionDocumentId is null) { - throw new UnexpectedConditionException($"provider company {identity.CompanyId} has no self description document"); + throw new UnexpectedConditionException($"provider company {companyId} has no self description document"); } - await ValidateTechnicalUser(technicalUserId, identity.CompanyId).ConfigureAwait(false); + await ValidateTechnicalUser(technicalUserId, companyId).ConfigureAwait(false); - var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.COMPANY_CONNECTOR, location, identity.CompanyId, identity.CompanyId, technicalUserId); + var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.COMPANY_CONNECTOR, location, companyId, companyId, technicalUserId); return await CreateAndRegisterConnectorAsync( connectorRequestModel, result.Bpn, result.SelfDescriptionDocumentId.Value, certificate, - identity.UserId, null, cancellationToken).ConfigureAwait(false); } - private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken) { var (name, connectorUrl, location, subscriptionId, certificate, technicalUserId) = connectorInputModel; await CheckLocationExists(location).ConfigureAwait(false); var result = await _portalRepositories.GetInstance() - .CheckOfferSubscriptionWithOfferProvider(subscriptionId, identity.CompanyId) + .CheckOfferSubscriptionWithOfferProvider(subscriptionId, companyId) .ConfigureAwait(false); if (!result.Exists) @@ -209,13 +208,12 @@ private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInp await ValidateTechnicalUser(technicalUserId, result.CompanyId).ConfigureAwait(false); - var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, result.CompanyId, identity.CompanyId, technicalUserId); + var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, result.CompanyId, companyId, technicalUserId); return await CreateAndRegisterConnectorAsync( connectorRequestModel, result.ProviderBpn, result.SelfDescriptionDocumentId!.Value, certificate, - identity.UserId, subscriptionId, cancellationToken).ConfigureAwait(false); } @@ -248,7 +246,6 @@ private async Task CreateAndRegisterConnectorAsync( string businessPartnerNumber, Guid selfDescriptionDocumentId, IFormFile? file, - Guid userId, Guid? subscriptionId, CancellationToken cancellationToken) { @@ -264,7 +261,6 @@ private async Task CreateAndRegisterConnectorAsync( connector.ProviderId = provider; connector.HostId = host; connector.TypeId = type; - connector.LastEditorId = userId; connector.DateLastChanged = DateTimeOffset.UtcNow; if (technicalUserId != null) { @@ -314,24 +310,29 @@ await _sdFactoryBusinessLogic } /// - public async Task DeleteConnectorAsync(Guid connectorId, Guid userId, CancellationToken cancellationToken) + public async Task DeleteConnectorAsync(Guid connectorId, Guid companyId, CancellationToken cancellationToken) { var connectorsRepository = _portalRepositories.GetInstance(); - var (isValidConnectorId, dapsClientId, selfDescriptionDocumentId, - documentStatus, connectorStatus, dapsRegistrationSuccess) = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId).ConfigureAwait(false); + var (isValidConnectorId, isProvidingOrHostCompany, dapsClientId, selfDescriptionDocumentId, + documentStatus, connectorStatus, dapsRegistrationSuccess) = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId, companyId).ConfigureAwait(false); if (!isValidConnectorId) { throw new NotFoundException($"Connector {connectorId} does not exist"); } + if (!isProvidingOrHostCompany) + { + throw new ForbiddenException($"company {companyId} is neither provider nor host-company of connector {connectorId}"); + } + switch ((dapsRegistrationSuccess ?? false, connectorStatus)) { case (true, ConnectorStatusId.ACTIVE) when selfDescriptionDocumentId == null: - await DeleteUpdateConnectorDetail(connectorId, userId, dapsClientId, connectorsRepository, cancellationToken); + await DeleteUpdateConnectorDetail(connectorId, dapsClientId, connectorsRepository, cancellationToken); break; case (true, ConnectorStatusId.ACTIVE) when selfDescriptionDocumentId != null && documentStatus != null: - await DeleteConnector(connectorId, userId, dapsClientId, selfDescriptionDocumentId.Value, documentStatus.Value, connectorsRepository, cancellationToken); + await DeleteConnector(connectorId, dapsClientId, selfDescriptionDocumentId.Value, documentStatus.Value, connectorsRepository, cancellationToken); break; case (false, ConnectorStatusId.PENDING) when selfDescriptionDocumentId == null: await DeleteConnectorWithoutDocuments(connectorId, connectorsRepository); @@ -346,17 +347,17 @@ public async Task DeleteConnectorAsync(Guid connectorId, Guid userId, Cancellati } } - private async Task DeleteConnector(Guid connectorId, Guid userId, string? dapsClientId, Guid selfDescriptionDocumentId, DocumentStatusId documentStatus, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken) + private async Task DeleteConnector(Guid connectorId, string? dapsClientId, Guid selfDescriptionDocumentId, DocumentStatusId documentStatus, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken) { _portalRepositories.GetInstance().AttachAndModifyDocument( selfDescriptionDocumentId, a => { a.DocumentStatusId = documentStatus; }, a => { a.DocumentStatusId = DocumentStatusId.INACTIVE; }); - await DeleteUpdateConnectorDetail(connectorId, userId, dapsClientId, connectorsRepository, cancellationToken); + await DeleteUpdateConnectorDetail(connectorId, dapsClientId, connectorsRepository, cancellationToken); } - private async Task DeleteUpdateConnectorDetail(Guid connectorId, Guid userId, string? dapsClientId, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken) + private async Task DeleteUpdateConnectorDetail(Guid connectorId, string? dapsClientId, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(dapsClientId)) { @@ -367,7 +368,6 @@ private async Task DeleteUpdateConnectorDetail(Guid connectorId, Guid userId, st connectorsRepository.AttachAndModifyConnector(connectorId, null, con => { con.StatusId = ConnectorStatusId.INACTIVE; - con.LastEditorId = userId; con.DateLastChanged = DateTimeOffset.UtcNow; }); await _dapsService.DeleteDapsClient(dapsClientId, cancellationToken).ConfigureAwait(false); @@ -437,7 +437,6 @@ public async Task TriggerDapsAsync(Guid connectorId, IFormFile certificate con.DapsRegistrationSuccessful = true; con.StatusId = ConnectorStatusId.ACTIVE; con.DateLastChanged = DateTimeOffset.UtcNow; - con.LastEditorId = identity.UserId; }); connectorsRepository.CreateConnectorClientDetails(connectorId, response.ClientId); @@ -520,7 +519,10 @@ private async Task UpdateConnectorUrlInternal(Guid connectorId, ConnectorUpdateR await _dapsService .UpdateDapsConnectorUrl(connector.DapsClientId, data.ConnectorUrl, bpn, cancellationToken) .ConfigureAwait(false); - connectorsRepository.AttachAndModifyConnector(connectorId, null, con => { con.ConnectorUrl = data.ConnectorUrl; }); + connectorsRepository.AttachAndModifyConnector(connectorId, null, con => + { + con.ConnectorUrl = data.ConnectorUrl; + }); await _portalRepositories.SaveAsync().ConfigureAwait(false); } diff --git a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs index 621c22f3cb..20a3b87e04 100644 --- a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs @@ -54,27 +54,27 @@ public interface IConnectorsBusinessLogic /// Add a connector to persistence layer and calls the sd factory service with connector parameters. /// /// Connector parameters for creation. - /// identity (userId and companyId) of the user + /// companyId of the user /// /// View model of created connector. - Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken); + Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken); /// /// Add a managed connector to persistence layer and calls the sd factory service with connector parameters. /// /// Connector parameters for creation. - /// identity (userId and companyId) of the user + /// companyId of the user /// /// View model of created connector. - Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken); + Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken); /// /// Remove a connector from persistence layer by id. /// /// ID of the connector to be deleted. - /// userId of the user + /// companyId of the user /// Cancellation Token - Task DeleteConnectorAsync(Guid connectorId, Guid userId, CancellationToken cancellationToken); + Task DeleteConnectorAsync(Guid connectorId, Guid companyId, CancellationToken cancellationToken); /// /// Retrieve connector end point along with bpns diff --git a/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs index 7851057064..1778037751 100644 --- a/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs @@ -34,7 +34,7 @@ public interface IIdentityProviderBusinessLogic ValueTask DeleteCompanyIdentityProviderAsync(Guid identityProviderId, Guid companyId); IAsyncEnumerable GetOwnCompanyUsersIdentityProviderDataAsync(IEnumerable identityProviderIds, Guid companyId, bool unlinkedUsersOnly); (Stream FileStream, string ContentType, string FileName, Encoding Encoding) GetOwnCompanyUsersIdentityProviderLinkDataStream(IEnumerable identityProviderIds, Guid companyId, bool unlinkedUsersOnly); - ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken); + ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken); ValueTask CreateOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, UserIdentityProviderLinkData identityProviderLinkData, Guid companyId); ValueTask CreateOrUpdateOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, Guid identityProviderId, UserLinkData userLinkData, Guid companyId); ValueTask GetOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, Guid identityProviderId, Guid companyId); diff --git a/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs index c4feb93a12..09cc651f22 100644 --- a/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs @@ -24,6 +24,6 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLog { public interface IInvitationBusinessLogic { - Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId); + Task ExecuteInvitation(CompanyInvitationData invitationData); } } diff --git a/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs index 1162a48dab..c2ee708094 100644 --- a/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs @@ -66,6 +66,6 @@ public interface ISubscriptionConfigurationBusinessLogic /// Sets service provider company details /// /// Detail data for the service provider - /// Id of the users and the users company - Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity); + /// Id of the users company + Task SetProviderCompanyDetailsAsync(ProviderDetailData data, Guid companyId); } diff --git a/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs index bb9625c82c..cbf8b21a2f 100644 --- a/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs @@ -47,7 +47,7 @@ public interface IUserBusinessLogic /// /// Task DeleteOwnUserAsync(Guid companyUserId, Guid userId); - IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, (Guid UserId, Guid CompanyId) identity); + IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, Guid companyId); Task ExecuteOwnCompanyUserPasswordReset(Guid companyUserId, (Guid UserId, Guid CompanyId) identity); Task> GetOwnCompanyAppUsersAsync(Guid appId, Guid userId, int page, int size, CompanyUserFilter filter); Task DeleteOwnUserBusinessPartnerNumbersAsync(Guid userId, string businessPartnerNumber, (Guid UserId, Guid CompanyId) identity); diff --git a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs index 16a60963b8..744cef0301 100644 --- a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs @@ -516,19 +516,19 @@ public async IAsyncEnumerable GetOwnCompanyUsersIdenti return (new AsyncEnumerableStringStream(GetOwnCompanyUsersIdentityProviderDataLines(identityProviderIds, unlinkedUsersOnly, companyId), csvSettings.Encoding), csvSettings.ContentType, csvSettings.FileName, csvSettings.Encoding); } - public ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + public ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken) { if (!document.ContentType.Equals(_settings.CsvSettings.ContentType, StringComparison.OrdinalIgnoreCase)) { throw new UnsupportedMediaTypeException($"Only contentType {_settings.CsvSettings.ContentType} files are allowed."); } - return UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(document, identity, cancellationToken); + return UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(document, companyId, cancellationToken); } - private async ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken) + private async ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken) { var userRepository = _portalRepositories.GetInstance(); - var (sharedIdpAlias, existingAliase) = await GetCompanyAliasDataAsync(identity.CompanyId).ConfigureAwait(false); + var (sharedIdpAlias, existingAliase) = await GetCompanyAliasDataAsync(companyId).ConfigureAwait(false); using var stream = document.OpenReadStream(); @@ -541,7 +541,7 @@ private async ValueTask UploadOwnCompanyUsersIdenti numIdps = ParseCSVFirstLineReturningNumIdps(line); }, line => ParseCSVLine(line, numIdps, existingAliase), - lines => ProcessOwnCompanyUsersIdentityProviderLinkDataInternalAsync(lines, userRepository, identity.CompanyId, sharedIdpAlias, identity.UserId, cancellationToken), + lines => ProcessOwnCompanyUsersIdentityProviderLinkDataInternalAsync(lines, userRepository, companyId, sharedIdpAlias, cancellationToken), cancellationToken ).ConfigureAwait(false); @@ -556,7 +556,6 @@ private async ValueTask UploadOwnCompanyUsersIdenti IUserRepository userRepository, Guid companyId, string? sharedIdpAlias, - Guid creatorId, [EnumeratorCancellation] CancellationToken cancellationToken) { await foreach (var (companyUserId, profile, identityProviderLinks) in userProfileLinkDatas) @@ -578,7 +577,7 @@ private async ValueTask UploadOwnCompanyUsersIdenti if (existingProfile != profile) { - await UpdateUserProfileAsync(userRepository, userEntityId, companyUserId, profile, existingLinks, sharedIdpAlias, creatorId).ConfigureAwait(false); + await UpdateUserProfileAsync(userRepository, userEntityId, companyUserId, profile, existingLinks, sharedIdpAlias).ConfigureAwait(false); updated = true; } success = updated; @@ -644,7 +643,7 @@ private async ValueTask UpdateIdentityProviderLinksAsync(string userEntity return true; } - private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, string userEntityId, Guid companyUserId, UserProfile profile, IEnumerable existingLinks, string? sharedIdpAlias, Guid creatorId) + private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, string userEntityId, Guid companyUserId, UserProfile profile, IEnumerable existingLinks, string? sharedIdpAlias) { var (firstName, lastName, email) = (profile.FirstName ?? "", profile.LastName ?? "", profile.Email ?? ""); @@ -663,7 +662,6 @@ private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, s companyUser.Firstname = profile.FirstName; companyUser.Lastname = profile.LastName; companyUser.Email = profile.Email; - companyUser.LastEditorId = creatorId; }); await _portalRepositories.SaveAsync().ConfigureAwait(false); } diff --git a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs index 65447652ae..af699f7a74 100644 --- a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs @@ -62,7 +62,7 @@ public InvitationBusinessLogic( _settings = settings.Value; } - public Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId) + public Task ExecuteInvitation(CompanyInvitationData invitationData) { if (string.IsNullOrWhiteSpace(invitationData.email)) { @@ -72,10 +72,10 @@ public Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId) { throw new ControllerArgumentException("organisationName must not be empty", "organisationName"); } - return ExecuteInvitationInternalAsync(invitationData, userId); + return ExecuteInvitationInternalAsync(invitationData); } - private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitationData, Guid userId) + private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitationData) { var idpName = await _provisioningManager.GetNextCentralIdentityProviderNameAsync().ConfigureAwait(false); await _provisioningManager.SetupSharedIdpAsync(idpName, invitationData.organisationName, _settings.InitialLoginTheme).ConfigureAwait(false); @@ -96,7 +96,6 @@ private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitati company.Id, company.Name, null, - userId, idpName, true ); diff --git a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs index 109dcb2524..049e25c8cd 100644 --- a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs @@ -59,7 +59,7 @@ public async Task GetProviderCompanyDetailsAsync(Guid } /// - public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity) + public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, Guid companyId) { data.Url.EnsureValidHttpsUrl(() => nameof(data.Url)); data.CallbackUrl?.EnsureValidHttpsUrl(() => nameof(data.CallbackUrl)); @@ -70,36 +70,35 @@ public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId "the maximum allowed length is 100 characters", nameof(data.Url)); } - return SetOfferProviderCompanyDetailsInternalAsync(data, identity); + return SetOfferProviderCompanyDetailsInternalAsync(data, companyId); } - private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity) + private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailData data, Guid companyId) { var companyRepository = _portalRepositories.GetInstance(); var providerDetailData = await companyRepository - .GetProviderCompanyDetailsExistsForUser(identity.CompanyId) + .GetProviderCompanyDetailsExistsForUser(companyId) .ConfigureAwait(false); if (providerDetailData == default) { var result = await companyRepository - .IsValidCompanyRoleOwner(identity.CompanyId, new[] { CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER }) + .IsValidCompanyRoleOwner(companyId, new[] { CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER }) .ConfigureAwait(false); if (!result.IsValidCompanyId) { - throw new ConflictException($"Company {identity.CompanyId} not found"); + throw new ConflictException($"Company {companyId} not found"); } if (!result.IsCompanyRoleOwner) { - throw new ForbiddenException($"Company {identity.CompanyId} is not an app- or service-provider"); + throw new ForbiddenException($"Company {companyId} is not an app- or service-provider"); } - companyRepository.CreateProviderCompanyDetail(identity.CompanyId, data.Url, providerDetails => + companyRepository.CreateProviderCompanyDetail(companyId, data.Url, providerDetails => { if (data.CallbackUrl != null) { providerDetails.AutoSetupCallbackUrl = data.CallbackUrl; } providerDetails.DateLastChanged = DateTimeOffset.UtcNow; - providerDetails.LastEditorId = identity.UserId; }); } else @@ -111,7 +110,6 @@ private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailDat { details.AutoSetupUrl = data.Url; details.DateLastChanged = DateTimeOffset.UtcNow; - details.LastEditorId = identity.UserId; }); } await _portalRepositories.SaveAsync().ConfigureAwait(false); diff --git a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs index 21d701710a..fb05c2bb6e 100644 --- a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs @@ -384,20 +384,20 @@ public async Task DeleteOwnUserAsync(Guid companyUserId, Guid userId) throw new ConflictException($"user {userId} does not exist"); } var (sharedIdpAlias, accountData) = iamIdpAliasAccountData; - await DeleteUserInternalAsync(sharedIdpAlias, accountData, userId).ConfigureAwait(false); + await DeleteUserInternalAsync(sharedIdpAlias, accountData).ConfigureAwait(false); return await _portalRepositories.SaveAsync().ConfigureAwait(false); } - public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, (Guid UserId, Guid CompanyId) identity) + public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, Guid companyId) { - var iamIdpAlias = await _portalRepositories.GetInstance().GetSharedIdentityProviderIamAliasDataUntrackedAsync(identity.CompanyId); + var iamIdpAlias = await _portalRepositories.GetInstance().GetSharedIdentityProviderIamAliasDataUntrackedAsync(companyId); - await foreach (var accountData in _portalRepositories.GetInstance().GetCompanyUserAccountDataUntrackedAsync(userIds, identity.CompanyId).ConfigureAwait(false)) + await foreach (var accountData in _portalRepositories.GetInstance().GetCompanyUserAccountDataUntrackedAsync(userIds, companyId).ConfigureAwait(false)) { var success = false; try { - await DeleteUserInternalAsync(iamIdpAlias, accountData, identity.UserId).ConfigureAwait(false); + await DeleteUserInternalAsync(iamIdpAlias, accountData).ConfigureAwait(false); success = true; } catch (Exception e) @@ -419,7 +419,7 @@ public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable await _portalRepositories.SaveAsync().ConfigureAwait(false); } - private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAccountData accountData, Guid administratorId) + private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAccountData accountData) { var (userId, userEntityId, businessPartnerNumbers, roleIds, offerIds, invitationIds) = accountData; if (userEntityId != null) @@ -434,16 +434,9 @@ private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAc i => { i.UserStatusId = UserStatusId.DELETED; - i.LastEditorId = administratorId; i.UserEntityId = null; }); - _portalRepositories.GetInstance().AttachAndModifyCompanyUser(userId, null, - i => - { - i.LastEditorId = administratorId; - }); - _portalRepositories.GetInstance() .DeleteCompanyUserAssignedBusinessPartners(businessPartnerNumbers.Select(bpn => (userId, bpn))); diff --git a/src/administration/Administration.Service/Controllers/CompanyDataController.cs b/src/administration/Administration.Service/Controllers/CompanyDataController.cs index b04159055e..33c41cbac0 100644 --- a/src/administration/Administration.Service/Controllers/CompanyDataController.cs +++ b/src/administration/Administration.Service/Controllers/CompanyDataController.cs @@ -147,7 +147,6 @@ public IAsyncEnumerable GetCompanyRoleAndConsentAgre [HttpPost] [Authorize(Roles = "view_company_data")] [Authorize(Policy = PolicyTypes.ValidIdentity)] - [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("companyRolesAndConsents")] [ProducesResponseType(typeof(NoContentResult), StatusCodes.Status204NoContent)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] @@ -212,7 +211,6 @@ public IAsyncEnumerable GetCertificateTypes() => [Consumes("multipart/form-data")] [Authorize(Roles = "request_ssicredential")] [Authorize(Policy = PolicyTypes.ValidIdentity)] - [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("useCaseParticipation")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task CreateUseCaseParticipation([FromForm] UseCaseParticipationCreationData data, CancellationToken cancellationToken) @@ -233,7 +231,6 @@ public async Task CreateUseCaseParticipation([FromForm] UseCase [Consumes("multipart/form-data")] [Authorize(Roles = "request_ssicredential")] [Authorize(Policy = PolicyTypes.ValidIdentity)] - [Authorize(Policy = PolicyTypes.ValidCompany)] [Route("certificates")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task CreateSsiCertificate([FromForm] SsiCertificateCreationData data, CancellationToken cancellationToken) diff --git a/src/administration/Administration.Service/Controllers/ConnectorsController.cs b/src/administration/Administration.Service/Controllers/ConnectorsController.cs index 0b1bf54823..a7c50ca0ce 100644 --- a/src/administration/Administration.Service/Controllers/ConnectorsController.cs +++ b/src/administration/Administration.Service/Controllers/ConnectorsController.cs @@ -125,7 +125,7 @@ public Task GetCompanyConnectorByIdForCurrentUserAsync([FromRoute [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)] public async Task CreateConnectorAsync([FromForm] ConnectorInputModel connectorInputModel, CancellationToken cancellationToken) { - var connectorId = await this.WithUserIdAndCompanyId(identity => _businessLogic.CreateConnectorAsync(connectorInputModel, identity, cancellationToken)).ConfigureAwait(false); + var connectorId = await this.WithCompanyId(companyId => _businessLogic.CreateConnectorAsync(connectorInputModel, companyId, cancellationToken)).ConfigureAwait(false); return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId); } @@ -149,7 +149,7 @@ public async Task CreateConnectorAsync([FromForm] Connecto [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)] public async Task CreateManagedConnectorAsync([FromForm] ManagedConnectorInputModel connectorInputModel, CancellationToken cancellationToken) { - var connectorId = await this.WithUserIdAndCompanyId(identity => _businessLogic.CreateManagedConnectorAsync(connectorInputModel, identity, cancellationToken)).ConfigureAwait(false); + var connectorId = await this.WithCompanyId(companyId => _businessLogic.CreateManagedConnectorAsync(connectorInputModel, companyId, cancellationToken)).ConfigureAwait(false); return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId); } @@ -198,7 +198,7 @@ public async Task TriggerDapsAuth([FromRoute] Guid connectorId, [FromForm] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] public async Task DeleteConnectorAsync([FromRoute] Guid connectorId, CancellationToken cancellationToken) { - await this.WithUserId(userId => _businessLogic.DeleteConnectorAsync(connectorId, userId, cancellationToken)); + await this.WithCompanyId(companyId => _businessLogic.DeleteConnectorAsync(connectorId, companyId, cancellationToken)); return NoContent(); } diff --git a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs index 870c3f593b..a7c6a3e72f 100644 --- a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs +++ b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs @@ -271,7 +271,7 @@ public IActionResult GetOwnCompanyUsersIdentityProviderFileAsync([FromQuery] IEn [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status415UnsupportedMediaType)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)] public ValueTask UploadOwnCompanyUsersIdentityProviderFileAsync([FromForm(Name = "document")] IFormFile document, CancellationToken cancellationToken) => - this.WithUserIdAndCompanyId(identity => _businessLogic.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(document, identity, cancellationToken)); + this.WithCompanyId(companyId => _businessLogic.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(document, companyId, cancellationToken)); /// /// Adds the user to the given identity provider diff --git a/src/administration/Administration.Service/Controllers/InvitationController.cs b/src/administration/Administration.Service/Controllers/InvitationController.cs index a1edb4f16d..75d0cfdc36 100644 --- a/src/administration/Administration.Service/Controllers/InvitationController.cs +++ b/src/administration/Administration.Service/Controllers/InvitationController.cs @@ -70,5 +70,5 @@ public InvitationController(IInvitationBusinessLogic logic) [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)] public Task ExecuteInvitation([FromBody] CompanyInvitationData invitationData) => - this.WithUserId(userId => _logic.ExecuteInvitation(invitationData, userId)); + _logic.ExecuteInvitation(invitationData); } diff --git a/src/administration/Administration.Service/Controllers/RegistrationController.cs b/src/administration/Administration.Service/Controllers/RegistrationController.cs index 6bea9cae63..614809088b 100644 --- a/src/administration/Administration.Service/Controllers/RegistrationController.cs +++ b/src/administration/Administration.Service/Controllers/RegistrationController.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; @@ -157,7 +158,8 @@ public async Task ApproveApplication([FromRoute] Guid applicati /// Either the CompanyApplication is not in status SUBMITTED, or there is no checklist entry of type Registration_Verification. /// Application ID not found. [HttpPost] - // [Authorize(Roles = "decline_new_partner")] + [Authorize(Roles = "decline_new_partner")] + [Authorize(Policy = PolicyTypes.ValidIdentity)] [Route("applications/{applicationId}/decline")] [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] diff --git a/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs b/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs index d923f7eaf4..ed5fc4b456 100644 --- a/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs +++ b/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs @@ -88,7 +88,7 @@ public Task GetServiceProviderCompanyDetail() => [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] public async Task SetProviderCompanyDetail([FromBody] ProviderDetailData data) { - await this.WithUserIdAndCompanyId(identity => _businessLogic.SetProviderCompanyDetailsAsync(data, identity)).ConfigureAwait(false); + await this.WithCompanyId(companyId => _businessLogic.SetProviderCompanyDetailsAsync(data, companyId)).ConfigureAwait(false); return NoContent(); } diff --git a/src/administration/Administration.Service/Controllers/UserController.cs b/src/administration/Administration.Service/Controllers/UserController.cs index 53bd500434..5fc2f4e2ca 100644 --- a/src/administration/Administration.Service/Controllers/UserController.cs +++ b/src/administration/Administration.Service/Controllers/UserController.cs @@ -312,7 +312,7 @@ public Task AddOwnCompanyUserBusinessPartnerNumber(Guid companyUserId, stri [ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] public IAsyncEnumerable DeleteOwnCompanyUsers([FromBody] IEnumerable usersToDelete) => - this.WithUserIdAndCompanyId(identity => _logic.DeleteOwnCompanyUsersAsync(usersToDelete, identity)); + this.WithCompanyId(companyId => _logic.DeleteOwnCompanyUsersAsync(usersToDelete, companyId)); /// /// Resets the password for the given user diff --git a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs index 78b7ebf02a..bb79494fd2 100644 --- a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs +++ b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs @@ -146,7 +146,6 @@ public async Task ProcessFinishSelfDescriptionLpForConnector(SelfDescriptionResp con.SelfDescriptionMessage = data.Message!; } - con.LastEditorId = companyUserId; con.DateLastChanged = DateTimeOffset.UtcNow; }); } diff --git a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj index 994a26d7fa..fe8fa9fa40 100644 --- a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj +++ b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj @@ -20,6 +20,7 @@ Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess + Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess net6.0 enable enable diff --git a/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs new file mode 100644 index 0000000000..1e524aad0e --- /dev/null +++ b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; + +public static class ProcessIdentityServiceCollectionExtensions +{ + public static IServiceCollection AddProcessIdentity(this IServiceCollection services, IConfigurationSection section) + { + services.AddOptions() + .Bind(section) + .ValidateOnStart(); + + return services.AddTransient(); + } +} diff --git a/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs new file mode 100644 index 0000000000..44c3701e29 --- /dev/null +++ b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs @@ -0,0 +1,39 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using System.ComponentModel.DataAnnotations; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; + +public class ProcessIdentitySettings +{ + [Required(AllowEmptyStrings = false)] + public string UserEntityId { get; set; } = null!; + + [Required] + public Guid ProcessUserId { get; set; } = Guid.Empty; + + [Required] + public IdentityTypeId IdentityTypeId { get; set; } = default; + + [Required] + public Guid ProcessUserCompanyId { get; set; } = Guid.Empty; +} diff --git a/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj b/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj new file mode 100644 index 0000000000..783236fbbc --- /dev/null +++ b/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj @@ -0,0 +1,35 @@ + + + + net6.0 + enable + enable + Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity + Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity + + + + + + + + + diff --git a/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs b/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs new file mode 100644 index 0000000000..c88571f949 --- /dev/null +++ b/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity; + +public class ProcessIdentityService : IIdentityService +{ + private readonly ProcessIdentitySettings _settings; + + public ProcessIdentityService(IOptions options) => + _settings = options.Value; + + /// + public IdentityData IdentityData => + new(_settings.UserEntityId, _settings.ProcessUserId, _settings.IdentityTypeId, _settings.ProcessUserCompanyId); +} diff --git a/src/framework/Framework.Web/Framework.Web.csproj b/src/framework/Framework.Web/Framework.Web.csproj index 74511500d8..d1b6ffea9b 100644 --- a/src/framework/Framework.Web/Framework.Web.csproj +++ b/src/framework/Framework.Web/Framework.Web.csproj @@ -20,6 +20,7 @@ Org.Eclipse.TractusX.Portal.Backend.Framework.Web + Org.Eclipse.TractusX.Portal.Backend.Framework.Web net6.0 enable enable diff --git a/src/framework/Framework.Web/IdentityService.cs b/src/framework/Framework.Web/IdentityService.cs new file mode 100644 index 0000000000..821a15f567 --- /dev/null +++ b/src/framework/Framework.Web/IdentityService.cs @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.AspNetCore.Http; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Web; + +public class IdentityService : IIdentityService +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + public IdentityService(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + + /// + public IdentityData IdentityData => + _httpContextAccessor.HttpContext?.User.GetIdentityData() ?? + throw new ConflictException("The identity should be set here"); +} diff --git a/src/framework/Framework.Web/StartupServiceExtensions.cs b/src/framework/Framework.Web/StartupServiceExtensions.cs index d8b5c7a05f..3a72ac80d8 100644 --- a/src/framework/Framework.Web/StartupServiceExtensions.cs +++ b/src/framework/Framework.Web/StartupServiceExtensions.cs @@ -30,6 +30,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Swagger; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.IdentityModel.Tokens.Jwt; using System.Text.Json.Serialization; @@ -91,8 +92,8 @@ public static IServiceCollection AddDefaultServices(this IServiceColle services.AddHealthChecks() .AddCheck("JwtBearerConfiguration", tags: new[] { "keycloak" }); - // This is needed for Serilog to access the request id services.AddHttpContextAccessor(); + services.AddScoped(); services.AddDateTimeProvider(); return services; diff --git a/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs b/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs index 46c618ef70..bc12ce44b3 100644 --- a/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs +++ b/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs @@ -33,7 +33,6 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Web; public static class StartupServiceWebApplicationExtensions { - public static WebApplication CreateApp(this WebApplication app, string apiPath, string version, IHostEnvironment environment) { app.UseSerilogRequestLogging(); diff --git a/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs b/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs index e0aab70dbc..34294cf968 100644 --- a/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs +++ b/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs @@ -21,8 +21,8 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Security.Claims; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; @@ -33,7 +33,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; public static class ControllerExtensions { public static T WithIdentityData(this ControllerBase controller, Func consumingFunction) => - consumingFunction(controller.GetIdentityData()); + consumingFunction(controller.User.GetIdentityData()); public static T WithUserId(this ControllerBase controller, Func consumingFunction) => consumingFunction(controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId)); @@ -50,12 +50,12 @@ public static T WithBearerToken(this ControllerBase controller, Func(this ControllerBase controller, Func<(Guid UserId, string BearerToken), T> tokenConsumingFunction) => tokenConsumingFunction((controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId), controller.GetBearerToken())); - private static IdentityData GetIdentityData(this ControllerBase controller) + public static IdentityData GetIdentityData(this ClaimsPrincipal user) { - var sub = controller.User.Claims.GetStringFromClaim(PortalClaimTypes.Sub); - var identityId = controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId); - var identityType = controller.User.Claims.GetEnumFromClaim(PortalClaimTypes.IdentityType); - var companyId = controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.CompanyId); + var sub = user.Claims.GetStringFromClaim(PortalClaimTypes.Sub); + var identityId = user.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId); + var identityType = user.Claims.GetEnumFromClaim(PortalClaimTypes.IdentityType); + var companyId = user.Claims.GetGuidFromClaim(PortalClaimTypes.CompanyId); return new IdentityData(sub, identityId, identityType, companyId); } diff --git a/src/maintenance/Maintenance.App/Maintenance.App.csproj b/src/maintenance/Maintenance.App/Maintenance.App.csproj index ca576c6fa9..997beda599 100644 --- a/src/maintenance/Maintenance.App/Maintenance.App.csproj +++ b/src/maintenance/Maintenance.App/Maintenance.App.csproj @@ -47,6 +47,7 @@ + diff --git a/src/maintenance/Maintenance.App/Program.cs b/src/maintenance/Maintenance.App/Program.cs index 5d1797482b..ab98591959 100644 --- a/src/maintenance/Maintenance.App/Program.cs +++ b/src/maintenance/Maintenance.App/Program.cs @@ -21,6 +21,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Maintenance.App; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Serilog; @@ -33,8 +34,10 @@ .UseSystemd() .ConfigureServices((hostContext, services) => { - services.AddDbContext(o => - o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb"))); + services + .AddProcessIdentity(hostContext.Configuration.GetSection("ProcessIdentity")) + .AddDbContext(o => + o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb"))); services.AddHostedService(); }) .AddLogging() diff --git a/src/maintenance/Maintenance.App/appsettings.json b/src/maintenance/Maintenance.App/appsettings.json index bcdea2d039..6c9bd4d060 100644 --- a/src/maintenance/Maintenance.App/appsettings.json +++ b/src/maintenance/Maintenance.App/appsettings.json @@ -24,5 +24,11 @@ "ConnectionStrings": { "PortalDb": "Server=placeholder;Database=placeholder;Port=5432;User Id=placeholder;Password=placeholder;Ssl Mode=Disable;" }, - "DeleteIntervalInDays": 80 + "DeleteIntervalInDays": 80, + "ProcessIdentity": { + "UserEntityId": "", + "ProcessUserId": "", + "IdentityTypeId": 0, + "ProcessUserCompanyId": "" + } } diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs index 1406a84305..176f8f6287 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs @@ -206,7 +206,10 @@ public async Task ActivateOwnCompanyProvidedAppSubscriptionAsync(Guid subscripti throw new ConflictException("App Name is not yet set."); } - offerSubscriptionRepository.AttachAndModifyOfferSubscription(subscriptionId, subscription => subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE); + offerSubscriptionRepository.AttachAndModifyOfferSubscription(subscriptionId, subscription => + { + subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE; + }); _portalRepositories.GetInstance().CreateNotification(requesterId, NotificationTypeId.APP_SUBSCRIPTION_ACTIVATION, false, diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs index c4eda4e06d..9a3cf710db 100644 --- a/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs +++ b/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs @@ -65,7 +65,7 @@ public interface IAppChangeBusinessLogic /// Deactivate Offer Status by appId /// /// Id of the app - /// Id of the Users company + /// CompanyId public Task DeactivateOfferByAppIdAsync(Guid appId, Guid companyId); /// diff --git a/src/marketplace/Apps.Service/Controllers/AppChangeController.cs b/src/marketplace/Apps.Service/Controllers/AppChangeController.cs index 737426d3f3..cc72f0d7b6 100644 --- a/src/marketplace/Apps.Service/Controllers/AppChangeController.cs +++ b/src/marketplace/Apps.Service/Controllers/AppChangeController.cs @@ -176,6 +176,7 @@ public async Task DeactivateApp([FromRoute] Guid appId) [Route("{appId}/subscription/{subscriptionId}/tenantUrl")] [Authorize(Roles = "edit_apps")] [Authorize(Policy = PolicyTypes.ValidCompany)] + [Authorize(Policy = PolicyTypes.ValidIdentity)] [ProducesResponseType(typeof(NoContentResult), StatusCodes.Status204NoContent)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] diff --git a/src/marketplace/Offers.Library/Service/IOfferService.cs b/src/marketplace/Offers.Library/Service/IOfferService.cs index 9930e27deb..42ecf0f045 100644 --- a/src/marketplace/Offers.Library/Service/IOfferService.cs +++ b/src/marketplace/Offers.Library/Service/IOfferService.cs @@ -23,6 +23,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; @@ -170,7 +171,7 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId, /// Deactivate the given offerStatus by offerId and offerType /// /// Id of the offer that should be Deactivate - /// Id of the users company + /// CompanyId of the user /// Type of the offer Task DeactivateOfferIdAsync(Guid offerId, Guid companyId, OfferTypeId offerTypeId); diff --git a/src/marketplace/Offers.Library/Service/OfferService.cs b/src/marketplace/Offers.Library/Service/OfferService.cs index 1fd71a4829..dc1eb7f774 100644 --- a/src/marketplace/Offers.Library/Service/OfferService.cs +++ b/src/marketplace/Offers.Library/Service/OfferService.cs @@ -31,6 +31,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Text.Json; namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; diff --git a/src/marketplace/Offers.Library/Service/OfferSetupService.cs b/src/marketplace/Offers.Library/Service/OfferSetupService.cs index 2dbfbe27b0..092aea2c19 100644 --- a/src/marketplace/Offers.Library/Service/OfferSetupService.cs +++ b/src/marketplace/Offers.Library/Service/OfferSetupService.cs @@ -83,7 +83,6 @@ public async Task AutoSetupOfferAsync(OfferAutoSetup offerSubscriptionsRepository.AttachAndModifyOfferSubscription(data.RequestId, subscription => { subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE; - subscription.LastEditorId = identity.UserId; }); if (offerDetails.InstanceData.IsSingleInstance) diff --git a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs index 5d462db2cc..7ecf9e37c3 100644 --- a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs +++ b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs @@ -58,7 +58,7 @@ public async Task AddOfferSubscriptionAsync(Guid offerId, IEnumerable(); var offerSubscription = offerTypeId == OfferTypeId.APP ? await HandleAppSubscriptionAsync(offerId, offerSubscriptionsRepository, companyInformation, identity.UserId).ConfigureAwait(false) - : offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, identity.UserId, identity.UserId); + : offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, identity.UserId); CreateProcessSteps(offerSubscription); CreateConsentsForSubscription(offerSubscription.Id, offerAgreementConsentData, companyInformation.CompanyId, identity.UserId); @@ -137,7 +137,7 @@ private static async Task HandleAppSubscriptionAsync( Guid offerId, IOfferSubscriptionsRepository offerSubscriptionsRepository, CompanyInformationData companyInformation, - Guid companyUserId) + Guid userId) { var activeOrPendingSubscriptionExists = await offerSubscriptionsRepository .CheckPendingOrActiveSubscriptionExists(offerId, companyInformation.CompanyId, OfferTypeId.APP) @@ -147,7 +147,7 @@ private static async Task HandleAppSubscriptionAsync( throw new ConflictException($"company {companyInformation.CompanyId} is already subscribed to {offerId}"); } - return offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, companyUserId, companyUserId); + return offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, userId); } private void CreateConsentsForSubscription(Guid offerSubscriptionId, IEnumerable offerAgreementConsentData, Guid companyId, Guid companyUserId) diff --git a/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs index 28bdc13225..1e40f046b4 100644 --- a/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs @@ -29,6 +29,6 @@ public interface IServiceChangeBusinessLogic /// Deactivate Offer Status by serviceId /// /// Id of the service - /// Id of the users company + /// CompanyId of the user public Task DeactivateOfferByServiceIdAsync(Guid serviceId, Guid companyId); } diff --git a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs index 1597e1ada5..3eb26ba49d 100644 --- a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs +++ b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs @@ -98,7 +98,7 @@ public interface IServiceReleaseBusinessLogic /// /// Id of the service to update /// Data of the updated entry - /// Id of the current users company + /// CompanyId of User Task UpdateServiceAsync(Guid serviceId, ServiceUpdateRequestData data, Guid companyId); /// diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs index 50105fbdda..141eaf798b 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs @@ -137,11 +137,12 @@ public Connector AttachAndModifyConnector(Guid connectorId, Action? i .SingleOrDefaultAsync(); /// - public Task<(bool IsValidConnectorId, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId) => + public Task<(bool IsValidConnectorId, bool IsProvidingOrHostCompany, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId, Guid companyId) => _context.Connectors .Where(x => x.Id == connectorId) - .Select(connector => new ValueTuple( + .Select(connector => new ValueTuple( true, + connector.ProviderId == companyId || connector.HostId == companyId, connector.ClientDetails == null ? null : connector.ClientDetails!.ClientId, connector.SelfDescriptionDocumentId, connector.SelfDescriptionDocument!.DocumentStatusId, diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs index 814b93b5de..af9277d240 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs @@ -99,7 +99,6 @@ public IEnumerable AddAttachAndModifyOfferConsents(IEnumerable { consent.ConsentStatusId = modify.ConsentStatusId; - consent.LastEditorId = companyUserId; }); public IEnumerable AddAttachAndModifyConsents(IEnumerable initialItems, IEnumerable<(Guid AgreementId, ConsentStatusId ConsentStatusId)> modifyItems, Guid companyId, Guid companyUserId, DateTimeOffset utcNow) => @@ -114,6 +113,5 @@ public IEnumerable AddAttachAndModifyConsents(IEnumerable { consent.ConsentStatusId = modify.ConsentStatusId; - consent.LastEditorId = companyUserId; }); } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs index 9d9f46e64f..43c38e20b1 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs @@ -85,8 +85,9 @@ public interface IConnectorsRepository /// Gets SelfDescriptionDocument Data /// /// Id of the connector + /// Id of the company /// returns SelfDescriptionDocument Data/c> - Task<(bool IsValidConnectorId, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId); + Task<(bool IsValidConnectorId, bool IsProvidingOrHostCompany, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId, Guid companyId); /// /// Creates the connector details diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs index 05ef228a42..acfb09a867 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs @@ -38,7 +38,7 @@ public interface IOfferSubscriptionsRepository /// id of the app subscription status /// id of the user that requested the subscription of the app /// id of the creator - OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId); + OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId); /// /// Gets the provided offer subscription statuses for the user and given company diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs index cb6907debb..855a3152b7 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs @@ -22,6 +22,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -31,7 +32,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositorie public interface IUserRepository { IAsyncEnumerable GetApplicationsWithStatusUntrackedAsync(Guid companyId); - CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email, Guid lastEditorId); + CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email); Identity CreateIdentity(Guid companyId, UserStatusId userStatusId); void AttachAndModifyCompanyUser(Guid companyUserId, Action? initialize, Action setOptionalParameters); IQueryable GetOwnCompanyUserQuery(Guid companyId, Guid? companyUserId = null, string? userEntityId = null, string? firstName = null, string? lastName = null, string? email = null, IEnumerable? statusIds = null); diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs index d6421ec9b4..3e111d2e53 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs @@ -43,8 +43,8 @@ public OfferSubscriptionsRepository(PortalDbContext portalDbContext) } /// - public OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId) => - _context.OfferSubscriptions.Add(new OfferSubscription(Guid.NewGuid(), offerId, companyId, offerSubscriptionStatusId, requesterId, creatorId)).Entity; + public OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) => + _context.OfferSubscriptions.Add(new OfferSubscription(Guid.NewGuid(), offerId, companyId, offerSubscriptionStatusId, requesterId)).Entity; /// public Func?>> GetOwnCompanyProvidedOfferSubscriptionStatusesUntrackedAsync(Guid userCompanyId, OfferTypeId offerTypeId, SubscriptionStatusSorting? sorting, IEnumerable statusIds, Guid? offerId) => @@ -169,7 +169,7 @@ public Task CheckPendingOrActiveSubscriptionExists(Guid offerId, Guid comp /// public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscriptionId, Action setOptionalParameters) { - var offerSubscription = _context.Attach(new OfferSubscription(offerSubscriptionId, Guid.Empty, Guid.Empty, default, Guid.Empty, Guid.Empty)).Entity; + var offerSubscription = _context.Attach(new OfferSubscription(offerSubscriptionId, Guid.Empty, Guid.Empty, default, Guid.Empty)).Entity; setOptionalParameters.Invoke(offerSubscription); return offerSubscription; } diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs index 7abf3db99f..9fcb030f03 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -53,8 +54,8 @@ public IAsyncEnumerable GetApplicationsWithStatusU }) .AsAsyncEnumerable(); - public CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email, Guid lastEditorId) => - _dbContext.CompanyUsers.Add(new CompanyUser(identityId, lastEditorId) + public CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email) => + _dbContext.CompanyUsers.Add(new CompanyUser(identityId) { Firstname = firstName, Lastname = lastName, @@ -73,9 +74,7 @@ public Identity CreateIdentity(Guid companyId, UserStatusId userStatusId) => public void AttachAndModifyCompanyUser(Guid companyUserId, Action? initialize, Action setOptionalParameters) { - var companyUser = new CompanyUser(companyUserId, - // Guid.Empty, default, default, - Guid.Empty); + var companyUser = new CompanyUser(companyUserId); initialize?.Invoke(companyUser); var updatedEntity = _dbContext.Attach(companyUser).Entity; setOptionalParameters.Invoke(updatedEntity); diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs new file mode 100644 index 0000000000..c7afaa442c --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs @@ -0,0 +1,7197 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + [DbContext(typeof(PortalDbContext))] + [Migration("20230727191716_AddLastEditorConstraints")] + partial class AddLastEditorConstraints + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("portal") + .UseCollation("en_US.utf8") + .HasAnnotation("ProductVersion", "6.0.7") + .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.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.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.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.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.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.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.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.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"); + + 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("AgreementType") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("agreement_type"); + + 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("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("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.AppAssignedUseCase", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("AppId", "UseCaseId") + .HasName("pk_app_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .HasDatabaseName("ix_app_assigned_use_cases_use_case_id"); + + b.ToTable("app_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("IamClientId") + .HasColumnType("uuid") + .HasColumnName("iam_client_id"); + + b.HasKey("Id") + .HasName("pk_app_instances"); + + b.HasIndex("AppId") + .HasDatabaseName("ix_app_instances_app_id"); + + b.HasIndex("IamClientId") + .HasDatabaseName("ix_app_instances_iam_client_id"); + + b.ToTable("app_instances", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.Property("AppInstanceId") + .HasColumnType("uuid") + .HasColumnName("app_instance_id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.HasKey("AppInstanceId", "CompanyServiceAccountId") + .HasName("pk_app_instance_assigned_service_accounts"); + + b.HasIndex("CompanyServiceAccountId") + .HasDatabaseName("ix_app_instance_assigned_service_accounts_company_service_acco"); + + b.ToTable("app_instance_assigned_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("InstanceUrl") + .HasColumnType("text") + .HasColumnName("instance_url"); + + b.Property("IsSingleInstance") + .HasColumnType("boolean") + .HasColumnName("is_single_instance"); + + b.HasKey("Id") + .HasName("pk_app_instance_setups"); + + b.HasIndex("AppId") + .IsUnique() + .HasDatabaseName("ix_app_instance_setups_app_id"); + + b.ToTable("app_instance_setups", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.Property("AppId") + .HasColumnType("uuid") + .HasColumnName("app_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.HasKey("AppId", "LanguageShortName") + .HasName("pk_app_languages"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_app_languages_language_short_name"); + + b.ToTable("app_languages", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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" + }); + }); + + 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 = "CLEARING_HOUSE" + }, + new + { + Id = 5, + Label = "SELF_DESCRIPTION_LP" + }, + new + { + Id = 6, + Label = "APPLICATION_ACTIVATION" + }); + }); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_app_subscription_detail20221118 (\"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 OLD.id, \r\n OLD.offer_subscription_id, \r\n OLD.app_instance_id, \r\n OLD.app_subscription_url, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL AFTER DELETE\r\nON portal.app_subscription_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL();") + .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_detail20221118 (\"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_DATE, \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_detail20221118 (\"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_DATE, \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.AuditCompanySsiDetail20230621", 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("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_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("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_use_case_detail_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_company_ssi_detail20230621"); + + b.ToTable("audit_company_ssi_detail20230621", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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"); + + b.HasKey("AuditV1Id") + .HasName("pk_audit_identity20230526"); + + b.ToTable("audit_identity20230526", "portal"); + }); + + 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("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + 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("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("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_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("CompanyId") + .HasDatabaseName("ix_company_applications_company_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_applications_last_editor_id"); + + b.ToTable("company_applications", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$\r\nBEGIN\r\n INSERT INTO portal.audit_company_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.date_created, \r\n OLD.date_last_changed, \r\n OLD.application_status_id, \r\n OLD.company_id, \r\n OLD.checklist_process_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION AFTER DELETE\r\nON portal.company_applications\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION();") + .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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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" + }); + }); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.company_id, \r\n OLD.company_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE AFTER DELETE\r\nON portal.company_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE();") + .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_DATE, \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_DATE, \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.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.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" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("UserRoleCollectionId") + .HasColumnType("uuid") + .HasColumnName("user_role_collection_id"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_assigned_role_collections"); + + b.HasIndex("UserRoleCollectionId") + .IsUnique() + .HasDatabaseName("ix_company_role_assigned_role_collections_user_role_collection"); + + b.ToTable("company_role_assigned_role_collections", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleDescription", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.HasKey("CompanyRoleId", "LanguageShortName") + .HasName("pk_company_role_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_company_role_descriptions_language_short_name"); + + b.ToTable("company_role_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.Property("CompanyRoleId") + .HasColumnType("integer") + .HasColumnName("company_role_id"); + + b.Property("IsRegistrationRole") + .HasColumnType("boolean") + .HasColumnName("is_registration_role"); + + b.HasKey("CompanyRoleId") + .HasName("pk_company_role_registration_data"); + + b.ToTable("company_role_registration_data", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Property("Id") + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ClientClientId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("client_client_id"); + + b.Property("ClientId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("client_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.HasKey("Id") + .HasName("pk_company_service_accounts"); + + b.HasIndex("ClientClientId") + .IsUnique() + .HasDatabaseName("ix_company_service_accounts_client_client_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.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.CompanySsiDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CompanySsiDetailStatusId") + .HasColumnType("integer") + .HasColumnName("company_ssi_detail_status_id"); + + b.Property("CreatorUserId") + .HasColumnType("uuid") + .HasColumnName("creator_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("DocumentId") + .HasColumnType("uuid") + .HasColumnName("document_id"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasColumnType("uuid") + .HasColumnName("verified_credential_external_type_use_case_detail_id"); + + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.HasKey("Id") + .HasName("pk_company_ssi_details"); + + b.HasIndex("CompanyId") + .HasDatabaseName("ix_company_ssi_details_company_id"); + + b.HasIndex("CompanySsiDetailStatusId") + .HasDatabaseName("ix_company_ssi_details_company_ssi_detail_status_id"); + + b.HasIndex("CreatorUserId") + .HasDatabaseName("ix_company_ssi_details_creator_user_id"); + + b.HasIndex("DocumentId") + .IsUnique() + .HasDatabaseName("ix_company_ssi_details_document_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_ssi_details_last_editor_id"); + + b.HasIndex("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_external_type_use_c"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_company_ssi_details_verified_credential_type_id"); + + b.ToTable("company_ssi_details", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.verified_credential_type_id, \r\n OLD.company_ssi_detail_status_id, \r\n OLD.document_id, \r\n OLD.date_created, \r\n OLD.creator_user_id, \r\n OLD.expiry_date, \r\n OLD.verified_credential_external_type_use_case_detail_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL AFTER DELETE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL();") + .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL AFTER INSERT\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL();") + .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL AFTER UPDATE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL();"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", 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_ssi_detail_statuses"); + + b.ToTable("company_ssi_detail_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.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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYUSER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.id, \r\n OLD.email, \r\n OLD.firstname, \r\n OLD.lastlogin, \r\n OLD.lastname, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYUSER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYUSER AFTER DELETE\r\nON portal.company_users\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER();") + .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_DATE, \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_DATE, \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.Connector", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("company_service_account_id"); + + b.Property("ConnectorUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("connector_url"); + + b.Property("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("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("SelfDescriptionDocumentId") + .HasColumnType("uuid") + .HasColumnName("self_description_document_id"); + + b.Property("SelfDescriptionMessage") + .HasColumnType("text") + .HasColumnName("self_description_message"); + + b.Property("StatusId") + .HasColumnType("integer") + .HasColumnName("status_id"); + + b.Property("TypeId") + .HasColumnType("integer") + .HasColumnName("type_id"); + + b.HasKey("Id") + .HasName("pk_connectors"); + + b.HasIndex("CompanyServiceAccountId") + .IsUnique() + .HasDatabaseName("ix_connectors_company_service_account_id"); + + b.HasIndex("HostId") + .HasDatabaseName("ix_connectors_host_id"); + + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_connectors_last_editor_id"); + + b.HasIndex("LocationId") + .HasDatabaseName("ix_connectors_location_id"); + + b.HasIndex("ProviderId") + .HasDatabaseName("ix_connectors_provider_id"); + + b.HasIndex("SelfDescriptionDocumentId") + .IsUnique() + .HasDatabaseName("ix_connectors_self_description_document_id"); + + b.HasIndex("StatusId") + .HasDatabaseName("ix_connectors_status_id"); + + b.HasIndex("TypeId") + .HasDatabaseName("ix_connectors_type_id"); + + b.ToTable("connectors", "portal"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONNECTOR", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.daps_registration_successful, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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.ConnectorClientDetail", b => + { + b.Property("ConnectorId") + .HasColumnType("uuid") + .HasColumnName("connector_id"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("client_id"); + + b.HasKey("ConnectorId") + .HasName("pk_connector_client_details"); + + b.ToTable("connector_client_details", "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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONSENT", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONSENT() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONSENT$\r\nBEGIN\r\n INSERT INTO portal.audit_consent20230412 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.comment, \r\n OLD.consent_status_id, \r\n OLD.target, \r\n OLD.agreement_id, \r\n OLD.company_id, \r\n OLD.document_id, \r\n OLD.company_user_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONSENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONSENT AFTER DELETE\r\nON portal.consents\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONSENT();") + .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_consent20230412 (\"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_DATE, \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_consent20230412 (\"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_DATE, \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(); + + b.Property("Alpha3Code") + .HasMaxLength(3) + .HasColumnType("character(3)") + .HasColumnName("alpha3code") + .IsFixedLength(); + + b.Property("CountryNameDe") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("country_name_de"); + + b.Property("CountryNameEn") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("country_name_en"); + + 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"); + + 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.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("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("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"); + }); + + 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" + }); + }); + + 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.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"); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITY", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITY() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_IDENTITY$\r\nBEGIN\r\n INSERT INTO portal.audit_identity20230526 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.company_id, \r\n OLD.user_status_id, \r\n OLD.user_entity_id, \r\n OLD.identity_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITY$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITY AFTER DELETE\r\nON portal.identities\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITY();") + .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_identity20230526 (\"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_DATE, \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_identity20230526 (\"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_DATE, \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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.identity_id, \r\n OLD.user_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE AFTER DELETE\r\nON portal.identity_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE();") + .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_DATE, \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_DATE, \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.HasKey("Id") + .HasName("pk_identity_providers"); + + b.HasIndex("IdentityProviderCategoryId") + .HasDatabaseName("ix_identity_providers_identity_provider_category_id"); + + b.ToTable("identity_providers", "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 = 1, + Label = "KEYCLOAK_SHARED" + }, + new + { + Id = 2, + Label = "KEYCLOAK_OIDC" + }, + new + { + Id = 3, + Label = "KEYCLOAK_SAML" + }); + }); + + 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" + }); + }); + + 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.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.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" + }); + }); + + 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("Provider") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("provider"); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFER$\r\nBEGIN\r\n INSERT INTO portal.audit_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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 OLD.id, \r\n OLD.name, \r\n OLD.date_created, \r\n OLD.date_released, \r\n OLD.marketing_url, \r\n OLD.contact_email, \r\n OLD.contact_number, \r\n OLD.provider, \r\n OLD.offer_type_id, \r\n OLD.sales_manager_id, \r\n OLD.provider_company_id, \r\n OLD.offer_status_id, \r\n OLD.license_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFER AFTER DELETE\r\nON portal.offers\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFER();") + .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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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("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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$\r\nBEGIN\r\n INSERT INTO portal.audit_offer_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.offer_id, \r\n OLD.offer_subscription_status_id, \r\n OLD.display_name, \r\n OLD.description, \r\n OLD.requester_id, \r\n OLD.last_editor_id, \r\n OLD.process_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION AFTER DELETE\r\nON portal.offer_subscriptions\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION();") + .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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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("OfferSubscriptionId") + .HasColumnType("uuid") + .HasColumnName("offer_subscription_id"); + + b.Property("OfferUrl") + .IsRequired() + .HasColumnType("text") + .HasColumnName("offer_url"); + + b.HasKey("OfferSubscriptionId") + .HasName("pk_offer_subscriptions_process_datas"); + + 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"); + + 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.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 = "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 = "END_CLEARING_HOUSE" + }, + 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 = 15, + Label = "OVERRIDE_BUSINESS_PARTNER_NUMBER" + }, + new + { + Id = 16, + Label = "TRIGGER_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 17, + Label = "START_OVERRIDE_CLEARING_HOUSE" + }, + new + { + Id = 18, + Label = "FINISH_SELF_DESCRIPTION_LP" + }, + new + { + Id = 19, + Label = "DECLINE_APPLICATION" + }, + new + { + Id = 100, + Label = "TRIGGER_PROVIDER" + }, + new + { + Id = 101, + Label = "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" + }); + }); + + 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" + }); + }); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_provider_company_detail20230614 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.auto_setup_url, \r\n OLD.auto_setup_callback_url, \r\n OLD.company_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL AFTER DELETE\r\nON portal.provider_company_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL();") + .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_detail20230614 (\"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_DATE, \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_detail20230614 (\"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_DATE, \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 = "CONSULTANCE_SERVICE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.HasKey("Id") + .HasName("pk_technical_user_profiles"); + + b.HasIndex("OfferId") + .HasDatabaseName("ix_technical_user_profiles_offer_id"); + + b.ToTable("technical_user_profiles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => + { + b.Property("TechnicalUserProfileId") + .HasColumnType("uuid") + .HasColumnName("technical_user_profile_id"); + + b.Property("UserRoleId") + .HasColumnType("uuid") + .HasColumnName("user_role_id"); + + b.HasKey("TechnicalUserProfileId", "UserRoleId") + .HasName("pk_technical_user_profile_assigned_user_roles"); + + b.HasIndex("UserRoleId") + .HasDatabaseName("ix_technical_user_profile_assigned_user_roles_user_role_id"); + + b.ToTable("technical_user_profile_assigned_user_roles", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_unique_identifiers"); + + b.ToTable("unique_identifiers", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "COMMERCIAL_REG_NUMBER" + }, + new + { + Id = 2, + Label = "VAT_ID" + }, + new + { + Id = 3, + Label = "LEI_CODE" + }, + new + { + Id = 4, + Label = "VIES" + }, + new + { + Id = 5, + Label = "EORI" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Shortname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("shortname"); + + b.HasKey("Id") + .HasName("pk_use_cases"); + + b.ToTable("use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCaseDescription", b => + { + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.Property("LanguageShortName") + .HasMaxLength(2) + .HasColumnType("character(2)") + .HasColumnName("language_short_name"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasColumnName("description"); + + b.HasKey("UseCaseId", "LanguageShortName") + .HasName("pk_use_case_descriptions"); + + b.HasIndex("LanguageShortName") + .HasDatabaseName("ix_use_case_descriptions_language_short_name"); + + b.ToTable("use_case_descriptions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("LastEditorId") + .HasColumnType("uuid") + .HasColumnName("last_editor_id"); + + b.Property("OfferId") + .HasColumnType("uuid") + .HasColumnName("offer_id"); + + b.Property("UserRoleText") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_role"); + + 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"); + + b + .HasAnnotation("LC_TRIGGER_AFTER_DELETE_USERROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_USERROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_USERROLE$\r\nBEGIN\r\n INSERT INTO portal.audit_user_role20221017 (\"id\", \"user_role\", \"offer_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.user_role, \r\n OLD.offer_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_USERROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_USERROLE AFTER DELETE\r\nON portal.user_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_USERROLE();") + .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_role20221017 (\"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_DATE, \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_role20221017 (\"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_DATE, \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.Entities.VerifiedCredentialExternalType", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text") + .HasColumnName("label"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_types"); + + b.ToTable("verified_credential_external_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_CREDENTIAL" + }, + new + { + Id = 2, + Label = "PCF_CREDENTIAL" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_CREDENTIAL" + }, + new + { + Id = 4, + Label = "VEHICLE_DISMANTLE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Expiry") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry"); + + b.Property("Template") + .IsRequired() + .HasColumnType("text") + .HasColumnName("template"); + + b.Property("ValidFrom") + .HasColumnType("timestamp with time zone") + .HasColumnName("valid_from"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id") + .HasName("pk_verified_credential_external_type_use_case_detail_versions"); + + b.HasIndex("VerifiedCredentialExternalTypeId", "Version") + .IsUnique() + .HasDatabaseName("ix_verified_credential_external_type_use_case_detail_versions_"); + + b.ToTable("verified_credential_external_type_use_case_detail_versions", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", 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_verified_credential_types"); + + b.ToTable("verified_credential_types", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "TRACEABILITY_FRAMEWORK" + }, + new + { + Id = 2, + Label = "PCF_FRAMEWORK" + }, + new + { + Id = 3, + Label = "BEHAVIOR_TWIN_FRAMEWORK" + }, + new + { + Id = 4, + Label = "DISMANTLER_CERTIFICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialExternalTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_external_type_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialExternalTypeId") + .HasName("pk_verified_credential_type_assigned_external_types"); + + b.HasIndex("VerifiedCredentialExternalTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c1"); + + b.ToTable("verified_credential_type_assigned_external_types", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("VerifiedCredentialTypeKindId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_kind_id"); + + b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialTypeKindId") + .HasName("pk_verified_credential_type_assigned_kinds"); + + b.HasIndex("VerifiedCredentialTypeId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasIndex("VerifiedCredentialTypeKindId") + .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential1"); + + b.ToTable("verified_credential_type_assigned_kinds", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.Property("VerifiedCredentialTypeId") + .HasColumnType("integer") + .HasColumnName("verified_credential_type_id"); + + b.Property("UseCaseId") + .HasColumnType("uuid") + .HasColumnName("use_case_id"); + + b.HasKey("VerifiedCredentialTypeId", "UseCaseId") + .HasName("pk_verified_credential_type_assigned_use_cases"); + + b.HasIndex("UseCaseId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_use_case_id"); + + b.HasIndex("VerifiedCredentialTypeId") + .IsUnique() + .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_verified_creden"); + + b.ToTable("verified_credential_type_assigned_use_cases", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", 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_verified_credential_type_kinds"); + + b.ToTable("verified_credential_type_kinds", "portal"); + + b.HasData( + new + { + Id = 1, + Label = "USE_CASE" + }, + new + { + Id = 2, + Label = "CERTIFICATE" + }); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.Property("ServiceAccountId") + .HasColumnType("uuid") + .HasColumnName("service_account_id"); + + b.Property("Owners") + .HasColumnType("uuid") + .HasColumnName("owners"); + + b.Property("Provider") + .HasColumnType("uuid") + .HasColumnName("provider"); + + b.HasKey("ServiceAccountId"); + + b.ToTable((string)null); + + b.ToView("company_linked_service_accounts", "portal"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.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_temp_id"); + + 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.Document", "Document") + .WithMany("Agreements") + .HasForeignKey("DocumentId") + .HasConstraintName("fk_agreements_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "IssuerCompany") + .WithMany("Agreements") + .HasForeignKey("IssuerCompanyId") + .IsRequired() + .HasConstraintName("fk_agreements_companies_issuer_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany("Agreements") + .HasForeignKey("UseCaseId") + .HasConstraintName("fk_agreements_use_cases_use_case_id"); + + b.Navigation("AgreementCategory"); + + b.Navigation("Document"); + + b.Navigation("IssuerCompany"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedCompanyRole", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithMany("AgreementAssignedCompanyRoles") + .HasForeignKey("CompanyRoleId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_company_roles_company_roles_company_role"); + + b.Navigation("Agreement"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOffer", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") + .WithMany("AgreementAssignedOffers") + .HasForeignKey("OfferId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offers_offers_offer_id"); + + b.Navigation("Agreement"); + + b.Navigation("Offer"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOfferType", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("AgreementId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_agreements_agreement_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", "OfferType") + .WithMany("AgreementAssignedOfferTypes") + .HasForeignKey("OfferTypeId") + .IsRequired() + .HasConstraintName("fk_agreement_assigned_offer_types_offer_types_offer_type_id"); + + b.Navigation("Agreement"); + + b.Navigation("OfferType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithMany() + .HasForeignKey("UseCaseId") + .IsRequired() + .HasConstraintName("fk_app_assigned_use_cases_use_cases_use_case_id"); + + b.Navigation("App"); + + b.Navigation("UseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany("AppInstances") + .HasForeignKey("AppId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", "IamClient") + .WithMany("AppInstances") + .HasForeignKey("IamClientId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_app_instances_iam_clients_iam_client_id"); + + b.Navigation("App"); + + b.Navigation("IamClient"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", "AppInstance") + .WithMany("ServiceAccounts") + .HasForeignKey("AppInstanceId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_app_instances_app_in"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithMany("AppInstances") + .HasForeignKey("CompanyServiceAccountId") + .IsRequired() + .HasConstraintName("fk_app_instance_assigned_service_accounts_company_service_acco"); + + b.Navigation("AppInstance"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithOne("AppInstanceSetup") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", "AppId") + .IsRequired() + .HasConstraintName("fk_app_instance_setups_offers_app_id"); + + b.Navigation("App"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") + .WithMany() + .HasForeignKey("AppId") + .IsRequired() + .HasConstraintName("fk_app_languages_offers_app_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") + .WithMany() + .HasForeignKey("LanguageShortName") + .IsRequired() + .HasConstraintName("fk_app_languages_languages_language_temp_id"); + + b.Navigation("App"); + + b.Navigation("Language"); + }); + + 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.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.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.Document", "SelfDescriptionDocument") + .WithMany("Companies") + .HasForeignKey("SelfDescriptionDocumentId") + .HasConstraintName("fk_companies_documents_self_description_document_id"); + + b.Navigation("Address"); + + b.Navigation("CompanyStatus"); + + 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.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.Navigation("ApplicationStatus"); + + b.Navigation("ChecklistProcess"); + + b.Navigation("Company"); + + b.Navigation("LastEditor"); + }); + + 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.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") + .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") + .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.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_temp_id1"); + + b.Navigation("CompanyRole"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") + .WithOne("CompanyRoleRegistrationData") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", "CompanyRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_role_registration_data_company_roles_company_role_id"); + + b.Navigation("CompanyRole"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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_identity_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("CompanyServiceAccountType"); + + b.Navigation("Identity"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("CompanySsiDetails") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", "CompanySsiDetailStatus") + .WithMany("CompanySsiDetails") + .HasForeignKey("CompanySsiDetailStatusId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_company_ssi_detail_statuses_company_ssi"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CreatorUser") + .WithMany("CompanySsiDetails") + .HasForeignKey("CreatorUserId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_company_users_creator_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") + .WithOne("CompanySsiDetail") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", "DocumentId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_documents_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_company_ssi_details_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", "VerifiedCredentialExternalTypeUseCaseDetailVersion") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialExternalTypeUseCaseDetailId") + .HasConstraintName("fk_company_ssi_details_verified_credential_external_type_use_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithMany("CompanySsiDetails") + .HasForeignKey("VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_company_ssi_details_verified_credential_types_verified_cred"); + + b.Navigation("Company"); + + b.Navigation("CompanySsiDetailStatus"); + + b.Navigation("CreatorUser"); + + b.Navigation("Document"); + + b.Navigation("LastEditor"); + + b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersion"); + + b.Navigation("VerifiedCredentialType"); + }); + + 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_identity_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.Connector", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "CompanyServiceAccountId") + .HasConstraintName("fk_connectors_company_service_accounts_company_service_account"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Host") + .WithMany("HostedConnectors") + .HasForeignKey("HostId") + .HasConstraintName("fk_connectors_companies_host_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_connectors_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Location") + .WithMany("Connectors") + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_connectors_countries_location_temp_id1"); + + 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.Document", "SelfDescriptionDocument") + .WithOne("Connector") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SelfDescriptionDocumentId") + .HasConstraintName("fk_connectors_documents_self_description_document_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", "Status") + .WithMany("Connectors") + .HasForeignKey("StatusId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_statuses_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", "Type") + .WithMany("Connectors") + .HasForeignKey("TypeId") + .IsRequired() + .HasConstraintName("fk_connectors_connector_types_type_id"); + + b.Navigation("CompanyServiceAccount"); + + b.Navigation("Host"); + + b.Navigation("LastEditor"); + + b.Navigation("Location"); + + b.Navigation("Provider"); + + b.Navigation("SelfDescriptionDocument"); + + b.Navigation("Status"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorAssignedOfferSubscription", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("ConnectorId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_connectors_connector"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") + .WithMany("ConnectorAssignedOfferSubscriptions") + .HasForeignKey("OfferSubscriptionId") + .IsRequired() + .HasConstraintName("fk_connector_assigned_offer_subscriptions_offer_subscriptions_"); + + b.Navigation("Connector"); + + b.Navigation("OfferSubscription"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") + .WithOne("ClientDetails") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", "ConnectorId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("fk_connector_client_details_connectors_connector_id"); + + b.Navigation("Connector"); + }); + + 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.Document", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") + .WithMany("Documents") + .HasForeignKey("CompanyUserId") + .HasConstraintName("fk_documents_company_users_company_user_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", "DocumentStatus") + .WithMany("Documents") + .HasForeignKey("DocumentStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_status_document_status_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", "DocumentType") + .WithMany("Documents") + .HasForeignKey("DocumentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_document_types_document_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", "MediaType") + .WithMany("Documents") + .HasForeignKey("MediaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_documents_media_types_media_type_id"); + + b.Navigation("CompanyUser"); + + b.Navigation("DocumentStatus"); + + b.Navigation("DocumentType"); + + b.Navigation("MediaType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") + .WithOne("IamIdentityProvider") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", "IdentityProviderId") + .IsRequired() + .HasConstraintName("fk_iam_identity_providers_identity_providers_identity_provider"); + + b.Navigation("IdentityProvider"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") + .WithMany("Identities") + .HasForeignKey("CompanyId") + .IsRequired() + .HasConstraintName("fk_identities_companies_company_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", "IdentityType") + .WithMany("Identities") + .HasForeignKey("IdentityTypeId") + .IsRequired() + .HasConstraintName("fk_identities_identity_type_identity_type_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_identities_identities_last_editor_id"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", "IdentityStatus") + .WithMany("Identities") + .HasForeignKey("UserStatusId") + .IsRequired() + .HasConstraintName("fk_identities_identity_user_statuses_identity_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.Navigation("IdentityProviderCategory"); + }); + + 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_long_name_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_language_short_name"); + + b.Navigation("Language"); + + b.Navigation("LongNameLanguage"); + }); + + 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_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_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") + .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.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.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_r"); + + 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.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialExternalTypeUseCaseDetailVersions") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_external_type_use_case_detail_versions_"); + + b.Navigation("VerifiedCredentialExternalType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") + .WithMany("VerifiedCredentialTypeAssignedExternalTypes") + .HasForeignKey("VerifiedCredentialExternalTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedExternalType") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c1"); + + b.Navigation("VerifiedCredentialExternalType"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedKind") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", "VerifiedCredentialTypeId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", "VerifiedCredentialTypeKind") + .WithMany("VerifiedCredentialTypeAssignedKinds") + .HasForeignKey("VerifiedCredentialTypeKindId") + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential1"); + + b.Navigation("VerifiedCredentialType"); + + b.Navigation("VerifiedCredentialTypeKind"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") + .WithOne("VerifiedCredentialAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "UseCaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_use_cases_use_c"); + + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") + .WithOne("VerifiedCredentialTypeAssignedUseCase") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "VerifiedCredentialTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_verified_credential_type_assigned_use_cases_verified_creden"); + + b.Navigation("UseCase"); + + b.Navigation("VerifiedCredentialType"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => + { + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") + .WithOne("CompaniesLinkedServiceAccount") + .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); + + b.Navigation("CompanyServiceAccount"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.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.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("CompanyIdentifiers"); + + b.Navigation("CompanySsiDetails"); + + b.Navigation("Consents"); + + b.Navigation("HostedConnectors"); + + b.Navigation("Identities"); + + b.Navigation("OfferSubscriptions"); + + 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("Invitations"); + }); + + 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.CompanyRole", b => + { + b.Navigation("AgreementAssignedCompanyRoles"); + + b.Navigation("CompanyAssignedRoles"); + + b.Navigation("CompanyRoleAssignedRoleCollection"); + + b.Navigation("CompanyRoleDescriptions"); + + b.Navigation("CompanyRoleRegistrationData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => + { + b.Navigation("AppInstances"); + + b.Navigation("CompaniesLinkedServiceAccount"); + + b.Navigation("Connector"); + }); + + 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.CompanySsiDetailStatus", b => + { + b.Navigation("CompanySsiDetails"); + }); + + 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("CompanySsiDetails"); + + b.Navigation("CompanyUserAssignedBusinessPartners"); + + 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("ClientDetails"); + + 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"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => + { + b.Navigation("Agreements"); + + b.Navigation("Companies"); + + b.Navigation("CompanySsiDetail"); + + b.Navigation("Connector"); + + b.Navigation("Consents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => + { + b.Navigation("AppInstances"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => + { + b.Navigation("CompanyServiceAccount"); + + b.Navigation("CompanyUser"); + + b.Navigation("CreatedNotifications"); + + b.Navigation("IdentityAssignedRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => + { + b.Navigation("CompanyIdentityProviders"); + + b.Navigation("IamIdentityProvider"); + }); + + 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.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("CompanyRoleDescriptions"); + + 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.MediaType", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", b => + { + b.Navigation("NotificationTypeAssignedTopics"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", b => + { + b.Navigation("NotificationTypeAssignedTopic"); + + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => + { + b.Navigation("AgreementAssignedOffers"); + + b.Navigation("AppInstanceSetup"); + + b.Navigation("AppInstances"); + + b.Navigation("ConsentAssignedOffers"); + + b.Navigation("OfferAssignedPrivacyPolicies"); + + b.Navigation("OfferDescriptions"); + + b.Navigation("OfferSubscriptions"); + + b.Navigation("ServiceDetails"); + + b.Navigation("Tags"); + + b.Navigation("TechnicalUserProfiles"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", b => + { + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => + { + b.Navigation("AppSubscriptionDetail"); + + b.Navigation("CompanyServiceAccounts"); + + b.Navigation("ConnectorAssignedOfferSubscriptions"); + + b.Navigation("ConsentAssignedOfferSubscriptions"); + + b.Navigation("OfferSubscriptionProcessData"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => + { + b.Navigation("OfferSubscriptions"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", b => + { + b.Navigation("AgreementAssignedOfferTypes"); + + b.Navigation("Offers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", b => + { + b.Navigation("OfferAssignedPrivacyPolicies"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => + { + b.Navigation("CompanyApplication"); + + b.Navigation("OfferSubscription"); + + b.Navigation("ProcessSteps"); + }); + + 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.TechnicalUserProfile", b => + { + b.Navigation("TechnicalUserProfileAssignedUserRoles"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => + { + b.Navigation("CompanyIdentifiers"); + + b.Navigation("CountryAssignedIdentifiers"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => + { + b.Navigation("Agreements"); + + b.Navigation("CompanyAssignedUseCase"); + + b.Navigation("UseCaseDescriptions"); + + b.Navigation("VerifiedCredentialAssignedUseCase"); + }); + + 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"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", b => + { + b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersions"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalTypes"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => + { + b.Navigation("CompanySsiDetails"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", b => + { + b.Navigation("CompanySsiDetails"); + + b.Navigation("VerifiedCredentialTypeAssignedExternalType"); + + b.Navigation("VerifiedCredentialTypeAssignedKind"); + + b.Navigation("VerifiedCredentialTypeAssignedUseCase"); + }); + + modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", b => + { + b.Navigation("VerifiedCredentialTypeAssignedKinds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs new file mode 100644 index 0000000000..e643e5a4f6 --- /dev/null +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs @@ -0,0 +1,335 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations +{ + public partial class AddLastEditorConstraints : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateIndex( + name: "ix_user_roles_last_editor_id", + schema: "portal", + table: "user_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_provider_company_details_last_editor_id", + schema: "portal", + table: "provider_company_details", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_offers_last_editor_id", + schema: "portal", + table: "offers", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_offer_subscriptions_last_editor_id", + schema: "portal", + table: "offer_subscriptions", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_identity_assigned_roles_last_editor_id", + schema: "portal", + table: "identity_assigned_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_identities_last_editor_id", + schema: "portal", + table: "identities", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_consents_last_editor_id", + schema: "portal", + table: "consents", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_users_last_editor_id", + schema: "portal", + table: "company_users", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_ssi_details_last_editor_id", + schema: "portal", + table: "company_ssi_details", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_assigned_roles_last_editor_id", + schema: "portal", + table: "company_assigned_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_applications_last_editor_id", + schema: "portal", + table: "company_applications", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_app_subscription_details_last_editor_id", + schema: "portal", + table: "app_subscription_details", + column: "last_editor_id"); + + migrationBuilder.AddForeignKey( + name: "fk_app_subscription_details_identities_last_editor_id", + schema: "portal", + table: "app_subscription_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_applications_identities_last_editor_id", + schema: "portal", + table: "company_applications", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "company_assigned_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_ssi_details_identities_last_editor_id", + schema: "portal", + table: "company_ssi_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_users_identities_last_editor_id", + schema: "portal", + table: "company_users", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_consents_identities_last_editor_id", + schema: "portal", + table: "consents", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_identities_identities_last_editor_id", + schema: "portal", + table: "identities", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_identity_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "identity_assigned_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_offer_subscriptions_identities_last_editor_id", + schema: "portal", + table: "offer_subscriptions", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_offers_identities_last_editor_id", + schema: "portal", + table: "offers", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_provider_company_details_identities_last_editor_id", + schema: "portal", + table: "provider_company_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_user_roles_identities_last_editor_id", + schema: "portal", + table: "user_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_app_subscription_details_identities_last_editor_id", + schema: "portal", + table: "app_subscription_details"); + + migrationBuilder.DropForeignKey( + name: "fk_company_applications_identities_last_editor_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.DropForeignKey( + name: "fk_company_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "company_assigned_roles"); + + migrationBuilder.DropForeignKey( + name: "fk_company_ssi_details_identities_last_editor_id", + schema: "portal", + table: "company_ssi_details"); + + migrationBuilder.DropForeignKey( + name: "fk_company_users_identities_last_editor_id", + schema: "portal", + table: "company_users"); + + migrationBuilder.DropForeignKey( + name: "fk_consents_identities_last_editor_id", + schema: "portal", + table: "consents"); + + migrationBuilder.DropForeignKey( + name: "fk_identities_identities_last_editor_id", + schema: "portal", + table: "identities"); + + migrationBuilder.DropForeignKey( + name: "fk_identity_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "identity_assigned_roles"); + + migrationBuilder.DropForeignKey( + name: "fk_offer_subscriptions_identities_last_editor_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropForeignKey( + name: "fk_offers_identities_last_editor_id", + schema: "portal", + table: "offers"); + + migrationBuilder.DropForeignKey( + name: "fk_provider_company_details_identities_last_editor_id", + schema: "portal", + table: "provider_company_details"); + + migrationBuilder.DropForeignKey( + name: "fk_user_roles_identities_last_editor_id", + schema: "portal", + table: "user_roles"); + + migrationBuilder.DropIndex( + name: "ix_user_roles_last_editor_id", + schema: "portal", + table: "user_roles"); + + migrationBuilder.DropIndex( + name: "ix_provider_company_details_last_editor_id", + schema: "portal", + table: "provider_company_details"); + + migrationBuilder.DropIndex( + name: "ix_offers_last_editor_id", + schema: "portal", + table: "offers"); + + migrationBuilder.DropIndex( + name: "ix_offer_subscriptions_last_editor_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropIndex( + name: "ix_identity_assigned_roles_last_editor_id", + schema: "portal", + table: "identity_assigned_roles"); + + migrationBuilder.DropIndex( + name: "ix_identities_last_editor_id", + schema: "portal", + table: "identities"); + + migrationBuilder.DropIndex( + name: "ix_consents_last_editor_id", + schema: "portal", + table: "consents"); + + migrationBuilder.DropIndex( + name: "ix_company_users_last_editor_id", + schema: "portal", + table: "company_users"); + + migrationBuilder.DropIndex( + name: "ix_company_ssi_details_last_editor_id", + schema: "portal", + table: "company_ssi_details"); + + migrationBuilder.DropIndex( + name: "ix_company_assigned_roles_last_editor_id", + schema: "portal", + table: "company_assigned_roles"); + + migrationBuilder.DropIndex( + name: "ix_company_applications_last_editor_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.DropIndex( + name: "ix_app_subscription_details_last_editor_id", + schema: "portal", + table: "app_subscription_details"); + } + } +} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 7ae55d25c7..879c991e3d 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -1532,6 +1532,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -1924,6 +1927,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("CompanyId") .HasDatabaseName("ix_company_applications_company_id"); + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_applications_last_editor_id"); + b.ToTable("company_applications", "portal"); b @@ -2017,6 +2023,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); b @@ -2333,6 +2342,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_company_ssi_details_document_id"); + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_ssi_details_last_editor_id"); + b.HasIndex("VerifiedCredentialExternalTypeUseCaseDetailId") .HasDatabaseName("ix_company_ssi_details_verified_credential_external_type_use_c"); @@ -2463,6 +2475,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_company_users"); + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_company_users_last_editor_id"); + b.ToTable("company_users", "portal"); b @@ -2773,6 +2788,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_consents_document_id"); + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_consents_last_editor_id"); + b.ToTable("consents", "portal"); b @@ -3183,6 +3201,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -3215,6 +3236,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -3904,6 +3928,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_offers"); + b.HasIndex("LastEditorId") + .HasDatabaseName("ix_offers_last_editor_id"); + b.HasIndex("LicenseTypeId") .HasDatabaseName("ix_offers_license_type_id"); @@ -4124,6 +4151,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -4653,6 +4683,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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"); b @@ -4868,6 +4901,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -5460,6 +5496,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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") @@ -5468,6 +5509,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("AppInstance"); + b.Navigation("LastEditor"); + b.Navigation("OfferSubscription"); }); @@ -5517,11 +5560,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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.Navigation("ApplicationStatus"); b.Navigation("ChecklistProcess"); b.Navigation("Company"); + + b.Navigation("LastEditor"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyAssignedRole", b => @@ -5538,9 +5588,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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 => @@ -5708,6 +5765,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_company_ssi_details_documents_document_id"); + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") + .WithMany() + .HasForeignKey("LastEditorId") + .HasConstraintName("fk_company_ssi_details_identities_last_editor_id"); + b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", "VerifiedCredentialExternalTypeUseCaseDetailVersion") .WithMany("CompanySsiDetails") .HasForeignKey("VerifiedCredentialExternalTypeUseCaseDetailId") @@ -5727,6 +5789,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Document"); + b.Navigation("LastEditor"); + b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersion"); b.Navigation("VerifiedCredentialType"); @@ -5741,7 +5805,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_company_users_identities_identity_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 => @@ -5902,6 +5973,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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"); @@ -5911,6 +5987,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("ConsentStatus"); b.Navigation("Document"); + + b.Navigation("LastEditor"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConsentAssignedOffer", b => @@ -6039,6 +6117,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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") @@ -6050,6 +6133,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("IdentityStatus"); b.Navigation("IdentityType"); + + b.Navigation("LastEditor"); }); modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityAssignedRole", b => @@ -6060,6 +6145,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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") @@ -6068,6 +6158,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Identity"); + b.Navigation("LastEditor"); + b.Navigation("UserRole"); }); @@ -6176,6 +6268,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -6207,6 +6304,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("SalesManagerId") .HasConstraintName("fk_offers_company_users_sales_manager_id"); + b.Navigation("LastEditor"); + b.Navigation("LicenseType"); b.Navigation("OfferStatus"); @@ -6302,6 +6401,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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") @@ -6327,6 +6431,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Company"); + b.Navigation("LastEditor"); + b.Navigation("Offer"); b.Navigation("OfferSubscriptionStatus"); @@ -6407,7 +6513,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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 => @@ -6480,6 +6593,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -6487,6 +6605,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("fk_user_roles_offers_offer_id"); + b.Navigation("LastEditor"); + b.Navigation("Offer"); }); diff --git a/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj b/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj index 924ac1d8c9..7da3465242 100644 --- a/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj +++ b/src/portalbackend/PortalBackend.Migrations/PortalBackend.Migrations.csproj @@ -46,6 +46,7 @@ + diff --git a/src/portalbackend/PortalBackend.Migrations/Program.cs b/src/portalbackend/PortalBackend.Migrations/Program.cs index a74a3e3649..c9f497e718 100644 --- a/src/portalbackend/PortalBackend.Migrations/Program.cs +++ b/src/portalbackend/PortalBackend.Migrations/Program.cs @@ -25,6 +25,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Serilog; @@ -40,6 +41,7 @@ .ConfigureServices((hostContext, services) => { services + .AddProcessIdentity(hostContext.Configuration.GetSection("ProcessIdentity")) .AddDbContext(o => o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb"), x => x.MigrationsAssembly(Assembly.GetExecutingAssembly().GetName().Name) diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json index 3e0d0c5c07..f1689165f3 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/company_service_accounts.json @@ -62,5 +62,13 @@ "company_service_account_type_id": 2, "client_id": "7e85a0b8-0001-ab67-10d1-000000001028", "client_client_id": "sa-cl8-cx-1" + }, + { + "id": "d21d2e8a-fe35-483c-b2b8-4100ed7f0953", + "name": "sa-cl2-04", + "description": "Technical User for Portal ProccessWorker", + "company_service_account_type_id": 2, + "client_id": "c5709899-0415-4385-be80-76d2bfd31724", + "client_client_id": "sa-cl2-04" } ] diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/identities.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/identities.json index d9d419d601..cf8fdcdac8 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/identities.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/identities.json @@ -72,5 +72,13 @@ "user_status_id": 1, "user_entity_id": "383eaec3-4332-47fa-9279-28edc74cb752", "identity_type_id": 2 + }, + { + "id": "d21d2e8a-fe35-483c-b2b8-4100ed7f0953", + "company_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87", + "date_created": "2023-01-01 18:01:33.439000 +00:00", + "user_status_id": 1, + "user_entity_id": "090c9121-7380-4bb0-bb10-fffd344f930a", + "identity_type_id": 2 } ] diff --git a/src/portalbackend/PortalBackend.Migrations/appsettings.json b/src/portalbackend/PortalBackend.Migrations/appsettings.json index 0701ec1b9c..974dfcd4fc 100644 --- a/src/portalbackend/PortalBackend.Migrations/appsettings.json +++ b/src/portalbackend/PortalBackend.Migrations/appsettings.json @@ -26,5 +26,11 @@ "Seeding":{ "DataPaths":[], "TestDataEnvironments": [] + }, + "ProcessIdentity": { + "UserEntityId": "", + "ProcessUserId": "", + "IdentityTypeId": 0, + "ProcessUserCompanyId": "" } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs index 3118292b55..06f5b322d4 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/AppSubscriptionDetail.cs @@ -68,7 +68,9 @@ public AppSubscriptionDetail(Guid id, Guid offerSubscriptionId) public string? AppSubscriptionUrl { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } + + // navigational properties /// /// Subscribing app instance. @@ -79,4 +81,5 @@ public AppSubscriptionDetail(Guid id, Guid offerSubscriptionId) /// Subscription of an offer /// public virtual OfferSubscription? OfferSubscription { get; private set; } + public virtual Identity? LastEditor { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs index 81508b11a9..5dc37c8055 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyApplication.cs @@ -53,11 +53,13 @@ public CompanyApplication(Guid id, Guid companyId, CompanyApplicationStatusId ap public Guid? ChecklistProcessId { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } + // Navigation properties public virtual CompanyApplicationStatus? ApplicationStatus { get; set; } public virtual Company? Company { get; set; } public virtual Process? ChecklistProcess { get; set; } public virtual ICollection Invitations { get; private set; } public virtual ICollection ApplicationChecklistEntries { get; private set; } + public virtual Identity? LastEditor { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyAssignedRole.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyAssignedRole.cs index 2e7b325061..fcae9baac2 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyAssignedRole.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyAssignedRole.cs @@ -39,9 +39,10 @@ public CompanyAssignedRole(Guid companyId, CompanyRoleId companyRoleId) public CompanyRoleId CompanyRoleId { get; private set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties + public virtual Identity? LastEditor { get; private set; } public virtual Company? Company { get; private set; } public virtual CompanyRole? CompanyRole { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanySsiDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanySsiDetail.cs index 1ca99a25a9..98c393c9a5 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanySsiDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanySsiDetail.cs @@ -52,9 +52,10 @@ public CompanySsiDetail(Guid id, Guid companyId, VerifiedCredentialTypeId verifi public Guid? VerifiedCredentialExternalTypeUseCaseDetailId { get; set; } public DateTimeOffset? DateLastChanged { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation Properties + public virtual Identity? LastEditor { get; private set; } public virtual Company? Company { get; set; } public virtual VerifiedCredentialType? VerifiedCredentialType { get; set; } public virtual CompanySsiDetailStatus? CompanySsiDetailStatus { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs index 820960a3e0..7fdd316217 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUser.cs @@ -28,10 +28,9 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entit [AuditEntityV1(typeof(AuditCompanyUser20230522))] public class CompanyUser : IBaseEntity, IAuditableV1 { - public CompanyUser(Guid id, Guid? lastEditorId) + public CompanyUser(Guid id) { Id = id; - LastEditorId = lastEditorId; Consents = new HashSet(); Documents = new HashSet(); @@ -61,9 +60,10 @@ public CompanyUser(Guid id, Guid? lastEditorId) public DateTimeOffset? DateLastChanged { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } public virtual Identity? Identity { get; set; } + public virtual Identity? LastEditor { get; private set; } public virtual ICollection Consents { get; private set; } public virtual ICollection Documents { get; private set; } public virtual ICollection Invitations { get; private set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedRole.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedRole.cs index a5d519df8f..1fbd4b0a8d 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedRole.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/CompanyUserAssignedRole.cs @@ -36,8 +36,10 @@ public IdentityAssignedRole(Guid identityId, Guid userRoleId) public Guid UserRoleId { get; private set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } + // Navigation properties + public virtual Identity? LastEditor { get; private set; } public virtual Identity? Identity { get; private set; } public virtual UserRole? UserRole { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs index 03b2741b72..4d6a593ab6 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Connector.cs @@ -71,7 +71,7 @@ public Connector(Guid id, string name, string locationId, string connectorUrl) public Guid? CompanyServiceAccountId { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual ConnectorType? Type { get; set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs index 5404ebebc3..4826141716 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Consent.cs @@ -64,7 +64,7 @@ public Consent(Guid id, Guid agreementId, Guid companyId, Guid companyUserId, Co public Guid CompanyUserId { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual Agreement? Agreement { get; private set; } @@ -72,6 +72,7 @@ public Consent(Guid id, Guid agreementId, Guid companyId, Guid companyUserId, Co public virtual CompanyUser? CompanyUser { get; private set; } public virtual ConsentStatus? ConsentStatus { get; private set; } public virtual Document? Document { get; private set; } + public virtual Identity? LastEditor { get; private set; } public virtual ICollection ConsentAssignedOffers { get; private set; } public virtual ICollection ConsentAssignedOfferSubscriptions { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs index 305eef8a92..7e1f4bf1bb 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Identity.cs @@ -38,17 +38,15 @@ public Identity(Guid id, DateTimeOffset dateCreated, Guid companyId, UserStatusI public DateTimeOffset? DateLastChanged { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual CompanyUser? CompanyUser { get; set; } public virtual CompanyServiceAccount? CompanyServiceAccount { get; set; } public virtual Company? Company { get; set; } - public virtual IdentityUserStatus? IdentityStatus { get; set; } - public virtual IdentityType? IdentityType { get; set; } - public virtual ICollection CreatedNotifications { get; private set; } public virtual ICollection IdentityAssignedRoles { get; private set; } + public virtual Identity? LastEditor { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs index 73c93a29bd..d2a47aa2df 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/Offer.cs @@ -93,7 +93,7 @@ public Offer(Guid id, string provider, DateTimeOffset dateCreated, OfferTypeId o public DateTimeOffset? DateLastChanged { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual OfferType? OfferType { get; private set; } @@ -101,7 +101,7 @@ public Offer(Guid id, string provider, DateTimeOffset dateCreated, OfferTypeId o public virtual OfferStatus? OfferStatus { get; set; } public virtual LicenseType? LicenseType { get; set; } - + public virtual Identity? LastEditor { get; private set; } public virtual AppInstanceSetup? AppInstanceSetup { get; set; } public virtual ICollection AgreementAssignedOffers { get; private set; } public virtual ICollection OfferDescriptions { get; private set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs index fccf59c6e5..d8b7443686 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/OfferSubscription.cs @@ -51,7 +51,7 @@ public OfferSubscription() /// app subscription status. /// Id of the requester /// Id of the editor - public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid lastEditorId) + public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) : this() { Id = id; @@ -59,7 +59,6 @@ public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptio CompanyId = companyId; OfferSubscriptionStatusId = offerSubscriptionStatusId; RequesterId = requesterId; - LastEditorId = lastEditorId; } /// @@ -98,7 +97,7 @@ public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptio public Guid RequesterId { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } public Guid? ProcessId { get; set; } @@ -122,6 +121,7 @@ public OfferSubscription(Guid id, Guid offerId, Guid companyId, OfferSubscriptio /// Requester /// public virtual CompanyUser? Requester { get; private set; } + public virtual Identity? LastEditor { get; private set; } /// /// Subscription status. diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs index ed52fb4f46..5598ec2708 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/ProviderCompanyDetail.cs @@ -54,8 +54,9 @@ public ProviderCompanyDetail(Guid id, Guid companyId, string autoSetupUrl, DateT public DateTimeOffset? DateLastChanged { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual Company? Company { get; private set; } + public virtual Identity? LastEditor { get; private set; } } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs index e59813f790..7f2d6c8cb3 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Entities/UserRole.cs @@ -56,9 +56,10 @@ public UserRole(Guid id, string userRoleText, Guid offerId) : this() public Guid OfferId { get; set; } [AuditLastEditorV1] - public Guid? LastEditorId { get; set; } + public Guid? LastEditorId { get; private set; } // Navigation properties public virtual Offer? Offer { get; set; } + public virtual Identity? LastEditor { get; private set; } public virtual ICollection IdentityAssignedRoles { get; private set; } public virtual ICollection UserRoleCollections { get; private set; } public virtual ICollection UserRoleDescriptions { get; private set; } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs b/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs new file mode 100644 index 0000000000..e4b920d7cb --- /dev/null +++ b/src/portalbackend/PortalBackend.PortalEntities/Identities/IIdentityService.cs @@ -0,0 +1,29 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; + +public interface IIdentityService +{ + /// + /// Information of the currently logged in user + /// + public IdentityData IdentityData { get; } +} diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/IdentityData.cs b/src/portalbackend/PortalBackend.PortalEntities/Identities/IdentityData.cs similarity index 92% rename from src/portalbackend/PortalBackend.DBAccess/Models/IdentityData.cs rename to src/portalbackend/PortalBackend.PortalEntities/Identities/IdentityData.cs index 072c66ad11..614faec123 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/IdentityData.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Identities/IdentityData.cs @@ -20,6 +20,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; public record IdentityData(string UserEntityId, Guid UserId, IdentityTypeId IdentityType, Guid CompanyId); diff --git a/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj b/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj index 09051c058f..55fc7ce4f6 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj +++ b/src/portalbackend/PortalBackend.PortalEntities/PortalBackend.PortalEntities.csproj @@ -21,6 +21,7 @@ Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities + Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities net6.0 enable enable diff --git a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs index 7dd65e9216..a2743c3f52 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/PortalDbContext.cs @@ -23,6 +23,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; @@ -36,13 +37,17 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; /// public class PortalDbContext : DbContext { + private readonly IIdentityService _identityService; + protected PortalDbContext() { + throw new InvalidOperationException("IdentityService should never be null"); } - public PortalDbContext(DbContextOptions options) + public PortalDbContext(DbContextOptions options, IIdentityService identityService) : base(options) { + _identityService = identityService; } public virtual DbSet
Addresses { get; set; } = default!; @@ -1343,4 +1348,39 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasForeignKey(x => x.ServiceAccountId); }); } + + /// + public override Task SaveChangesAsync(CancellationToken cancellationToken = new()) + { + EnhanceChangedEntries(); + return base.SaveChangesAsync(cancellationToken); + } + + /// + public override int SaveChanges(bool acceptAllChangesOnSuccess) + { + EnhanceChangedEntries(); + return base.SaveChanges(acceptAllChangesOnSuccess); + } + + public override int SaveChanges() + { + EnhanceChangedEntries(); + return base.SaveChanges(); + } + + private void EnhanceChangedEntries() + { + foreach (var prop in ChangeTracker.Entries() + .Where(entry => entry.State != EntityState.Unchanged && entry.State != EntityState.Detached && entry.Entity is IAuditableV1) + .SelectMany(entry => + entry.Properties.IntersectBy( + entry.Entity.GetType().GetProperties() + .Where(x => Attribute.IsDefined(x, typeof(AuditLastEditorV1Attribute))) + .Select(x => x.Name), + property => property.Metadata.Name))) + { + prop.CurrentValue = _identityService.IdentityData.UserId; + } + } } diff --git a/src/processes/Processes.Worker/Processes.Worker.csproj b/src/processes/Processes.Worker/Processes.Worker.csproj index 4bb548bffc..58c8eda603 100644 --- a/src/processes/Processes.Worker/Processes.Worker.csproj +++ b/src/processes/Processes.Worker/Processes.Worker.csproj @@ -46,6 +46,7 @@ + diff --git a/src/processes/Processes.Worker/Program.cs b/src/processes/Processes.Worker/Program.cs index 46c26240ca..86764ce791 100644 --- a/src/processes/Processes.Worker/Program.cs +++ b/src/processes/Processes.Worker/Program.cs @@ -23,6 +23,7 @@ using Microsoft.Extensions.Hosting; using Org.Eclipse.TractusX.Portal.Backend.ApplicationActivation.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Factory; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.DependencyInjection; @@ -32,8 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Executor.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Processes.Worker.Library; using Serilog; -using Serilog.Events; -using Serilog.Formatting.Json; LoggingExtensions.EnsureInitialized(); Log.Information("Building worker"); @@ -52,7 +51,8 @@ .AddPortalRepositories(hostContext.Configuration) .AddApplicationChecklist(hostContext.Configuration.GetSection("ApplicationChecklist")) .AddApplicationChecklistCreation() - .AddApplicationActivation(hostContext.Configuration); + .AddApplicationActivation(hostContext.Configuration) + .AddProcessIdentity(hostContext.Configuration.GetSection("ProcessIdentity")); if (hostContext.HostingEnvironment.IsDevelopment()) { diff --git a/src/processes/Processes.Worker/appsettings.json b/src/processes/Processes.Worker/appsettings.json index cda1bc089e..71ac4aa7f4 100644 --- a/src/processes/Processes.Worker/appsettings.json +++ b/src/processes/Processes.Worker/appsettings.json @@ -379,5 +379,11 @@ "ClientSecret": "", "Scope": "", "KeycloakTokenAddress": "" + }, + "ProcessIdentity": { + "UserEntityId": "", + "ProcessUserId": "", + "IdentityTypeId": 0, + "ProcessUserCompanyId": "" } } diff --git a/src/provisioning/Provisioning.Library/Models/CompanyNameIdpAliasData.cs b/src/provisioning/Provisioning.Library/Models/CompanyNameIdpAliasData.cs index 6f7f8ab057..5849839980 100644 --- a/src/provisioning/Provisioning.Library/Models/CompanyNameIdpAliasData.cs +++ b/src/provisioning/Provisioning.Library/Models/CompanyNameIdpAliasData.cs @@ -1,3 +1,3 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; -public record CompanyNameIdpAliasData(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, Guid CompanyUserId, string IdpAlias, bool IsSharedIdp); +public record CompanyNameIdpAliasData(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, string IdpAlias, bool IsSharedIdp); diff --git a/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs b/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs index 8c613e3bbf..612c1792a2 100644 --- a/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs +++ b/src/provisioning/Provisioning.Library/Service/UserProvisioningService.cs @@ -58,7 +58,7 @@ public UserProvisioningService(IProvisioningManager provisioningManager, IPortal var userRepository = _portalRepositories.GetInstance(); var userRolesRepository = _portalRepositories.GetInstance(); - var (companyId, companyName, businessPartnerNumber, creatorId, alias, isSharedIdp) = companyNameIdpAliasData; + var (companyId, companyName, businessPartnerNumber, alias, isSharedIdp) = companyNameIdpAliasData; var passwordProvider = new OptionalPasswordProvider(isSharedIdp); @@ -71,7 +71,7 @@ public UserProvisioningService(IProvisioningManager provisioningManager, IPortal try { - var (identity, companyUserId) = await GetOrCreateCompanyUser(userRepository, alias, user, companyId, creatorId, businessPartnerNumber); + var (identity, companyUserId) = await GetOrCreateCompanyUser(userRepository, alias, user, companyId, businessPartnerNumber); cancellationToken.ThrowIfCancellationRequested(); @@ -127,7 +127,6 @@ public UserProvisioningService(IProvisioningManager provisioningManager, IPortal string alias, UserCreationRoleDataIdpInfo user, Guid companyId, - Guid creatorId, string? businessPartnerNumber) { var businessPartnerRepository = _portalRepositories.GetInstance(); @@ -140,7 +139,7 @@ public UserProvisioningService(IProvisioningManager provisioningManager, IPortal } identity = userRepository.CreateIdentity(companyId, UserStatusId.ACTIVE); - companyUserId = userRepository.CreateCompanyUser(identity.Id, user.FirstName, user.LastName, user.Email, creatorId).Id; + companyUserId = userRepository.CreateCompanyUser(identity.Id, user.FirstName, user.LastName, user.Email).Id; if (businessPartnerNumber != null) { businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(companyUserId, businessPartnerNumber); @@ -193,7 +192,7 @@ private Task CreateSharedIdpUserOrReturnUserId(UserCreationRoleDataIdpIn var createdByName = CreateNameString(companyUser.FirstName, companyUser.LastName, companyUser.Email, companyUser.CompanyUserId); - return (new CompanyNameIdpAliasData(company.CompanyId, company.CompanyName, company.BusinessPartnerNumber, companyUser.CompanyUserId, identityProvider.IdpAlias, identityProvider.IsSharedIdp), createdByName); + return (new CompanyNameIdpAliasData(company.CompanyId, company.CompanyName, company.BusinessPartnerNumber, identityProvider.IdpAlias, identityProvider.IsSharedIdp), createdByName); } public async Task<(CompanyNameIdpAliasData IdpAliasData, string NameCreatedBy)> GetCompanyNameSharedIdpAliasData(Guid companyUserId, Guid? applicationId = null) @@ -221,7 +220,7 @@ private Task CreateSharedIdpUserOrReturnUserId(UserCreationRoleDataIdpIn var createdByName = CreateNameString(companyUser.FirstName, companyUser.LastName, companyUser.Email, companyUser.CompanyUserId); - return (new CompanyNameIdpAliasData(company.CompanyId, company.CompanyName, company.BusinessPartnerNumber, companyUser.CompanyUserId, idpAliase.First(), true), createdByName); + return (new CompanyNameIdpAliasData(company.CompanyId, company.CompanyName, company.BusinessPartnerNumber, idpAliase.First(), true), createdByName); } private static string CreateNameString(string? firstName, string? lastName, string? email, Guid companyUserId) diff --git a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs index 8d7f4e0901..cf29275daa 100644 --- a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs +++ b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs @@ -803,7 +803,7 @@ public IAsyncEnumerable GetCompanyRoles(string? languageSho _portalRepositories.GetInstance().GetCompanyRolesAsync(languageShortName); private static void HandleConsent(IEnumerable consents, IEnumerable agreementConsentsToSet, - IConsentRepository consentRepository, Guid companyId, Guid companyUserId) + IConsentRepository consentRepository, Guid companyId, Guid userId) { var consentsToInactivate = consents .Where(consent => @@ -813,7 +813,6 @@ private static void HandleConsent(IEnumerable consents, IEnumerable consentRepository.AttachAndModifiesConsents(consentsToInactivate.Select(x => x.ConsentId), consent => { consent.ConsentStatusId = ConsentStatusId.INACTIVE; - consent.LastEditorId = companyUserId; }); var consentsToActivate = consents @@ -825,7 +824,6 @@ private static void HandleConsent(IEnumerable consents, IEnumerable consentRepository.AttachAndModifiesConsents(consentsToActivate.Select(x => x.ConsentId), consent => { consent.ConsentStatusId = ConsentStatusId.ACTIVE; - consent.LastEditorId = companyUserId; }); foreach (var agreementConsentToAdd in agreementConsentsToSet @@ -834,7 +832,7 @@ private static void HandleConsent(IEnumerable consents, IEnumerable && !consents.Any(activeConsent => activeConsent.AgreementId == agreementConsent.AgreementId))) { - consentRepository.CreateConsent(agreementConsentToAdd.AgreementId, companyId, companyUserId, + consentRepository.CreateConsent(agreementConsentToAdd.AgreementId, companyId, userId, ConsentStatusId.ACTIVE); } } @@ -873,7 +871,10 @@ private static void UpdateApplicationStatus(Guid applicationId, CompanyApplicati var updateStatus = GetAndValidateUpdateApplicationStatus(applicationStatusId, type); if (updateStatus != default) { - applicationRepository.AttachAndModifyCompanyApplication(applicationId, ca => ca.ApplicationStatusId = updateStatus); + applicationRepository.AttachAndModifyCompanyApplication(applicationId, ca => + { + ca.ApplicationStatusId = updateStatus; + }); } } diff --git a/src/registration/Registration.Service/Controllers/RegistrationController.cs b/src/registration/Registration.Service/Controllers/RegistrationController.cs index 52411cf5d9..5d9683fb7e 100644 --- a/src/registration/Registration.Service/Controllers/RegistrationController.cs +++ b/src/registration/Registration.Service/Controllers/RegistrationController.cs @@ -270,8 +270,7 @@ public Task GetCompanyDetailDataAsync([FromRoute] Guid applic [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)] public Task SetCompanyDetailDataAsync([FromRoute] Guid applicationId, [FromBody] CompanyDetailData companyDetailData) => - this.WithCompanyId(companyId => - _registrationBusinessLogic.SetCompanyDetailDataAsync(applicationId, companyDetailData, companyId)); + this.WithCompanyId(companyId => _registrationBusinessLogic.SetCompanyDetailDataAsync(applicationId, companyDetailData, companyId)); /// /// Invites the given user to the given application diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs index 1d01356e54..ef94f2180d 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/CompanyDataBusinessLogicTests.cs @@ -31,6 +31,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.BusinessLogic; @@ -1190,7 +1191,6 @@ public async Task ApproveCredential_WithValidRequest_ReturnsExpected(VerifiedCre notification.NotificationTypeId.Should().Be(NotificationTypeId.CREDENTIAL_APPROVAL); notification.CreatorUserId.Should().Be(_identity.UserId); - detail.LastEditorId.Should().Be(_identity.UserId); detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.ACTIVE); detail.DateLastChanged.Should().Be(now); } @@ -1318,7 +1318,6 @@ public async Task ApproveCredential_WithoutUserMail_ReturnsExpected(VerifiedCred notification.NotificationTypeId.Should().Be(NotificationTypeId.CREDENTIAL_APPROVAL); notification.CreatorUserId.Should().Be(_identity.UserId); - detail.LastEditorId.Should().Be(_identity.UserId); detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.ACTIVE); detail.DateLastChanged.Should().Be(now); } @@ -1407,7 +1406,6 @@ public async Task RejectCredential_WithValidRequest_ReturnsExpected() notification.NotificationTypeId.Should().Be(NotificationTypeId.CREDENTIAL_REJECTED); notification.CreatorUserId.Should().Be(_identity.UserId); - detail.LastEditorId.Should().Be(_identity.UserId); detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.INACTIVE); detail.DateLastChanged.Should().Be(now); } @@ -1451,7 +1449,6 @@ public async Task RejectCredential_WithoutUserMail_ReturnsExpected() notification.NotificationTypeId.Should().Be(NotificationTypeId.CREDENTIAL_REJECTED); notification.CreatorUserId.Should().Be(_identity.UserId); - detail.LastEditorId.Should().Be(_identity.UserId); detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.INACTIVE); detail.DateLastChanged.Should().Be(now); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs index 07978d5da6..a67c47afa0 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ConnectorsBusinessLogicTests.cs @@ -31,6 +31,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; @@ -119,7 +120,7 @@ public async Task CreateConnectorAsync_WithValidInput_ReturnsCreatedConnectorDat .Returns(new DapsResponse("12345")); // Act - var result = await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert result.Should().NotBeEmpty(); @@ -139,7 +140,7 @@ public async Task CreateConnectorAsync_WithInvalidTechnicalUser_ThrowsController .Returns(new DapsResponse("12345")); // Act - async Task Act() => await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -157,7 +158,7 @@ public async Task CreateConnectorAsync_WithClientIdNull_DoesntSaveData() .Returns((DapsResponse?)null); // Act - var result = await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert result.Should().NotBeEmpty(); @@ -173,7 +174,7 @@ public async Task CreateConnectorAsync_WithoutSelfDescriptionDocument_ThrowsUnex var connectorInput = new ConnectorInputModel("connectorName", "https://test.de", "de", file, null); // Act - async Task Act() => await _logic.CreateConnectorAsync(connectorInput, (_identityWithoutSdDocument.UserId, _identityWithoutSdDocument.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateConnectorAsync(connectorInput, _identityWithoutSdDocument.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -187,7 +188,7 @@ public async Task CreateConnectorAsync_WithInvalidLocation_ThrowsControllerArgum var connectorInput = new ConnectorInputModel("connectorName", "https://test.de", "invalid", null, null); // Act - async Task Act() => await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -201,7 +202,7 @@ public async Task CreateConnectorAsync_WithCompanyWithoutBpn_ThrowsUnexpectedCon var connectorInput = new ConnectorInputModel("connectorName", "https://test.de", "de", null, null); // Act - async Task Act() => await _logic.CreateConnectorAsync(connectorInput, (_identityWithoutBpn.UserId, _identityWithoutBpn.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateConnectorAsync(connectorInput, _identityWithoutBpn.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -218,7 +219,7 @@ public async Task CreateConnectorAsync_WithFailingDapsService_ReturnsCreatedConn A._, A._)).Throws(new ServiceException("Service failed")); // Act - var result = await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert result.Should().NotBeEmpty(); @@ -235,7 +236,7 @@ public async Task CreateConnectorAsync_WithWrongFileType_ThrowsUnsupportedMediaT var connectorInput = new ConnectorInputModel("connectorName", "https://test.de", "de", file, null); // Act - async Task Act() => await _logic.CreateConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -256,7 +257,7 @@ public async Task CreateManagedConnectorAsync_WithValidInput_ReturnsCreatedConne .Returns(new DapsResponse("12345")); // Act - var result = await _logic.CreateManagedConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await _logic.CreateManagedConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert result.Should().NotBeEmpty(); @@ -275,7 +276,7 @@ public async Task CreateManagedConnectorAsync_WithTechnicalUser_ReturnsCreatedCo .Returns(new DapsResponse("12345")); // Act - var result = await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert result.Should().NotBeEmpty(); @@ -292,7 +293,7 @@ public async Task CreateManagedConnectorAsync_WithWrongFileType_ThrowsUnsupporte var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", Guid.NewGuid(), file, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -306,7 +307,7 @@ public async Task CreateManagedConnectorAsync_WithInvalidLocation_ThrowsControll var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "invalid", ValidOfferSubscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -323,7 +324,7 @@ public async Task CreateManagedConnectorAsync_WithNotExistingSubscription_Throws var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -340,7 +341,7 @@ public async Task CreateManagedConnectorAsync_WithCallerNotOfferProvider_ThrowsF var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -357,7 +358,7 @@ public async Task CreateManagedConnectorAsync_WithOfferAlreadyLinked_ThrowsUnexp var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -374,7 +375,7 @@ public async Task CreateManagedConnectorAsync_WithInactiveSubscription_ThrowsUne var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -392,7 +393,7 @@ public async Task CreateManagedConnectorAsync_WithoutExistingSelfDescriptionDocu var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, file, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var exception = await Assert.ThrowsAsync(Act); @@ -410,7 +411,7 @@ public async Task CreateManagedConnectorAsync_WithSubscribingCompanyWithoutBpn_T var connectorInput = new ManagedConnectorInputModel("connectorName", "https://test.de", "de", subscriptionId, null, null); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_technicalUserIdentity.UserId, _technicalUserIdentity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _technicalUserIdentity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -428,7 +429,7 @@ public async Task CreateManagedConnectorAsync_WithInvalidTechnicalUser_ThrowsCon .Returns(new DapsResponse("12345")); // Act - async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.CreateManagedConnectorAsync(connectorInput, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -577,8 +578,8 @@ public async Task DeleteConnectorAsync_WithDocumentId_ExpectedCalls() var connectorId = Guid.NewGuid(); var connector = new Connector(connectorId, null!, null!, null!); var selfDescriptionDocumentId = Guid.NewGuid(); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(A._)) - .Returns((true, "123", selfDescriptionDocumentId, documentStatusId, ConnectorStatusId.ACTIVE, true)); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(A._, _identity.CompanyId)) + .Returns((true, true, "123", selfDescriptionDocumentId, documentStatusId, ConnectorStatusId.ACTIVE, true)); A.CallTo(() => _documentRepository.AttachAndModifyDocument(A._, A>._, A>._)) .Invokes((Guid DocId, Action? initialize, Action modify) @@ -596,11 +597,11 @@ public async Task DeleteConnectorAsync_WithDocumentId_ExpectedCalls() }); // Act - await _logic.DeleteConnectorAsync(connectorId, _identity.UserId, CancellationToken.None).ConfigureAwait(false); + await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert connector.StatusId.Should().Be(ConnectorStatusId.INACTIVE); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)).MustHaveHappenedOnceExactly(); A.CallTo(() => _documentRepository.AttachAndModifyDocument(selfDescriptionDocumentId, A>._, A>._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _connectorsRepository.AttachAndModifyConnector(connectorId, A>._, A>._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _connectorsRepository.DeleteConnectorClientDetails(connectorId)).MustHaveHappenedOnceExactly(); @@ -614,8 +615,8 @@ public async Task DeleteConnectorAsync_WithOutDocumentId_ExpectedCalls() // Arrange var connectorId = Guid.NewGuid(); var connector = new Connector(connectorId, null!, null!, null!); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId)) - .Returns((true, "12345", null, null, ConnectorStatusId.ACTIVE, true)); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)) + .Returns((true, true, "12345", null, null, ConnectorStatusId.ACTIVE, true)); A.CallTo(() => _connectorsRepository.AttachAndModifyConnector(A._, A>._, A>._)) .Invokes((Guid _, Action? initialize, Action setOptionalFields) => { @@ -624,7 +625,7 @@ public async Task DeleteConnectorAsync_WithOutDocumentId_ExpectedCalls() }); // Act - await _logic.DeleteConnectorAsync(connectorId, _identity.UserId, CancellationToken.None).ConfigureAwait(false); + await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert connector.StatusId.Should().Be(ConnectorStatusId.INACTIVE); @@ -638,11 +639,11 @@ public async Task DeleteConnectorAsync_WithInactiveConnector_ThrowsConflictExcep { // Arrange var connectorId = Guid.NewGuid(); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId)) - .Returns((true, null, null, null, ConnectorStatusId.ACTIVE, false)); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)) + .Returns((true, true, null, null, null, ConnectorStatusId.ACTIVE, false)); // Act - async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.UserId, CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -654,11 +655,11 @@ public async Task DeleteConnectorAsync_WithEmptyDapsClientId_ThrowsUnexpectedCon { // Arrange var connectorId = Guid.NewGuid(); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId)) - .Returns((true, null, null, null, ConnectorStatusId.ACTIVE, true)); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)) + .Returns((true, true, null, null, null, ConnectorStatusId.ACTIVE, true)); // Act - async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.UserId, CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -670,17 +671,33 @@ public async Task DeleteConnectorAsync_ThrowsNotFoundException() { // Arrange var connectorId = Guid.NewGuid(); - A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId)) - .Returns(((bool, string?, Guid?, DocumentStatusId?, ConnectorStatusId, bool))default); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)) + .Returns(((bool, bool, string?, Guid?, DocumentStatusId?, ConnectorStatusId, bool))default); // Act - async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.UserId, CancellationToken.None).ConfigureAwait(false); + async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); ex.Message.Should().Be($"Connector {connectorId} does not exist"); } + [Fact] + public async Task DeleteConnectorAsync_ThrowsForbiddenException() + { + // Arrange + var connectorId = Guid.NewGuid(); + A.CallTo(() => _connectorsRepository.GetConnectorDeleteDataAsync(connectorId, _identity.CompanyId)) + .Returns((true, false, null, null, null, default, true)); + + // Act + async Task Act() => await _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); + + // Assert + var ex = await Assert.ThrowsAsync(Act); + ex.Message.Should().Be($"company {_identity.CompanyId} is neither provider nor host-company of connector {connectorId}"); + } + #endregion #region GetManagedConnectorForIamUserAsync diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs index ecf2108012..1078806779 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/DocumentsBusinessLogicTests.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.BusinessLogic; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs index 9ac13df71f..61868a475c 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/IdentityProviderBusinessLogicTests.cs @@ -23,10 +23,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.IO; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using System.Text; @@ -110,7 +110,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncAllUncha _provisioningManager, _options); - var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); result.Updated.Should().Be(0); result.Unchanged.Should().Be(numUsers); @@ -144,7 +144,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncWrongCon _provisioningManager, _options); - async Task Act() => await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + async Task Act() => await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); var error = await Assert.ThrowsAsync(Act).ConfigureAwait(false); error.Message.Should().Be($"Only contentType {_csvSettings.ContentType} files are allowed."); @@ -183,7 +183,6 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncEmailCha SetupFakes(users, lines); var changedEmailResult = (string?)null; - var lastEditorId = (Guid?)null; A.CallTo(() => _userRepository.AttachAndModifyCompanyUser(A._, null, A>._)) .Invokes(x => @@ -191,10 +190,9 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncEmailCha var companyUserId = x.Arguments.Get("companyUserId")!; var setOptionalParameters = x.Arguments.Get>("setOptionalParameters"); - var companyUser = new CompanyUser(companyUserId, Guid.Empty); + var companyUser = new CompanyUser(companyUserId); setOptionalParameters?.Invoke(companyUser); changedEmailResult = companyUser.Email; - lastEditorId = companyUser.LastEditorId; } ); @@ -203,7 +201,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncEmailCha _provisioningManager, _options); - var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); result.Updated.Should().Be(1); result.Unchanged.Should().Be(numUsers - 1); @@ -219,8 +217,6 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncEmailCha changedEmailResult.Should().NotBeNull(); changedEmailResult.Should().Be(changedEmail); - lastEditorId.Should().HaveValue(); - lastEditorId!.Value.Should().Be(_companyUserId); A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappened(); } @@ -259,7 +255,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncSharedId _provisioningManager, _options); - var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); result.Updated.Should().Be(0); result.Unchanged.Should().Be(numUsers - 1); @@ -311,7 +307,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncOtherIdp _provisioningManager, _options); - var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); result.Updated.Should().Be(1); result.Unchanged.Should().Be(numUsers - 1); @@ -362,7 +358,7 @@ public async Task TestUploadOwnCompanyUsersIdentityProviderLinkDataAsyncUnknownC _provisioningManager, _options); - var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, (_identity.UserId, _identity.CompanyId), CancellationToken.None).ConfigureAwait(false); + var result = await sut.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(_document, _identity.CompanyId, CancellationToken.None).ConfigureAwait(false); result.Updated.Should().Be(0); result.Unchanged.Should().Be(numUsers - 1); diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs index 0aa1587d7e..81346e3e6b 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/InvitationBusinessLogicTests.cs @@ -24,7 +24,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; @@ -50,7 +49,6 @@ public class InvitationBusinessLogicTests private readonly string _companyName; private readonly string _idpName; private readonly Guid _companyId; - private readonly IdentityData _identity; private readonly Guid _identityProviderId; private readonly Guid _applicationId; private readonly Func _processLine; @@ -78,7 +76,6 @@ public InvitationBusinessLogicTests() _companyId = _fixture.Create(); _identityProviderId = _fixture.Create(); _applicationId = _fixture.Create(); - _identity = new(Guid.NewGuid().ToString(), Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); _processLine = A.Fake>(); @@ -106,7 +103,7 @@ public async Task TestExecuteInvitationSuccess() _mailingService, _options); - await sut.ExecuteInvitation(invitationData, _identity.UserId).ConfigureAwait(false); + await sut.ExecuteInvitation(invitationData).ConfigureAwait(false); A.CallTo(() => _provisioningManager.GetNextCentralIdentityProviderNameAsync()).MustHaveHappened(); A.CallTo(() => _provisioningManager.SetupSharedIdpAsync(A.That.IsEqualTo(_idpName), A.That.IsEqualTo(invitationData.organisationName), A._)).MustHaveHappened(); @@ -148,7 +145,7 @@ public async Task TestExecuteInvitationNoEmailThrows() _mailingService, _options); - Task Act() => sut.ExecuteInvitation(invitationData, _identity.UserId); + Task Act() => sut.ExecuteInvitation(invitationData); var error = await Assert.ThrowsAsync(Act).ConfigureAwait(false); error.Message.Should().Be("email must not be empty (Parameter 'email')"); @@ -177,7 +174,7 @@ public async Task TestExecuteInvitationNoOrganisationNameThrows() _mailingService, _options); - Task Act() => sut.ExecuteInvitation(invitationData, _identity.UserId); + Task Act() => sut.ExecuteInvitation(invitationData); var error = await Assert.ThrowsAsync(Act).ConfigureAwait(false); error.Message.Should().Be("organisationName must not be empty (Parameter 'organisationName')"); @@ -212,7 +209,7 @@ public async Task TestExecuteInvitationCreateUserErrorThrows() _mailingService, _options); - Task Act() => sut.ExecuteInvitation(invitationData, _identity.UserId); + Task Act() => sut.ExecuteInvitation(invitationData); var error = await Assert.ThrowsAsync(Act).ConfigureAwait(false); error.Message.Should().Be(_error.Message); @@ -243,7 +240,7 @@ public async Task TestExecuteInvitationCreateUserThrowsThrows() _mailingService, _options); - Task Act() => sut.ExecuteInvitation(invitationData, _identity.UserId); + Task Act() => sut.ExecuteInvitation(invitationData); var error = await Assert.ThrowsAsync(Act).ConfigureAwait(false); error.Message.Should().Be(_error.Message); @@ -283,7 +280,7 @@ private void SetupFakes() A.CallTo(() => _provisioningManager.GetNextCentralIdentityProviderNameAsync()).Returns(_idpName); A.CallTo(() => _userProvisioningService.CreateOwnCompanyIdpUsersAsync(A._, A>._, A._)) - .ReturnsLazily((CompanyNameIdpAliasData companyNameIdpAliasData, IAsyncEnumerable userCreationInfos, CancellationToken cancellationToken) => + .ReturnsLazily((CompanyNameIdpAliasData _, IAsyncEnumerable userCreationInfos, CancellationToken _) => userCreationInfos.Select(userCreationInfo => _processLine(userCreationInfo))); A.CallTo(() => _processLine(A._)).ReturnsLazily( diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs index cdf32a1e81..e547342dd2 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/ServiceAccountBusinessLogicTests.cs @@ -28,6 +28,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs index 5cd45954fa..d8002a55a0 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/SubscriptionConfigurationBusinessLogicTests.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; @@ -188,7 +189,7 @@ public async Task SetProviderCompanyDetailsAsync_EmptyProviderDetailsId_ReturnsE .Returns((Guid.Empty, null!)); // Act - await _sut.SetProviderCompanyDetailsAsync(providerDetailData, (_identity.UserId, _identity.CompanyId)).ConfigureAwait(false); + await _sut.SetProviderCompanyDetailsAsync(providerDetailData, _identity.CompanyId).ConfigureAwait(false); // Assert A.CallTo(() => _companyRepository.CreateProviderCompanyDetail(A._, A._, A>._)).MustHaveHappened(); @@ -223,7 +224,7 @@ public async Task SetProviderCompanyDetailsAsync_WithServiceProviderDetailsId_Re }); //Act - await _sut.SetProviderCompanyDetailsAsync(providerDetailData, (_identity.UserId, _identity.CompanyId)).ConfigureAwait(false); + await _sut.SetProviderCompanyDetailsAsync(providerDetailData, _identity.CompanyId).ConfigureAwait(false); //Assert A.CallTo(() => _companyRepository.CreateProviderCompanyDetail(A._, A._, null)).MustNotHaveHappened(); @@ -233,7 +234,6 @@ public async Task SetProviderCompanyDetailsAsync_WithServiceProviderDetailsId_Re initialDetail!.AutoSetupUrl.Should().Be(existingUrl); modifyDetail.Should().NotBeNull(); modifyDetail!.AutoSetupUrl.Should().Be(changedUrl); - modifyDetail!.LastEditorId.Should().Be(_identity.UserId); } [Fact] @@ -244,7 +244,7 @@ public async Task SetServiceProviderCompanyDetailsAsync_WithUnknownUser_ThrowsEx var providerDetailData = new ProviderDetailData("https://www.service-url.com", null); //Act - async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, (Guid.NewGuid(), Guid.NewGuid())).ConfigureAwait(false); + async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, Guid.NewGuid()).ConfigureAwait(false); //Assert await Assert.ThrowsAsync(Action); @@ -260,7 +260,7 @@ public async Task SetServiceProviderCompanyDetailsAsync_WithNotServiceProvider_T var providerDetailData = new ProviderDetailData("https://www.service-url.com", null); //Act - async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, (_noServiceProviderIdentity.UserId, _noServiceProviderIdentity.CompanyId)).ConfigureAwait(false); + async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, _noServiceProviderIdentity.CompanyId).ConfigureAwait(false); //Assert var ex = await Assert.ThrowsAsync(Action); @@ -282,7 +282,7 @@ public async Task SetServiceProviderCompanyDetailsAsync_WithInvalidUrl_ThrowsExc var providerDetailData = new ProviderDetailData(url!, null); //Act - async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, (_identity.UserId, _identity.CompanyId)).ConfigureAwait(false); + async Task Action() => await _sut.SetProviderCompanyDetailsAsync(providerDetailData, _identity.CompanyId).ConfigureAwait(false); //Assert var ex = await Assert.ThrowsAsync(Action); diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs index 6c127043fe..41703ae599 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/UserBusinessLogicTests.cs @@ -30,6 +30,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; @@ -539,7 +540,6 @@ public async Task TestDeleteOwnUserSuccess() A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappened(); identity.UserStatusId.Should().Be(UserStatusId.DELETED); - identity.LastEditorId.Should().Be(_companyUserId); } [Fact] @@ -961,7 +961,7 @@ public async Task TestDeleteOwnCompanyUsersAsyncSuccess() _options ); - var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, (_identity.UserId, _identity.CompanyId)).ToListAsync().ConfigureAwait(false); + var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, _identity.CompanyId).ToListAsync().ConfigureAwait(false); var expectedCount = companyUserIds.Count(); result.Should().HaveCount(expectedCount); @@ -993,7 +993,7 @@ public async Task TestDeleteOwnCompanyUsersAsyncNoSharedIdpSuccess() _options ); - var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, (_identity.UserId, _identity.CompanyId)).ToListAsync().ConfigureAwait(false); + var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, _identity.CompanyId).ToListAsync().ConfigureAwait(false); var expectedCount = companyUserIds.Count(); result.Should().HaveCount(expectedCount); @@ -1051,7 +1051,7 @@ public async Task TestDeleteOwnCompanyUsersAsyncError() _options ); - var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, (_identity.UserId, _identity.CompanyId)).ToListAsync().ConfigureAwait(false); + var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, _identity.CompanyId).ToListAsync().ConfigureAwait(false); result.Should().HaveCount(companyUserIds.Length - 1); result.Should().Match(r => Enumerable.SequenceEqual(r, companyUserIds.Take(2).Concat(companyUserIds.Skip(3)))); @@ -1105,7 +1105,7 @@ public async Task TestDeleteOwnCompanyUsersAsyncNoSharedIdpError() _options ); - var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, (_identity.UserId, _identity.CompanyId)).ToListAsync().ConfigureAwait(false); + var result = await sut.DeleteOwnCompanyUsersAsync(companyUserIds, _identity.CompanyId).ToListAsync().ConfigureAwait(false); result.Should().HaveCount(companyUserIds.Length - 1); result.Should().Match(r => Enumerable.SequenceEqual(r, companyUserIds.Take(2).Concat(companyUserIds.Skip(3)))); @@ -1345,7 +1345,7 @@ private void SetupFakesForUserCreation(bool isBulkUserCreation) } A.CallTo(() => _userProvisioningService.CreateOwnCompanyIdpUsersAsync(A._, A>._, A._)) - .ReturnsLazily((CompanyNameIdpAliasData companyNameIdpAliasData, IAsyncEnumerable userCreationInfos, CancellationToken cancellationToken) => + .ReturnsLazily((CompanyNameIdpAliasData _, IAsyncEnumerable userCreationInfos, CancellationToken _) => userCreationInfos.Select(userCreationInfo => _processLine(userCreationInfo))); A.CallTo(() => _userProvisioningService.GetIdentityProviderDisplayName(A._)).Returns(_displayName); diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs index 5fd8ccbcc9..468e09b539 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/UserUploadBusinessLogicTests.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; using System.Text; diff --git a/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs index f10784205d..7981e9214f 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/CompanyDataControllerTests.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Extensions; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Net; diff --git a/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs index e8279256bd..345f812a5b 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/ConnectorsControllerTests.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -33,8 +34,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Contr public class ConnectorsControllerTests { - private const string IamUserId = "4C1A6851-D4E7-4E10-A011-3732CD045E8A"; - private readonly IdentityData _identity = new(IamUserId, Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); + private readonly IdentityData _identity = new("4C1A6851-D4E7-4E10-A011-3732CD045E8A", Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); private const string AccessToken = "superSafeToken"; private readonly IConnectorsBusinessLogic _logic; private readonly ConnectorsController _controller; @@ -45,7 +45,7 @@ public ConnectorsControllerTests() _fixture = new Fixture(); _logic = A.Fake(); this._controller = new ConnectorsController(_logic); - _controller.AddControllerContextWithClaimAndBearer(IamUserId, AccessToken, _identity); + _controller.AddControllerContextWithClaimAndBearer(AccessToken, _identity); } [Fact] @@ -75,14 +75,14 @@ public async Task CreateConnectorAsync_WithValidData_ReturnsExpectedResult() null, null); var connectorId = _fixture.Create(); - A.CallTo(() => _logic.CreateConnectorAsync(A._, A<(Guid, Guid)>._, A._)) + A.CallTo(() => _logic.CreateConnectorAsync(A._, A._, A._)) .Returns(connectorId); //Act var result = await this._controller.CreateConnectorAsync(connectorInputModel, CancellationToken.None).ConfigureAwait(false); //Assert - A.CallTo(() => _logic.CreateConnectorAsync(connectorInputModel, new(_identity.UserId, _identity.CompanyId), A._)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.CreateConnectorAsync(connectorInputModel, _identity.CompanyId, A._)).MustHaveHappenedOnceExactly(); Assert.IsType(result); result.Value.Should().Be(connectorId); } @@ -99,14 +99,14 @@ public async Task CreateManagedConnectorAsync_WithValidData_ReturnsExpectedResul null, null); var connectorId = _fixture.Create(); - A.CallTo(() => _logic.CreateManagedConnectorAsync(A._, A<(Guid, Guid)>._, A._)) + A.CallTo(() => _logic.CreateManagedConnectorAsync(A._, A._, A._)) .Returns(connectorId); //Act var result = await this._controller.CreateManagedConnectorAsync(connectorInputModel, CancellationToken.None).ConfigureAwait(false); //Assert - A.CallTo(() => _logic.CreateManagedConnectorAsync(connectorInputModel, new(_identity.UserId, _identity.CompanyId), A._)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.CreateManagedConnectorAsync(connectorInputModel, _identity.CompanyId, A._)).MustHaveHappenedOnceExactly(); Assert.IsType(result); result.Value.Should().Be(connectorId); } @@ -171,7 +171,7 @@ public async Task DeleteConnector_WithValidData_ReturnsExpectedResult() await this._controller.DeleteConnectorAsync(connectorId, CancellationToken.None).ConfigureAwait(false); //Assert - A.CallTo(() => _logic.DeleteConnectorAsync(connectorId, _identity.UserId, A._)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.DeleteConnectorAsync(connectorId, _identity.CompanyId, A._)).MustHaveHappenedOnceExactly(); } [Fact] diff --git a/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs index 4c9b5fc302..41fc8540fa 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/DocumentsControllerTests.cs @@ -22,6 +22,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Text; diff --git a/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs b/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs index 2a56310bed..8fc502fff4 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/RegistrationControllerTest.cs @@ -25,6 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Text; @@ -33,8 +34,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Contr public class RegistrationControllerTest { - private static readonly string IamUserId = "4C1A6851-D4E7-4E10-A011-3732CD045E8A"; private static readonly string AccessToken = "THISISTHEACCESSTOKEN"; + private readonly IdentityData _identity = new("4C1A6851-D4E7-4E10-A011-3732CD045E8A", Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); private readonly IRegistrationBusinessLogic _logic; private readonly RegistrationController _controller; private readonly IFixture _fixture; @@ -46,7 +47,7 @@ public RegistrationControllerTest() _fixture.Behaviors.Add(new OmitOnRecursionBehavior()); _logic = A.Fake(); this._controller = new RegistrationController(_logic); - _controller.AddControllerContextWithClaimAndBearer(IamUserId, AccessToken); + _controller.AddControllerContextWithClaimAndBearer(AccessToken, _identity); } [Fact] diff --git a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs index f0c796d71f..7575a1d485 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/ServiceAccountControllerTests.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs b/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs index 7dfc926f3f..5a0a7008f6 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/SubscriptionConfigurationControllerTests.cs @@ -23,6 +23,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Controllers; @@ -113,7 +114,7 @@ public async Task SetCompanyDetail_WithValidData_ReturnsNoContent() var result = await this._controller.SetProviderCompanyDetail(data).ConfigureAwait(false); //Assert - A.CallTo(() => _logic.SetProviderCompanyDetailsAsync(data, new(_identity.UserId, _identity.CompanyId))).MustHaveHappenedOnceExactly(); + A.CallTo(() => _logic.SetProviderCompanyDetailsAsync(data, _identity.CompanyId)).MustHaveHappenedOnceExactly(); Assert.IsType(result); } diff --git a/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs b/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs index b814713bb2..c35e7bda60 100644 --- a/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs +++ b/tests/administration/Administration.Service.Tests/Controllers/UserControllerTest.cs @@ -24,6 +24,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Tests.Controllers; diff --git a/tests/maintenance/Maintenance.App.Tests/Setup/TestDbFixture.cs b/tests/maintenance/Maintenance.App.Tests/Setup/TestDbFixture.cs index 5840f96071..b76c873770 100644 --- a/tests/maintenance/Maintenance.App.Tests/Setup/TestDbFixture.cs +++ b/tests/maintenance/Maintenance.App.Tests/Setup/TestDbFixture.cs @@ -24,6 +24,7 @@ using Microsoft.EntityFrameworkCore; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.TestSeeds; using Xunit.Extensions.AssemblyFixture; @@ -67,7 +68,7 @@ public async Task GetPortalDbContext(params Action x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); await context.Database.EnsureCreatedAsync().ConfigureAwait(false); foreach (var seedAction in seedActions) { @@ -93,7 +94,7 @@ await _container.StartAsync() x => x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); await context.Database.MigrateAsync(); BaseSeed.SeedBasedata().Invoke(context); await context.SaveChangesAsync(); diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs index 3569d7f4a0..20957d0567 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppBusinessLogicTests.cs @@ -34,6 +34,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using System.Collections.Immutable; using Xunit; diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs index 6438061a64..77fdd705ba 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppChangeBusinessLogicTest.cs @@ -34,6 +34,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs index 6442509a29..ed26b16f94 100644 --- a/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Apps.Service.Tests/BusinessLogic/AppReleaseBusinessLogicTest.cs @@ -35,6 +35,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using System.Collections.Immutable; using Xunit; diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs index 1c3a59c980..4ac2a93396 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppChangeControllerTest.cs @@ -27,6 +27,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Apps.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using Xunit; @@ -123,8 +124,6 @@ public async Task DeactivateApp_ReturnsNoContent() { //Arrange var appId = _fixture.Create(); - A.CallTo(() => _logic.DeactivateOfferByAppIdAsync(A._, A._)) - .ReturnsLazily(() => Task.CompletedTask); //Act var result = await this._controller.DeactivateApp(appId).ConfigureAwait(false); diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs index 70a18140e1..9fb94fa7ea 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppReleaseProcessControllerTest.cs @@ -28,6 +28,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using Xunit; diff --git a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs index 5659085032..d10403d9ef 100644 --- a/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs +++ b/tests/marketplace/Apps.Service.Tests/Controllers/AppsControllerTests.cs @@ -29,6 +29,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; @@ -38,12 +39,11 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Apps.Service.Controllers.Tests; public class AppsControllerTests { - private static readonly string IamUserId = "4C1A6851-D4E7-4E10-A011-3732CD045E8A"; private readonly string _accessToken = "THISISTHEACCESSTOKEN"; private readonly IFixture _fixture; private readonly IAppsBusinessLogic _logic; private readonly AppsController _controller; - private readonly IdentityData _identity = new(IamUserId, Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); + private readonly IdentityData _identity = new("4C1A6851-D4E7-4E10-A011-3732CD045E8A", Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); public AppsControllerTests() { @@ -54,7 +54,7 @@ public AppsControllerTests() _logic = A.Fake(); this._controller = new AppsController(_logic); - _controller.AddControllerContextWithClaimAndBearer(IamUserId, _accessToken, _identity); + _controller.AddControllerContextWithClaimAndBearer(_accessToken, _identity); } [Fact] diff --git a/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs b/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs index 5830097738..71ed7deae2 100644 --- a/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs +++ b/tests/marketplace/Offer.Library.Web.Tests/OfferDocumentServiceTests.cs @@ -22,10 +22,10 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Web; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; namespace Offer.Library.Web.Tests; diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs index 9e09a50f63..a1364acaa7 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferServiceTests.cs @@ -28,6 +28,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs index a473bb8e85..ff8f061c5c 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferSetupServiceTests.cs @@ -27,6 +27,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; using Org.Eclipse.TractusX.Portal.Backend.Processes.OfferSubscription.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; @@ -117,7 +118,7 @@ public OfferSetupServiceTests() public async Task AutoSetup_WithValidData_ReturnsExpectedNotificationAndSecret(OfferTypeId offerTypeId, bool technicalUserRequired, bool isSingleInstance) { // Arrange - var offerSubscription = new OfferSubscription(Guid.NewGuid(), Guid.Empty, Guid.Empty, OfferSubscriptionStatusId.PENDING, Guid.Empty, Guid.Empty); + var offerSubscription = new OfferSubscription(Guid.NewGuid(), Guid.Empty, Guid.Empty, OfferSubscriptionStatusId.PENDING, Guid.Empty); var companyServiceAccount = new CompanyServiceAccount(Guid.NewGuid(), "test", "test", CompanyServiceAccountTypeId.OWN); var createNotificationsEnumerator = SetupAutoSetup(offerTypeId, offerSubscription, isSingleInstance, companyServiceAccount); var clientId = Guid.NewGuid(); @@ -241,7 +242,7 @@ public async Task AutoSetup_WithValidData_ReturnsExpectedNotificationAndSecret(O public async Task AutoSetup_WithMultipleTechnicalUsers_ThrowsException() { // Arrange - var offerSubscription = new OfferSubscription(Guid.NewGuid(), Guid.Empty, Guid.Empty, OfferSubscriptionStatusId.PENDING, Guid.Empty, Guid.Empty); + var offerSubscription = new OfferSubscription(Guid.NewGuid(), Guid.Empty, Guid.Empty, OfferSubscriptionStatusId.PENDING, Guid.Empty); var companyServiceAccount = new CompanyServiceAccount(Guid.NewGuid(), "test", "test", CompanyServiceAccountTypeId.OWN); SetupAutoSetup(OfferTypeId.APP, offerSubscription, false, companyServiceAccount); var clientId = Guid.NewGuid(); @@ -1079,7 +1080,7 @@ public async Task ActivateSubscription_WithNotExistingOfferSubscription_ThrowsNo public async Task ActivateSubscription_WithValidData_ReturnsExpected(string? requesterEmail, bool isSingleInstance, OfferTypeId offerTypeId) { // Arrange - var offerSubscription = new OfferSubscription(Guid.NewGuid(), _validOfferId, CompanyUserCompanyId, OfferSubscriptionStatusId.PENDING, _identity.UserId, _identity.UserId); + var offerSubscription = new OfferSubscription(Guid.NewGuid(), _validOfferId, CompanyUserCompanyId, OfferSubscriptionStatusId.PENDING, _identity.UserId); var subscriptionProcessData = new List { new(offerSubscription.Id, "https://www.test.de") diff --git a/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs b/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs index e100ec0072..54cd7ca068 100644 --- a/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs +++ b/tests/marketplace/Offers.Library.Tests/Service/OfferSubscriptionServiceTests.cs @@ -27,6 +27,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Collections.Immutable; namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Tests.Service; @@ -121,10 +122,10 @@ public async Task AddOfferSubscription_WithExistingId_CreatesServiceSubscription A.CallTo(() => _offerSubscriptionsRepository.CheckPendingOrActiveSubscriptionExists(A._, A._, A._)) .Returns(false); var companyAssignedApps = new List(); - A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._, A._)) - .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId) => + A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._)) + .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) => { - var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId, creatorId); + var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId); companyAssignedApps.Add(companyAssignedApp); }); @@ -150,10 +151,10 @@ public async Task AddOfferSubscription_WithSalesManagerEqualsReceiver_CreatesSer A.CallTo(() => _offerSubscriptionsRepository.CheckPendingOrActiveSubscriptionExists(A._, A._, A._)) .Returns(false); var companyAssignedApps = new List(); - A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._, A._)) - .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId) => + A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._)) + .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) => { - var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId, creatorId); + var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId); companyAssignedApps.Add(companyAssignedApp); }); @@ -174,10 +175,10 @@ public async Task AddOfferSubscription_WithExistingIdWithoutProviderEmail_Create A.CallTo(() => _offerSubscriptionsRepository.CheckPendingOrActiveSubscriptionExists(A._, A._, A._)) .Returns(false); var companyAssignedApps = new List(); - A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._, A._)) - .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId) => + A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._)) + .Invokes((Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) => { - var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId, creatorId); + var companyAssignedApp = new OfferSubscription(_newOfferSubscriptionId, offerId, companyId, offerSubscriptionStatusId, requesterId); companyAssignedApps.Add(companyAssignedApp); }); @@ -203,7 +204,7 @@ public async Task AddOfferSubscription_WithExistingAppSubscriptionAndProcessStep // Assert A.CallTo(() => _offerSubscriptionsRepository.CheckPendingOrActiveSubscriptionExists(_existingOfferId, _companyId, OfferTypeId.APP)).MustHaveHappenedOnceExactly(); - A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._, A._)).MustHaveHappened(); + A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._)).MustHaveHappened(); A.CallTo(() => _offerSubscriptionsRepository.AttachAndModifyOfferSubscription(subscriptionId, A>._)).MustNotHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcess(A._)).MustHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)).MustHaveHappened(); @@ -224,7 +225,7 @@ public async Task AddOfferSubscription_WithExistingActiveAppSubscription_Throws( // Assert A.CallTo(() => _offerSubscriptionsRepository.CheckPendingOrActiveSubscriptionExists(_existingOfferId, _companyId, OfferTypeId.APP)).MustHaveHappenedOnceExactly(); - A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._, A._)).MustNotHaveHappened(); + A.CallTo(() => _offerSubscriptionsRepository.CreateOfferSubscription(A._, A._, A._, A._)).MustNotHaveHappened(); A.CallTo(() => _offerSubscriptionsRepository.AttachAndModifyOfferSubscription(subscriptionId, A>._)).MustNotHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcess(A._)).MustNotHaveHappened(); A.CallTo(() => _processStepRepository.CreateProcessStepRange(A>._)).MustNotHaveHappened(); diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs index 86a42a0575..4bb53257f6 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceBusinessLogicTests.cs @@ -33,6 +33,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; using System.Collections.Immutable; diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceChangeBusinessLogicTests.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceChangeBusinessLogicTests.cs index 1e0ac677d6..778ae7cc99 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceChangeBusinessLogicTests.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceChangeBusinessLogicTests.cs @@ -23,9 +23,9 @@ using FakeItEasy; using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Xunit; diff --git a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs index c5950d409b..8ce6b25c31 100644 --- a/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs +++ b/tests/marketplace/Services.Service.Tests/BusinessLogic/ServiceReleaseBusinessLogicTest.cs @@ -34,6 +34,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs index 85c98d58cf..68d4030e9a 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceChangeControllerTest.cs @@ -21,8 +21,8 @@ using AutoFixture; using FakeItEasy; using Microsoft.AspNetCore.Mvc; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs index 6e34ce5591..ceba7a189c 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceControllerTest.cs @@ -26,6 +26,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; @@ -37,10 +38,9 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Services.Service.Tests.Controllers public class ServiceControllerTest { - private static readonly string IamUserId = "4C1A6851-D4E7-4E10-A011-3732CD045E8A"; private const string AccessToken = "THISISTHEACCESSTOKEN"; private static readonly Guid ServiceId = new("4C1A6851-D4E7-4E10-A011-3732CD045453"); - private readonly IdentityData _identity = new(IamUserId, Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); + private readonly IdentityData _identity = new("4C1A6851-D4E7-4E10-A011-3732CD045E8A", Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); private readonly IFixture _fixture; private readonly IServiceBusinessLogic _logic; private readonly ServicesController _controller; @@ -50,7 +50,7 @@ public ServiceControllerTest() _fixture = new Fixture(); _logic = A.Fake(); this._controller = new ServicesController(_logic); - _controller.AddControllerContextWithClaimAndBearer(IamUserId, AccessToken, _identity); + _controller.AddControllerContextWithClaimAndBearer(AccessToken, _identity); } [Fact] diff --git a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs index d3e9eeb8e8..3108ee72dd 100644 --- a/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs +++ b/tests/marketplace/Services.Service.Tests/Controllers/ServiceReleaseControllerTest.cs @@ -26,6 +26,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.Controllers; using Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels; @@ -37,9 +38,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Services.Service.Tests.Controllers public class ServiceReleaseControllerTest { - private const string IamUserId = "4C1A6851-D4E7-4E10-A011-3732CD045E8A"; private const string AccessToken = "THISISTHEACCESSTOKEN"; - private readonly IdentityData _identity = new(IamUserId, Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); + private readonly IdentityData _identity = new("4C1A6851-D4E7-4E10-A011-3732CD045E8A", Guid.NewGuid(), IdentityTypeId.COMPANY_USER, Guid.NewGuid()); private static readonly Guid ServiceId = new("4C1A6851-D4E7-4E10-A011-3732CD045453"); private readonly IFixture _fixture; private readonly IServiceReleaseBusinessLogic _logic; @@ -49,7 +49,7 @@ public ServiceReleaseControllerTest() _fixture = new Fixture(); _logic = A.Fake(); this._controller = new ServiceReleaseController(_logic); - _controller.AddControllerContextWithClaimAndBearer(IamUserId, AccessToken, _identity); + _controller.AddControllerContextWithClaimAndBearer(AccessToken, _identity); } [Fact] diff --git a/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs b/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs index 8e6eda63c8..3e81ce1d53 100644 --- a/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs +++ b/tests/notifications/Notifications.Service.Tests/BusinessLogic/NotificationBusinessLogicTests.cs @@ -32,6 +32,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Xunit; diff --git a/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs b/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs index f880e54a29..1c4db921f6 100644 --- a/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs +++ b/tests/notifications/Notifications.Service.Tests/Controllers/NotificationControllerTest.cs @@ -28,6 +28,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Notifications.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using Xunit; @@ -45,7 +46,7 @@ public NotificationControllerTest() _fixture = new Fixture(); _logic = A.Fake(); this._controller = new NotificationController(_logic); - _controller.AddControllerContextWithClaimAndBearer(_identity.UserEntityId, "THISISTHEACCESSTOKEN", _identity); + _controller.AddControllerContextWithClaimAndBearer("THISISTHEACCESSTOKEN", _identity); } [Fact] diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs index 68fbe33587..2a62498e83 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ApplicationChecklistRepositoryTests.cs @@ -174,7 +174,7 @@ public async Task GetChecklistProcessStepData_WithExisting_ReturnsExpected() // Assert result.Should().NotBeNull(); result!.IsSubmitted.Should().BeTrue(); - result.Checklist.Should().HaveCount(5).And.Contain(checklistData); + result.Checklist.Should().HaveCount(5).And.ContainInOrder(checklistData!); result.Process!.Id.Should().Be(new Guid("1f9a3232-9772-4ecb-8f50-c16e97772dfe")); result.Process.ProcessTypeId.Should().Be(ProcessTypeId.APPLICATION_CHECKLIST); result.Process.LockExpiryDate.Should().Be(DateTimeOffset.Parse("2023-03-01 00:00:00.000000 +00:00")); diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ConnectorRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ConnectorRepositoryTests.cs index 79ebd20c69..324c5219d0 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ConnectorRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ConnectorRepositoryTests.cs @@ -81,7 +81,6 @@ public async Task CreateConnector_WithServiceAccount_ReturnsExpected() var result = sut.CreateConnector("Test connector", "de", "https://www.test.de", con => { con.ProviderId = new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87"); - con.LastEditorId = new Guid("d0c8ae19-d4f3-49cc-9cb4-6c766d4680f2"); }); // Assert @@ -89,9 +88,9 @@ public async Task CreateConnector_WithServiceAccount_ReturnsExpected() var changedEntries = changeTracker.Entries().ToList(); result.Name.Should().Be("Test connector"); changeTracker.HasChanges().Should().BeTrue(); - changedEntries.Should().NotBeEmpty(); - changedEntries.Should().HaveCount(1); - changedEntries.Single().Entity.Should().BeOfType().Which.Name.Should().Be("Test connector"); + changedEntries.Should().ContainSingle() + .Which.Entity.Should().BeOfType() + .Which.Name.Should().Be("Test connector"); } #endregion @@ -255,11 +254,12 @@ public async Task GetSelfDescriptionDocumentDataAsync_WithoutDocumentId_ReturnsE var (sut, _) = await CreateSut().ConfigureAwait(false); // Act - var result = await sut.GetConnectorDeleteDataAsync(new Guid("7e86a0b8-6903-496b-96d1-0ef508206833")).ConfigureAwait(false); + var result = await sut.GetConnectorDeleteDataAsync(new Guid("7e86a0b8-6903-496b-96d1-0ef508206833"), new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87")).ConfigureAwait(false); // Assert result.Should().NotBeNull(); result.IsValidConnectorId.Should().BeTrue(); + result.IsProvidingOrHostCompany.Should().BeTrue(); result.SelfDescriptionDocumentId.Should().BeNull(); result.DocumentStatusId.Should().BeNull(); } @@ -271,15 +271,31 @@ public async Task GetSelfDescriptionDocumentDataAsync_WithDocumentId_ReturnsExpe var (sut, _) = await CreateSut().ConfigureAwait(false); // Act - var result = await sut.GetConnectorDeleteDataAsync(new Guid("7e86a0b8-6903-496b-96d1-0ef508206839")).ConfigureAwait(false); + var result = await sut.GetConnectorDeleteDataAsync(new Guid("7e86a0b8-6903-496b-96d1-0ef508206839"), new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87")).ConfigureAwait(false); // Assert result.Should().NotBeNull(); result.IsValidConnectorId.Should().BeTrue(); + result.IsProvidingOrHostCompany.Should().BeTrue(); result.SelfDescriptionDocumentId.Should().Be(new Guid("e020787d-1e04-4c0b-9c06-bd1cd44724b3")); result.DocumentStatusId.Should().Be(DocumentStatusId.LOCKED); } + [Fact] + public async Task GetSelfDescriptionDocumentDataAsync_WithoutExistingCompanyId_ReturnsExpected() + { + // Arrange + var (sut, _) = await CreateSut().ConfigureAwait(false); + + // Act + var result = await sut.GetConnectorDeleteDataAsync(new Guid("7e86a0b8-6903-496b-96d1-0ef508206839"), Guid.NewGuid()).ConfigureAwait(false); + + // Assert + result.Should().NotBeNull(); + result.IsValidConnectorId.Should().BeTrue(); + result.IsProvidingOrHostCompany.Should().BeFalse(); + } + [Fact] public async Task GetSelfDescriptionDocumentDataAsync_WithoutExistingConnectorId_ReturnsExpected() { @@ -287,7 +303,7 @@ public async Task GetSelfDescriptionDocumentDataAsync_WithoutExistingConnectorId var (sut, _) = await CreateSut().ConfigureAwait(false); // Act - var result = await sut.GetConnectorDeleteDataAsync(new Guid()).ConfigureAwait(false); + var result = await sut.GetConnectorDeleteDataAsync(new Guid(), new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87")).ConfigureAwait(false); // Assert result.Should().NotBeNull(); diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ConsentRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ConsentRepositoryTests.cs index 7164269b26..ca43e70d3a 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ConsentRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ConsentRepositoryTests.cs @@ -214,19 +214,19 @@ public async Task AddAttachAndModifyConsents_ReturnsExpected() .And.Satisfy( x => x.Id == consentId_1 && x.AgreementId == agreementId_1 && x.ConsentStatusId == ConsentStatusId.ACTIVE, x => x.Id == consentId_2 && x.AgreementId == agreementId_2 && x.ConsentStatusId == ConsentStatusId.INACTIVE, - x => x.Id == consentId_3 && x.AgreementId == agreementId_3 && x.ConsentStatusId == ConsentStatusId.ACTIVE && x.LastEditorId == companyUserId, - x => x.Id == consentId_4 && x.AgreementId == agreementId_4 && x.ConsentStatusId == ConsentStatusId.INACTIVE && x.LastEditorId == companyUserId, - x => x.AgreementId == agreementId_5 && x.ConsentStatusId == ConsentStatusId.ACTIVE && x.LastEditorId == companyUserId, - x => x.AgreementId == agreementId_6 && x.ConsentStatusId == ConsentStatusId.INACTIVE && x.LastEditorId == companyUserId + x => x.Id == consentId_3 && x.AgreementId == agreementId_3 && x.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.Id == consentId_4 && x.AgreementId == agreementId_4 && x.ConsentStatusId == ConsentStatusId.INACTIVE, + x => x.AgreementId == agreementId_5 && x.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.AgreementId == agreementId_6 && x.ConsentStatusId == ConsentStatusId.INACTIVE ); context.ChangeTracker.Entries().Should().HaveCount(6); context.ChangeTracker.Entries().Should().HaveCount(4) .And.Satisfy( - x => x.State == EntityState.Modified && x.Entity.Id == consentId_3 && x.Entity.AgreementId == agreementId_3 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Modified && x.Entity.Id == consentId_4 && x.Entity.AgreementId == agreementId_4 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_5 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_6 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE && x.Entity.LastEditorId == companyUserId + x => x.State == EntityState.Modified && x.Entity.Id == consentId_3 && x.Entity.AgreementId == agreementId_3 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.State == EntityState.Modified && x.Entity.Id == consentId_4 && x.Entity.AgreementId == agreementId_4 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE, + x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_5 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_6 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE ); var addedConsents = context.ChangeTracker.Entries().Where(x => x.State == EntityState.Added).Select(x => x.Entity).ToArray(); @@ -280,19 +280,19 @@ public async Task AddAttachAndModifyConsents_CompanyRole_ReturnsExpected() .And.Satisfy( x => x.Id == consentId_1 && x.AgreementId == agreementId_1 && x.ConsentStatusId == ConsentStatusId.ACTIVE, x => x.Id == consentId_2 && x.AgreementId == agreementId_2 && x.ConsentStatusId == ConsentStatusId.INACTIVE, - x => x.Id == consentId_3 && x.AgreementId == agreementId_3 && x.ConsentStatusId == ConsentStatusId.ACTIVE && x.LastEditorId == companyUserId, - x => x.Id == consentId_4 && x.AgreementId == agreementId_4 && x.ConsentStatusId == ConsentStatusId.INACTIVE && x.LastEditorId == companyUserId, - x => x.AgreementId == agreementId_5 && x.ConsentStatusId == ConsentStatusId.ACTIVE && x.LastEditorId == companyUserId, - x => x.AgreementId == agreementId_6 && x.ConsentStatusId == ConsentStatusId.INACTIVE && x.LastEditorId == companyUserId + x => x.Id == consentId_3 && x.AgreementId == agreementId_3 && x.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.Id == consentId_4 && x.AgreementId == agreementId_4 && x.ConsentStatusId == ConsentStatusId.INACTIVE, + x => x.AgreementId == agreementId_5 && x.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.AgreementId == agreementId_6 && x.ConsentStatusId == ConsentStatusId.INACTIVE ); context.ChangeTracker.Entries().Should().HaveCount(4); context.ChangeTracker.Entries().Should().HaveCount(4) .And.Satisfy( - x => x.State == EntityState.Modified && x.Entity.Id == consentId_3 && x.Entity.AgreementId == agreementId_3 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Modified && x.Entity.Id == consentId_4 && x.Entity.AgreementId == agreementId_4 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_5 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE && x.Entity.LastEditorId == companyUserId, - x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_6 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE && x.Entity.LastEditorId == companyUserId + x => x.State == EntityState.Modified && x.Entity.Id == consentId_3 && x.Entity.AgreementId == agreementId_3 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.State == EntityState.Modified && x.Entity.Id == consentId_4 && x.Entity.AgreementId == agreementId_4 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE, + x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_5 && x.Entity.ConsentStatusId == ConsentStatusId.ACTIVE, + x => x.State == EntityState.Added && x.Entity.AgreementId == agreementId_6 && x.Entity.ConsentStatusId == ConsentStatusId.INACTIVE ); } #region diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalDbContextTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalDbContextTests.cs new file mode 100644 index 0000000000..b9133d69f0 --- /dev/null +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/PortalDbContextTests.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Xunit.Extensions.AssemblyFixture; + +namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests; + +public class PortalDbContextTests : IAssemblyFixture +{ + private readonly TestDbFixture _dbTestDbFixture; + + public PortalDbContextTests(TestDbFixture testDbFixture) + { + var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); + fixture.Behaviors.OfType().ToList() + .ForEach(b => fixture.Behaviors.Remove(b)); + + fixture.Behaviors.Add(new OmitOnRecursionBehavior()); + _dbTestDbFixture = testDbFixture; + } + + #region SaveAuditableEntity + + [Fact] + public async Task SaveAuditableEntity_SetsLastEditorId() + { + // Arrange + var sut = await CreateContext().ConfigureAwait(false); + using var trans = await sut.Database.BeginTransactionAsync().ConfigureAwait(false); + var ca = await sut.CompanyApplications.FirstAsync().ConfigureAwait(false); + + // Act + ca.DateLastChanged = DateTimeOffset.UtcNow; + await sut.SaveChangesAsync().ConfigureAwait(false); + + // Assert + ca.LastEditorId.Should().NotBeNull().And.Be(new Guid("ac1cf001-7fbc-1f2f-817f-bce058020001")); + await trans.RollbackAsync().ConfigureAwait(false); + } + + #endregion + + private async Task CreateContext() => + await _dbTestDbFixture.GetPortalDbContext().ConfigureAwait(false); +} diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs index d31ec65850..1b266fefb2 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/ServiceAccountRespotitoryTests.cs @@ -185,8 +185,8 @@ public async Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync_WithoutE #region GetOwnCompanyServiceAccountDetailedDataUntrackedAsync [Theory] - [InlineData(9, 0, 10, 9)] - [InlineData(9, 1, 9, 8)] + [InlineData(10, 0, 10, 10)] + [InlineData(10, 1, 9, 9)] public async Task GetOwnCompanyServiceAccountsUntracked_ReturnsExpectedResult(int count, int page, int size, int expected) { // Arrange diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Setup/TestDbFixture.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/Setup/TestDbFixture.cs index 4b6e44671b..9d5f7e8942 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Setup/TestDbFixture.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Setup/TestDbFixture.cs @@ -27,6 +27,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Xunit.Extensions.AssemblyFixture; [assembly: TestFramework(AssemblyFixtureFramework.TypeName, AssemblyFixtureFramework.AssemblyName)] @@ -70,7 +71,7 @@ public async Task GetPortalDbContext(params Action x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); await context.Database.EnsureCreatedAsync().ConfigureAwait(false); foreach (var seedAction in seedActions) { @@ -96,7 +97,7 @@ await _container.StartAsync() x => x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); await context.Database.MigrateAsync(); var seederOptions = Options.Create(new SeederSettings diff --git a/tests/portalbackend/PortalBackend.Migrations.Tests/ConsortiaDataDbFixture.cs b/tests/portalbackend/PortalBackend.Migrations.Tests/ConsortiaDataDbFixture.cs index f24912eb6c..3004ff8e0e 100644 --- a/tests/portalbackend/PortalBackend.Migrations.Tests/ConsortiaDataDbFixture.cs +++ b/tests/portalbackend/PortalBackend.Migrations.Tests/ConsortiaDataDbFixture.cs @@ -27,6 +27,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Tests; @@ -67,7 +68,7 @@ public PortalDbContext GetPortalDbContext() x => x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); return context; } @@ -86,7 +87,7 @@ await _container.StartAsync() x => x.MigrationsAssembly(typeof(BatchInsertSeeder).Assembly.GetName().Name) .MigrationsHistoryTable("__efmigrations_history_portal") ); - var context = new PortalDbContext(optionsBuilder.Options); + var context = new PortalDbContext(optionsBuilder.Options, new FakeIdentityService()); await context.Database.MigrateAsync(); var seederOptions = Options.Create(new SeederSettings diff --git a/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs b/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs index abc81f8fcc..1373f68f2b 100644 --- a/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs +++ b/tests/provisioning/Provisioning.Library.Tests/UserProvisioningServiceCreateUsersTests.cs @@ -262,8 +262,8 @@ public async Task TestCreateUsersNotExistingCompanyUserWithoutKeycloakUserSucces { UserEntityId = centralUserId }); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, A._, A._, A._)) - .ReturnsLazily((Guid _, string? firstName, string? lastName, string email, Guid creatorId) => new CompanyUser(identityId, creatorId) { Firstname = firstName, Lastname = lastName, Email = email }); + A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, A._, A._)) + .ReturnsLazily((Guid _, string? firstName, string? lastName, string email) => new CompanyUser(identityId) { Firstname = firstName, Lastname = lastName, Email = email }); A.CallTo(() => _provisioningManager.CreateCentralUserAsync(A.That.Matches(u => u.FirstName == userInfo.FirstName), A)>>._)) .Returns(centralUserId); @@ -278,8 +278,8 @@ public async Task TestCreateUsersNotExistingCompanyUserWithoutKeycloakUserSucces A.CallTo(() => _provisioningManager.CreateCentralUserAsync(A._, A)>>._)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); A.CallTo(() => _provisioningManager.CreateCentralUserAsync(A.That.Matches(u => u.FirstName == userInfo.FirstName), A)>>._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _userRepository.CreateIdentity(_companyNameIdpAliasData.CompanyId, UserStatusId.ACTIVE)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._, _companyNameIdpAliasData.CompanyUserId)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, userInfo.LastName, userInfo.Email, _companyNameIdpAliasData.CompanyUserId)).MustHaveHappenedOnceExactly(); + A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); + A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, userInfo.LastName, userInfo.Email)).MustHaveHappenedOnceExactly(); A.CallTo(() => _businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(A._, _companyNameIdpAliasData.BusinessPartnerNumber!)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); A.CallTo(() => _businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(identityId, _companyNameIdpAliasData.BusinessPartnerNumber!)).MustHaveHappenedOnceExactly(); @@ -314,8 +314,8 @@ public async Task TestCreateUsersExistingCompanyUserWithoutKeycloakUserSuccess() A.CallTo(() => _provisioningManager.CreateCentralUserAsync(A._, A)>>._)).MustHaveHappened(userCreationInfoIdp.Count, Times.Exactly); A.CallTo(() => _provisioningManager.CreateCentralUserAsync(A.That.Matches(u => u.FirstName == userInfo.FirstName), A)>>._)).MustHaveHappenedOnceExactly(); A.CallTo(() => _userRepository.CreateIdentity(A._, UserStatusId.ACTIVE)).MustHaveHappened(userCreationInfoIdp.Count - 1, Times.Exactly); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._, _companyNameIdpAliasData.CompanyUserId)).MustHaveHappened(userCreationInfoIdp.Count - 1, Times.Exactly); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, A._, A._, A._)).MustNotHaveHappened(); + A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._)).MustHaveHappened(userCreationInfoIdp.Count - 1, Times.Exactly); + A.CallTo(() => _userRepository.CreateCompanyUser(A._, userInfo.FirstName, A._, A._)).MustNotHaveHappened(); A.CallTo(() => _businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(A._, _companyNameIdpAliasData.BusinessPartnerNumber!)).MustHaveHappened(userCreationInfoIdp.Count - 1, Times.Exactly); A.CallTo(() => _businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(companyUserId, A._)).MustNotHaveHappened(); @@ -416,11 +416,10 @@ private void SetupRepositories() userStatusId, IdentityTypeId.COMPANY_USER)); - A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._, A._)) - .ReturnsLazily((Guid _, string firstName, string _, string _, Guid lastEditorId) => + A.CallTo(() => _userRepository.CreateCompanyUser(A._, A._, A._, A._)) + .ReturnsLazily((Guid _, string firstName, string _, string _) => new CompanyUser( - firstName == _firstNameSpecialUser ? _companyUserIdSpecialUser : Guid.NewGuid(), - lastEditorId)); + firstName == _firstNameSpecialUser ? _companyUserIdSpecialUser : Guid.NewGuid())); A.CallTo(() => _businessPartnerRepository.CreateCompanyUserAssignedBusinessPartner(A._, A._)) .ReturnsLazily((Guid companyUserId, string businessPartnerNumber) => new CompanyUserAssignedBusinessPartner(companyUserId, businessPartnerNumber)); diff --git a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs index 17a66d9426..5d21aca39f 100644 --- a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs +++ b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs @@ -32,6 +32,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; @@ -472,7 +473,7 @@ public async Task SetCompanyWithAddressAsync_WithMissingData_ThrowsArgumentExcep var companyData = new CompanyDetailData(Guid.NewGuid(), name!, city!, streetName!, countryCode!, null, null, null, null, null, null, uniqueIdData); // Act - async Task Act() => await sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, _fixture.Create()).ConfigureAwait(false); + async Task Act() => await sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, Guid.NewGuid()).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act); @@ -861,7 +862,7 @@ public async Task SetCompanyWithAddressAsync_WithInvalidCountryCode_Throws() .Returns((false, null!)); // Act - var Act = () => sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, _fixture.Create()); + var Act = () => sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, Guid.NewGuid()); //Assert var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -893,7 +894,7 @@ public async Task SetCompanyWithAddressAsync_WithInvalidUniqueIdentifiers_Throws .Returns((true, new[] { identifiers.First() })); // Act - var Act = () => sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, _fixture.Create()); + var Act = () => sut.SetCompanyDetailDataAsync(Guid.NewGuid(), companyData, Guid.NewGuid()); //Assert var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -920,7 +921,7 @@ public async Task SetOwnCompanyApplicationStatusAsync_WithInvalidStatus_ThrowsCo null!); // Act - async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, 0, _fixture.Create()).ConfigureAwait(false); + async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, 0, Guid.NewGuid()).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -945,7 +946,7 @@ public async Task SetOwnCompanyApplicationStatusAsync_WithInvalidApplication_Thr .ReturnsLazily(() => new ValueTuple()); // Act - async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.VERIFY, _fixture.Create()).ConfigureAwait(false); + async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.VERIFY, Guid.NewGuid()).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -970,7 +971,7 @@ public async Task SetOwnCompanyApplicationStatusAsync_WithInvalidStatus_ThrowsAr .ReturnsLazily(() => new ValueTuple(true, CompanyApplicationStatusId.CREATED)); // Act - async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.VERIFY, _fixture.Create()).ConfigureAwait(false); + async Task Act() => await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.VERIFY, Guid.NewGuid()).ConfigureAwait(false); // Assert var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); @@ -995,7 +996,7 @@ public async Task SetOwnCompanyApplicationStatusAsync_WithValidData_SavesChanges .ReturnsLazily(() => new ValueTuple(true, CompanyApplicationStatusId.VERIFY)); // Act - await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.SUBMITTED, _fixture.Create()).ConfigureAwait(false); + await sut.SetOwnCompanyApplicationStatusAsync(applicationId, CompanyApplicationStatusId.SUBMITTED, Guid.NewGuid()).ConfigureAwait(false); // Assert A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); diff --git a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs index 140aa2b154..8303199fcc 100644 --- a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs +++ b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs @@ -25,6 +25,7 @@ using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Controllers; @@ -48,7 +49,7 @@ public RegistrationControllerTest() _registrationBusinessLogicFake = A.Fake(); var registrationLoggerFake = A.Fake>(); _controller = new RegistrationController(registrationLoggerFake, _registrationBusinessLogicFake); - _controller.AddControllerContextWithClaimAndBearer(_identity.UserEntityId, "ac-token", _identity); + _controller.AddControllerContextWithClaimAndBearer("ac-token", _identity); } [Fact] diff --git a/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs b/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs index 4d8bcd286d..639fc60194 100644 --- a/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs +++ b/tests/shared/Tests.Shared/Extensions/ControllerExtensions.cs @@ -22,7 +22,7 @@ using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using System.Security.Claims; namespace Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; @@ -66,19 +66,15 @@ public static void AddControllerContextWithClaim(this ControllerBase controller, /// Creates a claum for the identity user and adds it to the controller context /// /// The controller that should be enriched - /// Id of the iamUser /// Access token /// Identity of the user - public static void AddControllerContextWithClaimAndBearer(this ControllerBase controller, string iamUserId, string accessToken, IdentityData? identity = null) + public static void AddControllerContextWithClaimAndBearer(this ControllerBase controller, string accessToken, IdentityData identity) { var claimsIdentity = new ClaimsIdentity(); - claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.Sub, iamUserId) }); - if (identity != null) - { - claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.IdentityId, identity.UserId.ToString()) }); - claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.IdentityType, Enum.GetName(identity.IdentityType) ?? throw new UnexpectedConditionException("itentityType should never be out of enum-values range here")) }); - claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.CompanyId, identity.CompanyId.ToString()) }); - } + claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.Sub, identity.UserEntityId) }); + claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.IdentityId, identity.UserId.ToString()) }); + claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.IdentityType, Enum.GetName(identity.IdentityType) ?? throw new UnexpectedConditionException("itentityType should never be out of enum-values range here")) }); + claimsIdentity.AddClaims(new[] { new Claim(PortalClaimTypes.CompanyId, identity.CompanyId.ToString()) }); var httpContext = new DefaultHttpContext { diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/InMemoryDbContextFactory.cs b/tests/shared/Tests.Shared/FakeIdentityService.cs similarity index 66% rename from tests/portalbackend/PortalBackend.DBAccess.Tests/InMemoryDbContextFactory.cs rename to tests/shared/Tests.Shared/FakeIdentityService.cs index 497c54f7f7..99c5e3abd9 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/InMemoryDbContextFactory.cs +++ b/tests/shared/Tests.Shared/FakeIdentityService.cs @@ -18,19 +18,14 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Microsoft.EntityFrameworkCore; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests +namespace Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; + +public class FakeIdentityService : IIdentityService { - public static class InMemoryDbContextFactory - { - public static PortalDbContext GetPortalDbContext() - { - var options = new DbContextOptionsBuilder() - .UseInMemoryDatabase(databaseName: "InMemoryPortalDatabase").Options; - var dbContext = new PortalDbContext(options); - return dbContext; - } - } + /// + public IdentityData IdentityData => + new("3d8142f1-860b-48aa-8c2b-1ccb18699f65", new Guid("ac1cf001-7fbc-1f2f-817f-bce058020001"), IdentityTypeId.COMPANY_USER, new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87")); } diff --git a/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs b/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs index 67c0142bec..32ef5e047b 100644 --- a/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs +++ b/tests/shared/Tests.Shared/IntegrationTests/IntegrationTestFactory.cs @@ -30,8 +30,10 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Seeder; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Xunit; namespace Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.IntegrationTests; @@ -67,6 +69,11 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) }); builder.ConfigureTestServices(services => { + var identityService = services.SingleOrDefault(d => d.ServiceType == typeof(IdentityService)); + if (identityService != null) + services.Remove(identityService); + services.AddScoped(); + services.RemoveProdDbContext(); services.AddDbContext(options => { diff --git a/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs b/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs index f7f1b158be..0fc937adcb 100644 --- a/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs +++ b/tests/shared/Tests.Shared/TestSeeds/BaseSeed.cs @@ -128,55 +128,55 @@ public static Action SeedBasedata() => dbContext => dbContext.CompanyUsers.AddRange(new List { - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990"), null) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) { Email = "tester.user1@test.de", Firstname = "Test User 1", Lastname = "cx-user-2", }, - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019991"), null) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019991")) { Email = "tester.user2@test.de", Firstname = "Test User 2", Lastname = "cx-admin-2", }, - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019992"), null) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019992")) { Email = "tester.user3@test.de", Firstname = "Test User 3", Lastname = "company-admin-2", }, - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019993"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058019993")) { Email = "tester.user4@test.de", Firstname = "Test User 4", Lastname = "it-admin-2", }, - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058020000"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058020000")) { Email = "tester.user5@test.de", Firstname = "Test User 5", Lastname = "CX User", }, - new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058020001"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("ac1cf001-7fbc-1f2f-817f-bce058020001")) { Email = "tester.user6@test.de", Firstname = "Test User 6", Lastname = "CX Admin", }, - new(new Guid("40ed8c0d-b506-4c15-b2a9-85fee4b0c280"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("40ed8c0d-b506-4c15-b2a9-85fee4b0c280")) { Email = "tester.user7@test.de", Firstname = "Test User 7", Lastname = "Inactive", }, - new(new Guid("22b7bfef-19f5-4d8a-9fb4-af1a5e978f21"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("22b7bfef-19f5-4d8a-9fb4-af1a5e978f21")) { Email = "tester.user8@test.de", Firstname = "Test User 8", Lastname = "Deleted", }, - new(new Guid("adf37b09-53f3-48ea-b8fb-8cbb7fd79324"), new Guid("ac1cf001-7fbc-1f2f-817f-bce058019990")) + new(new Guid("adf37b09-53f3-48ea-b8fb-8cbb7fd79324")) { Email = "tester.user@test.de", Firstname = "Test User", diff --git a/tests/shared/Tests.Shared/Tests.Shared.csproj b/tests/shared/Tests.Shared/Tests.Shared.csproj index d2dbfc03c3..98a436ba08 100644 --- a/tests/shared/Tests.Shared/Tests.Shared.csproj +++ b/tests/shared/Tests.Shared/Tests.Shared.csproj @@ -22,6 +22,7 @@ Org.Eclipse.TractusX.Portal.Backend.Tests.Shared + Org.Eclipse.TractusX.Portal.Backend.Tests.Shared net6.0 enable enable @@ -48,6 +49,7 @@ + From 9dc4d5aa74106052035ddaedf430614851c11e89 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 31 Jul 2023 14:55:35 +0200 Subject: [PATCH 08/10] feat(bpdm): adjust bpdm service calls to new service (#164) * structure of bpdm service has changed, therefor the models have been aligned * feat(bpdm): Remove FetchBusinessPartner call * feat(bpdm): fix search legal-entity Refs: CPLP-2976 --------- Co-authored-by: Norbert Truchsess Reviewed-By: Norbert Truchsess --- .../Bpdm.Library/Bpdm.Library.csproj | 1 + .../Bpdm.Library/BpdmService.cs | 128 +++--- src/externalsystems/Bpdm.Library/BpnAccess.cs | 65 +++ .../BpdmServiceCollectionExtension.cs | 2 +- .../BpnAccessCollectionExtension.cs | 3 +- .../Bpdm.Library}/IBpnAccess.cs | 6 +- .../Bpdm.Library/Models}/BpdmAddressDto.cs | 22 +- .../Models/BpdmLegalEntityData.cs | 208 +++------- .../Bpdm.Library/Models/BpdmLegalEntityDto.cs | 155 ++++++++ .../Models/BpdmLegalEntityOutputData.cs | 104 +---- .../ApplicationChecklistExtensions.cs | 1 + .../Registration.Service/Bpn/BpnAccess.cs | 128 ------ .../Bpn/Model/BpdmLegalEntityDto.cs | 105 ----- .../Bpn/Model/FetchBusinessPartnerDto.cs | 353 ---------------- .../IRegistrationBusinessLogic.cs | 3 - .../RegistrationBusinessLogic.cs | 72 +--- .../Controllers/RegistrationController.cs | 27 +- .../Registration.Service/Program.cs | 3 +- .../Bpdm.Library/BPNAccessTest.cs | 336 ++++++++++++++++ .../Bpdm.Library/BpdmServiceTests.cs | 47 +-- .../BPNAccessTest.cs | 376 ------------------ .../RegistrationBusinessLogicTest.cs | 92 +---- .../Controller/RegistrationControllerTest.cs | 4 +- 23 files changed, 738 insertions(+), 1503 deletions(-) create mode 100644 src/externalsystems/Bpdm.Library/BpnAccess.cs rename src/externalsystems/Bpdm.Library/{ => DependencyInjection}/BpdmServiceCollectionExtension.cs (96%) rename src/{registration/Registration.Service/Bpn => externalsystems/Bpdm.Library/DependencyInjection}/BpnAccessCollectionExtension.cs (92%) rename src/{registration/Registration.Service/Bpn => externalsystems/Bpdm.Library}/IBpnAccess.cs (72%) rename src/{registration/Registration.Service/Bpn/Model => externalsystems/Bpdm.Library/Models}/BpdmAddressDto.cs (88%) create mode 100644 src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs delete mode 100644 src/registration/Registration.Service/Bpn/BpnAccess.cs delete mode 100644 src/registration/Registration.Service/Bpn/Model/BpdmLegalEntityDto.cs delete mode 100644 src/registration/Registration.Service/Bpn/Model/FetchBusinessPartnerDto.cs create mode 100644 tests/externalsystems/Bpdm.Library/BPNAccessTest.cs delete mode 100644 tests/registration/Registration.Service.Tests/BPNAccessTest.cs diff --git a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj index 260d237f14..7d3e0daf02 100644 --- a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj +++ b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj @@ -29,6 +29,7 @@ + diff --git a/src/externalsystems/Bpdm.Library/BpdmService.cs b/src/externalsystems/Bpdm.Library/BpdmService.cs index 30ecf9ea44..391a68373c 100644 --- a/src/externalsystems/Bpdm.Library/BpdmService.cs +++ b/src/externalsystems/Bpdm.Library/BpdmService.cs @@ -22,7 +22,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions; -using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.Framework.Token; using System.Net.Http.Json; using System.Text.Json; @@ -37,7 +36,10 @@ public class BpdmService : IBpdmService private static readonly JsonSerializerOptions Options = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = { new JsonStringEnumConverter(allowIntegerValues: false) } + Converters = + { + new JsonStringEnumConverter(allowIntegerValues: false), + } }; public BpdmService(ITokenService tokenService, IOptions options) @@ -54,75 +56,54 @@ public async Task PutInputLegalEntity(BpdmTransferData data, CancellationT var requestData = new BpdmLegalEntityData[] { new( - data.ExternalId, // ExternalId - null, // Bpn + data.ExternalId, // Index + Enumerable.Repeat(data.CompanyName, 1), // LegalName + data.ShortName, // LegalShortName + null, // LegalForm data.Identifiers.Select(x => new BpdmIdentifier( - x.Value, // Value - x.BpdmIdentifierId, // Type - null, // IssuingBody - null)), // Status - new BpdmName[] // Names - { - new ( - data.CompanyName, // Value - null, // ShortName - "REGISTERED", // Type - "de") // Language - }, - null, // LegalForm - null, // Status - Enumerable.Empty(), - Enumerable.Empty(), // Types - Enumerable.Empty(), + x.Value, // Value + x.BpdmIdentifierId, // Type + null)), // IssuingBody + Enumerable.Empty(), // Status + Enumerable.Empty(), // Classifications + Enumerable.Empty(), // Roles new BpdmLegalAddress( - new BpdmAddressVersion( - "WESTERN_LATIN_STANDARD", //CharacterSet - "de"), // Version - null, // CareOf - Enumerable.Empty(),// Contexts - data.AlphaCode2, // Country - data.Region == null - ? Enumerable.Empty() - : new BpdmAdministrativeArea[] { - new ( - data.Region, // Value - null, // ShortName - null, // Fipscode - "COUNTY" // Type - ) - }, - data.ZipCode == null - ? Enumerable.Empty() - : new BpdmPostcode[] { - new ( - data.ZipCode, // Value - "REGULAR") // Type - }, - new BpdmLocality[] { - new ( - data.City, // Value - null, // ShortName - "CITY") // Type - }, - new BpdmThoroughfare[] { - new ( - data.StreetName, // Value - null, // Name - null, // ShortName - data.StreetNumber, // Number - null, // Direction - "STREET") // Type - }, - Enumerable.Empty(), - Enumerable.Empty(), - null, // GeographicCoordinates - Enumerable.Empty() // Types - ) + Enumerable.Empty(), // Name + Enumerable.Empty(), // States + Enumerable.Empty(), // Identifiers + new BpdmAddressPhysicalPostalAddress( // PhysicalPostalAddress + null, // GeographicCoordinates + data.AlphaCode2, // Country + data.ZipCode, // PostalCode + data.City, // City + new BpdmStreet( + null, // NamePrefix + null, // AdditionalNamePrefix + data.StreetName, // Name + null, // NameSuffix + null, // AdditionalNameSuffix + data.StreetNumber, // StreetNumber + null, // Milestone + null // Direction + ), + data.Region, // AdministrativeAreaLevel1 + null, // AdministrativeAreaLevel2 + null, // AdministrativeAreaLevel3 + null, // District + null, // CompanyPostalCode + null, // IndustrialZone + null, // Building + null, // Floor + null // Door + ), + null, // AlternativePostalAddress + Enumerable.Empty() + ) ) }; - await httpClient.PutAsJsonAsync("/api/catena/input/legal-entities", requestData, Options, cancellationToken) + await httpClient.PutAsJsonAsync("/companies/test-company/api/catena/input/legal-entities", requestData, Options, cancellationToken) .CatchingIntoServiceExceptionFor("bpdm-put-legal-entities", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false); return true; } @@ -132,28 +113,19 @@ public async Task FetchInputLegalEntity(string extern var httpClient = await _tokenService.GetAuthorizedClient(_settings, cancellationToken).ConfigureAwait(false); var data = Enumerable.Repeat(externalId, 1); - var result = await httpClient.PostAsJsonAsync("/api/catena/output/legal-entities/search", data, Options, cancellationToken) + var result = await httpClient.PostAsJsonAsync("/companies/test-company/api/catena/output/legal-entities/search", data, Options, cancellationToken) .CatchingIntoServiceExceptionFor("bpdm-search-legal-entities", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false); try { - var paginationResponse = await result.Content + var response = await result.Content .ReadFromJsonAsync(Options, cancellationToken) .ConfigureAwait(false); - if (paginationResponse?.Content == null || paginationResponse.Errors == null) + if (response?.Content?.Count() != 1) { throw new ServiceException("Access to external system bpdm did not return a valid legal entity response", true); } - paginationResponse.Errors.IfAny(errors => - throw new ServiceException($"The external system bpdm responded with errors {string.Join(";", errors.Select(x => $"ErrorCode: {x.ErrorCode}, ErrorMessage: {x.Message}"))}")); - try - { - return paginationResponse.Content.Single(x => x.ExternalId == externalId); - } - catch (InvalidOperationException) - { - throw new ServiceException("Access to external system bpdm did not return a valid legal entity response", true); - } + return response.Content.Single(); } catch (JsonException je) { diff --git a/src/externalsystems/Bpdm.Library/BpnAccess.cs b/src/externalsystems/Bpdm.Library/BpnAccess.cs new file mode 100644 index 0000000000..d894c46c9a --- /dev/null +++ b/src/externalsystems/Bpdm.Library/BpnAccess.cs @@ -0,0 +1,65 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 Microsoft and BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; +using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Text.Json; + +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; + +public class BpnAccess : IBpnAccess +{ + private readonly HttpClient _httpClient; + private static readonly JsonSerializerOptions Options = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; + + public BpnAccess(IHttpClientFactory httpFactory) + { + _httpClient = httpFactory.CreateClient(nameof(BpnAccess)); + } + + public async Task FetchLegalEntityByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken) + { + _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); + var uri = new UriBuilder + { + Path = $"pool/api/catena/legal-entities/{Uri.EscapeDataString(businessPartnerNumber)}", + Query = "idType=BPN" + }.Uri; + var result = await _httpClient.GetAsync(uri.PathAndQuery, cancellationToken) + .CatchingIntoServiceExceptionFor("bpn-fetch-legal-entity") + .ConfigureAwait(false); + try + { + var legalEntityResponse = await result.Content.ReadFromJsonAsync(Options, cancellationToken).ConfigureAwait(false); + if (legalEntityResponse?.Bpn == null) + { + throw new ServiceException("Access to external system bpdm did not return a valid legal entity response"); + } + return legalEntityResponse; + } + catch (JsonException je) + { + throw new ServiceException($"Access to external system bpdm did not return a valid json response: {je.Message}"); + } + } +} diff --git a/src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs b/src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs similarity index 96% rename from src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs rename to src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs index 69c2613322..c364267d40 100644 --- a/src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs +++ b/src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs @@ -25,7 +25,7 @@ using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; -namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection; public static class BpdmServiceCollectionExtension { diff --git a/src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs b/src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs similarity index 92% rename from src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs rename to src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs index 17d624f028..b474de05db 100644 --- a/src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs +++ b/src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs @@ -18,9 +18,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging; -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection; public static class BpnAccessCollectionExtension { diff --git a/src/registration/Registration.Service/Bpn/IBpnAccess.cs b/src/externalsystems/Bpdm.Library/IBpnAccess.cs similarity index 72% rename from src/registration/Registration.Service/Bpn/IBpnAccess.cs rename to src/externalsystems/Bpdm.Library/IBpnAccess.cs index 13a73b0e27..f236af4c33 100644 --- a/src/registration/Registration.Service/Bpn/IBpnAccess.cs +++ b/src/externalsystems/Bpdm.Library/IBpnAccess.cs @@ -18,13 +18,11 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; public interface IBpnAccess { - IAsyncEnumerable FetchBusinessPartner(string bpn, string token, CancellationToken cancellationToken); Task FetchLegalEntityByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken); - IAsyncEnumerable FetchLegalEntityAddressByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken); } diff --git a/src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs b/src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs similarity index 88% rename from src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs rename to src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs index 9c83532f23..66bba76561 100644 --- a/src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs +++ b/src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; public record BpdmLegalEntityAddressDto( string LegalEntity, @@ -37,7 +37,7 @@ public record BpdmLegalAddressDto( IEnumerable Premises, IEnumerable PostalDeliveryPoints, BpdmGeographicCoordinatesDto GeographicCoordinates, - IEnumerable Types + IEnumerable Types ); public record BpdmAddressVersionDto( @@ -49,19 +49,19 @@ public record BpdmAdministrativeAreaDto( string Value, string ShortName, string FipsCode, - BpdmUrlDataDto Type, + BpdmTechnicalKey Type, BpdmDataDto Language ); public record BpdmPostCodeDto( string Value, - BpdmUrlDataDto Type + BpdmTechnicalKey Type ); public record BpdmLocalityDto( string Value, string ShortName, - BpdmUrlDataDto Type, + BpdmTechnicalKey Type, BpdmDataDto Language ); @@ -71,7 +71,7 @@ public record BpdmThoroughfareDto( string ShortName, string Number, string Direction, - BpdmUrlDataDto Type, + BpdmTechnicalKey Type, BpdmDataDto Language ); @@ -79,7 +79,7 @@ public record BpdmPremiseDto( string Value, string ShortName, string Number, - BpdmUrlDataDto Type, + BpdmTechnicalKey Type, BpdmDataDto Language ); @@ -87,12 +87,12 @@ public record BpdmPostalDeliveryPointDto( string Value, string ShortName, string Number, - BpdmUrlDataDto Type, + BpdmTechnicalKey Type, BpdmDataDto Language ); public record BpdmGeographicCoordinatesDto( - int Longitude, - int Latitude, - int Altitude + double Longitude, + double Latitude, + double Altitude ); diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs index 5ebe5c69cb..28274d2a15 100644 --- a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs +++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs @@ -24,186 +24,80 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; public record BpdmLegalEntityData( string ExternalId, - string? Bpn, - IEnumerable Identifiers, - IEnumerable Names, + IEnumerable LegalNameParts, + string? LegalShortName, string? LegalForm, - BpdmStatus? Status, - IEnumerable ProfileClassifications, - IEnumerable Types, - IEnumerable? BankAccounts, + IEnumerable Identifiers, + IEnumerable States, + IEnumerable Classifications, + IEnumerable Roles, BpdmLegalAddress LegalAddress ); public record BpdmIdentifier( string Value, BpdmIdentifierId Type, - string? IssuingBody, - string? Status -); - -public record BpdmName( - string Value, - string? ShortName, - string Type, - string Language -); - -public record BpdmLegalForm -( - string TechnicalKey, - string Name, - string Url, - string MainAbbreviation, - BpdmLanguage Language, - IEnumerable Categories -); - -public record BpdmLanguage -( - string TechnicalKey, - string Name -); - -public record BpdmCategory -( - string Name, - string Url + string? IssuingBody ); public record BpdmStatus( string OfficialDenotation, DateTimeOffset ValidFrom, DateTimeOffset ValidUntil, - BpdmType Type + string Type ); public record BpdmProfileClassification( string Value, string Code, - BpdmProfileClassificationType Type -); - -public record BpdmProfileClassificationType -( - string Name, - string Url -); - -public record BpdmType -( - string TechnicalKey, - string Name, - string Url -); - -public record BpdmBankAccount( - IEnumerable TrustScores, - BpdmCurrency Currency, - string InternationalBankAccountIdentifier, - string InternationalBankIdentifier, - string NationalBankAccountIdentifier, - string NationalBankIdentifier -); - -public record BpdmCurrency -( - string TechnicalKey, - string Name -); - -public record BpdmRoles -( - string TechnicalKey, - string Name -); - -public record BpdmReations -( - BpdmRelationClass RelationClass, - BpdmRelationType Type, - string StartNode, - string EndNode, - DateTimeOffset StartedAt, - DateTimeOffset EndedAt -); - -public record BpdmRelationClass -( - string TechnicalKey, - string Name -); - -public record BpdmRelationType -( - string TechnicalKey, - string Name -); - -public record BpdmLegalAddress( - BpdmAddressVersion Version, - string? CareOf, - IEnumerable Contexts, - string Country, - IEnumerable AdministrativeAreas, - IEnumerable PostCodes, - IEnumerable Localities, - IEnumerable Thoroughfares, - IEnumerable Premises, - IEnumerable PostalDeliveryPoints, - BpdmGeographicCoordinates? GeographicCoordinates, - IEnumerable Types -); - -public record BpdmAddressVersion( - string CharacterSet, - string Language -); - -public record BpdmAdministrativeArea( - string Value, - string? ShortName, - string? FipsCode, string Type ); -public record BpdmPostcode( - string Value, - string Type -); - -public record BpdmLocality( - string Value, - string? ShortName, - string Type -); - -public record BpdmThoroughfare( - string Value, - string? Name, - string? ShortName, - string? Number, - string? Direction, - string Type -); - -public record BpdmPremise( - string Value, - string? ShortName, - string? Number, +public record BpdmLegalAddress( + IEnumerable NameParts, + IEnumerable States, + IEnumerable Identifiers, + BpdmAddressPhysicalPostalAddress PhysicalPostalAddress, + BpdmAddressAlternativePostalAddress? AlternativePostalAddress, + IEnumerable Roles +); + +public record BpdmAddressState( + string Description, + DateTimeOffset? ValidFrom, + DateTimeOffset? ValidTo, string Type ); -public record BpdmPostalDeliveryPoint( +public record BpdmAddressIdentifier( string Value, - string? ShortName, - string? Number, - string Type + BpdmIdentifierId Type +); + +public record BpdmAddressPhysicalPostalAddress( + BpdmGeographicCoordinatesDto? GeographicCoordinates, + string? Country, + string? PostalCode, + string? City, + BpdmStreet? Street, + string? AdministrativeAreaLevel1, + string? AdministrativeAreaLevel2, + string? AdministrativeAreaLevel3, + string? District, + string? CompanyPostalCode, + string? IndustrialZone, + string? Building, + string? Floor, + string? Door +); + +public record BpdmAddressAlternativePostalAddress( + BpdmGeographicCoordinatesDto? GeographicCoordinates, + string? Country, + string? PostalCode, + string? City, + string? AdministrativeAreaLevel1, + string? DeliveryServiceNumber, + string? DeliveryServiceType, + string? DeliveryServiceQualifier ); - -public record BpdmGeographicCoordinates( - int Longitude, - int Latitude, - int Altitude -); - diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs new file mode 100644 index 0000000000..cc337c73c6 --- /dev/null +++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs @@ -0,0 +1,155 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 Microsoft and BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using System.Text.Json.Serialization; + +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; + +public record BpdmLegalEntityDto( + [property: JsonPropertyName("bpnl")] string Bpn, + [property: JsonPropertyName("legalName")] string? LegalName, + [property: JsonPropertyName("legalShortName")] string? LegalShortName, + [property: JsonPropertyName("currentness")] DateTimeOffset Currentness, + [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt, + [property: JsonPropertyName("updatedAt")] DateTimeOffset UpdatedAt, + IEnumerable Identifiers, + BpdmLegalFormDto? LegalForm, + IEnumerable Status, + IEnumerable ProfileClassifications, + IEnumerable Relations, + BpdmLegalEntityAddress LegalEntityAddress +); + +public record BpdmIdentifierDto( + string Value, + BpdmTechnicalKey Type, + string IssuingBody +); + +public record BpdmLegalFormDto( + string TechnicalKey, + string Name, + string Abbreviation +); + +public record BpdmStatusDto( + string OfficialDenotation, + DateTimeOffset ValidFrom, + DateTimeOffset ValidUntil, + BpdmTechnicalKey Type +); + +public record BpdmProfileClassificationDto( + string Value, + string Code, + BpdmTechnicalKey Type +); + +public record BpdmDataDto( + string TechnicalKey, + string Name +); + +public record BpdmTechnicalKey( + string TechnicalKey, + string Name +); + +public record BpdmRelationDto( + BpdmTechnicalKey Type, + string StartBpn, + string EndBpn, + DateTimeOffset ValidFrom, + DateTimeOffset ValidTo +); + +public record BpdmLegalEntityAddress +( + string Bpnl, + string Name, + string BpnLegalEntity, + string BpnSite, + DateTimeOffset CreatedAt, + DateTimeOffset UpdatedAt, + bool IsLegalAddress, + bool IsMainAddress, + IEnumerable States, + IEnumerable Identifiers, + BpdmPhysicalPostalAddress? PhysicalPostalAddress, + BpdmAlternativePostalAddress? AlternativePostalAddress +); + +public record BpdmLegalEntityAddressState +( + string Description, + DateTimeOffset ValidFrom, + DateTimeOffset ValidTo, + BpdmTechnicalKey Type +); + +public record BpdmLegalEntityAddressIdentifier +( + string Value, + BpdmTechnicalKey Type +); + +public record BpdmPhysicalPostalAddress( + BpdmGeographicCoordinatesDto? GeographicCoordinates, + BpdmCountry? Country, + string? PostalCode, + string? City, + BpdmStreet? Street, + BpdmAdministrativeAreaLevel? AdministrativeAreaLevel1, + string? AdministrativeAreaLevel2, + string? AdministrativeAreaLevel3, + string? District, + string? CompanyPostalCode, + string? IndustrialZone, + string? Building, + string? Floor, + string? Door +); + +public record BpdmAlternativePostalAddress( + BpdmGeographicCoordinatesDto? GeographicCoordinates, + BpdmCountry? Country, + string? PostalCode, + string? City, + BpdmAdministrativeAreaLevel? AdministrativeAreaLevel1, + string? DeliveryServiceNumber, + string? Type, + string? DeliveryServiceQualifier +); + +public record BpdmAdministrativeAreaLevel( + string? Name, + string? RegionCode +); + +public record BpdmStreet( + string? NamePrefix, + string? AdditionalNamePrefix, + string Name, + string? NameSuffix, + string? AdditionalNameSuffix, + string? HouseNumber, + string? Milestone, + string? Direction +); diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs index 213ce20ae1..0165103730 100644 --- a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs +++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs @@ -21,49 +21,33 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; public record PageOutputResponseBpdmLegalEntityData( - IEnumerable? Content, - IEnumerable Errors + IEnumerable? Content ); public record BpdmLegalEntityOutputData( - string ExternalId, + string? ExternalId, string? Bpn, + string? LegalShortName, + string? LegalForm, IEnumerable Identifiers, - IEnumerable Names, - BpdmLegalForm? LegalForm, - BpdmStatus? Status, - IEnumerable ProfileClassifications, - IEnumerable Types, - IEnumerable? BankAccounts, - IEnumerable Roles, - IEnumerable Relations, + IEnumerable States, + IEnumerable Classifications, + IEnumerable LegalNameParts, + IEnumerable Roles, BpdmLegalAddressResponse LegalAddress ); public record BpdmLegalAddressResponse( - BpdmAddressVersionResponse Version, - string? CareOf, - IEnumerable Contexts, - BpdmCountry Country, - IEnumerable AdministrativeAreas, - IEnumerable PostCodes, - IEnumerable Localities, - IEnumerable Thoroughfares, - IEnumerable Premises, - IEnumerable PostalDeliveryPoints, - BpdmGeographicCoordinates? GeographicCoordinates, - IEnumerable Types -); - -public record BpdmAddressVersionResponse( - BpdmCharacterSet CharacterSet, - BpdmLanguage Language -); - -public record BpdmCharacterSet -( - string TechnicalKey, - string Name + string ExternalId, + string LegalEntityExternalId, + string SiteExternalId, + string Bpn, + IEnumerable NameParts, + IEnumerable States, + IEnumerable Identifiers, + BpdmAddressPhysicalPostalAddress PhysicalPostalAddress, + BpdmAddressAlternativePostalAddress AlternativePostalAddress, + IEnumerable Roles ); public record BpdmCountry @@ -71,55 +55,3 @@ public record BpdmCountry string TechnicalKey, string Name ); - -public record BpdmAdministrativeAreaResponse( - string Value, - string? ShortName, - string? FipsCode, - BpdmType Type, - BpdmLanguage Language -); - -public record BpdmPostcodeResponse( - string Value, - BpdmType Type -); - -public record BpdmLocalityResponse( - string Value, - string? ShortName, - BpdmType Type, - BpdmLanguage Language -); - -public record BpdmThoroughfareResponse( - string Value, - string? Name, - string? ShortName, - string? Number, - string? Direction, - BpdmType Type, - BpdmLanguage Language -); - -public record BpdmPremiseResponse( - string Value, - string? ShortName, - string? Number, - BpdmType Type, - BpdmLanguage Language -); - -public record BpdmPostalDeliveryPointResponse( - string Value, - string? ShortName, - string? Number, - BpdmType Type, - BpdmLanguage Language -); - -public record BpdmErrorInfo( - string ErrorCode, - string Message, - string EntityKey -); diff --git a/src/processes/ApplicationChecklist.Config/ApplicationChecklistExtensions.cs b/src/processes/ApplicationChecklist.Config/ApplicationChecklistExtensions.cs index 49d4af95ef..2c4b16fe70 100644 --- a/src/processes/ApplicationChecklist.Config/ApplicationChecklistExtensions.cs +++ b/src/processes/ApplicationChecklist.Config/ApplicationChecklistExtensions.cs @@ -21,6 +21,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library; using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Token; diff --git a/src/registration/Registration.Service/Bpn/BpnAccess.cs b/src/registration/Registration.Service/Bpn/BpnAccess.cs deleted file mode 100644 index a5931ecdea..0000000000 --- a/src/registration/Registration.Service/Bpn/BpnAccess.cs +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 Microsoft and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Framework.Async; -using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; -using System.Net.Http.Headers; -using System.Runtime.CompilerServices; -using System.Text.Json; - -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; - -public class BpnAccess : IBpnAccess -{ - private readonly HttpClient _httpClient; - - public BpnAccess(IHttpClientFactory httpFactory) - { - _httpClient = httpFactory.CreateClient(nameof(BpnAccess)); - } - - public async IAsyncEnumerable FetchBusinessPartner(string bpn, string token, [EnumeratorCancellation] CancellationToken cancellationToken) - { - _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - var result = await _httpClient.GetAsync($"api/catena/business-partner/{Uri.EscapeDataString(bpn)}", cancellationToken).ConfigureAwait(false); - if (result.IsSuccessStatusCode) - { - await using var responseStream = await result.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - var businesPartnerDto = await JsonSerializer.DeserializeAsync(responseStream, cancellationToken: cancellationToken).ConfigureAwait(false); - if (businesPartnerDto != null) - { - yield return businesPartnerDto; - } - } - else - { - throw new ServiceException($"Access to BPN Failed with Status Code {result.StatusCode}", result.StatusCode); - } - } - - public async Task FetchLegalEntityByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken) - { - _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - var uri = new UriBuilder() - { - Path = $"api/catena/legal-entities/{Uri.EscapeDataString(businessPartnerNumber)}", - Query = "idType=BPN" - }.Uri; - var result = await _httpClient.GetAsync(uri.PathAndQuery, cancellationToken).ConfigureAwait(false); - if (!result.IsSuccessStatusCode) - { - throw new ServiceException($"Access to external system bpdm failed with Status Code {result.StatusCode}", result.StatusCode); - } - await using var responseStream = await result.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - try - { - var legalEntityResponse = await JsonSerializer.DeserializeAsync( - responseStream, - new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }, - cancellationToken: cancellationToken).ConfigureAwait(false); - if (legalEntityResponse?.Bpn == null) - { - throw new ServiceException("Access to external system bpdm did not return a valid legal entity response"); - } - return legalEntityResponse; - } - catch (JsonException je) - { - throw new ServiceException($"Access to external system bpdm did not return a valid json response: {je.Message}"); - } - } - - public async IAsyncEnumerable FetchLegalEntityAddressByBpn(string businessPartnerNumber, string token, [EnumeratorCancellation] CancellationToken cancellationToken) - { - _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - var uri = new UriBuilder() - { - Path = "api/catena/legal-entities/legal-addresses/search" - }.Uri; - var json = new[] { businessPartnerNumber }; - var result = await _httpClient.PostAsJsonAsync(uri.PathAndQuery, json, cancellationToken).ConfigureAwait(false); - if (result.IsSuccessStatusCode) - { - await using var responseStream = await result.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - await foreach (var address in JsonSerializer - .DeserializeAsyncEnumerable( - responseStream, - new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }, - cancellationToken: cancellationToken) - .CatchingAsync( - ex => - { - throw new ServiceException($"Access to external system bpdm did not return a valid json response: {ex.Message}"); - }, - cancellationToken) - .ConfigureAwait(false)) - { - if (address?.LegalAddress == null || address.LegalEntity == null) - { - throw new ServiceException("Access to external system bpdm did not return a valid legal entity address response"); - } - yield return address; - } - } - else - { - throw new ServiceException($"Access to external system bpdm failed with Status Code {result.StatusCode}", result.StatusCode); - } - } -} diff --git a/src/registration/Registration.Service/Bpn/Model/BpdmLegalEntityDto.cs b/src/registration/Registration.Service/Bpn/Model/BpdmLegalEntityDto.cs deleted file mode 100644 index a76dc98e6f..0000000000 --- a/src/registration/Registration.Service/Bpn/Model/BpdmLegalEntityDto.cs +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 Microsoft and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; - -public record BpdmLegalEntityDto( - string Bpn, - IEnumerable Identifiers, - IEnumerable Names, - BpdmLegalFormDto LegalForm, - BpdmStatusDto Status, - IEnumerable ProfileClassifications, - IEnumerable Types, - IEnumerable BankAccounts, - IEnumerable Roles, - IEnumerable Relations, - DateTimeOffset Currentness -); - -public record BpdmIdentifierDto( - string Value, - BpdmUrlDataDto Type, - BpdmUrlDataDto IssuingBody, - BpdmDataDto Status -); - -public record BpdmNameDto( - string Value, - string ShortName, - BpdmUrlDataDto Type, - BpdmDataDto Language -); - -public record BpdmLegalFormDto( - string TechnicalKey, - string Name, - string Url, - string MainAbbreviation, - BpdmDataDto Language, - IEnumerable Categories -); - -public record BpdmStatusDto( - string OfficialDenotation, - DateTimeOffset ValidFrom, - DateTimeOffset ValidUntil, - BpdmUrlDataDto Type -); - -public record BpdmProfileClassificationDto( - string Value, - string Code, - BpdmNameUrlDto Type -); - -public record BpdmDataDto( - string TechnicalKey, - string Name -); - -public record BpdmUrlDataDto( - string TechnicalKey, - string Name, - string Url -); - -public record BpdmNameUrlDto( - string Name, - string Url -); - -public record BpdmBankAccountDto( - IEnumerable TrustScores, - BpdmDataDto Currency, - string InternationalBankAccountIdentifier, - string InternationalBankIdentifier, - string NationalBankAccountIdentifier, - string NationalBankIdentifier -); - -public record BpdmRelationDto( - BpdmDataDto RelationClass, - BpdmDataDto Type, - string StartNode, - string EndNode, - DateTimeOffset StartedAt, - DateTimeOffset EndedAt -); diff --git a/src/registration/Registration.Service/Bpn/Model/FetchBusinessPartnerDto.cs b/src/registration/Registration.Service/Bpn/Model/FetchBusinessPartnerDto.cs deleted file mode 100644 index bd1545044f..0000000000 --- a/src/registration/Registration.Service/Bpn/Model/FetchBusinessPartnerDto.cs +++ /dev/null @@ -1,353 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 Microsoft and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using System.Text.Json.Serialization; - -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model -{ - [Obsolete("delete as soon endpoint GET /api/registration/company/{bpn} is being removed")] - public class FetchBusinessPartnerDto - { - [JsonPropertyName("bpn")] - public string Bpn { get; set; } = null!; - - [JsonPropertyName("identifiers")] - public Identifier[] Identifiers { get; set; } = null!; - - [JsonPropertyName("names")] - public Name[] Names { get; set; } = null!; - - [JsonPropertyName("legalForm")] - public Legalform? LegalForm { get; set; } - - [JsonPropertyName("status")] - public Status? Status { get; set; } - - [JsonPropertyName("addresses")] - public Address[] Addresses { get; set; } = null!; - - [JsonPropertyName("profileClassifications")] - public object[] ProfileClassifications { get; set; } = null!; - - [JsonPropertyName("types")] - public Type[] Types { get; set; } = null!; - - [JsonPropertyName("bankAccounts")] - public Bankaccount[] BankAccounts { get; set; } = null!; - - [JsonPropertyName("roles")] - public string[] Roles { get; set; } = null!; - - [JsonPropertyName("relations")] - public object[] Relations { get; set; } = null!; - } - - public class Legalform - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - - [JsonPropertyName("url")] - public string Url { get; set; } = null!; - - [JsonPropertyName("mainAbbreviation")] - public string MainAbbreviation { get; set; } = null!; - - [JsonPropertyName("language")] - public Language? Language { get; set; } - - [JsonPropertyName("category")] - public Category[] Category { get; set; } = null!; - } - - public class Bankaccount - { - [JsonPropertyName("trustScores")] - public double[] TrustScores { get; set; } = null!; - - [JsonPropertyName("currencyCode")] - public string CurrencyCode { get; set; } = null!; - - [JsonPropertyName("internationalBankAccountIdentifier")] - public string InternationalBankAccountIdentifier { get; set; } = null!; - - [JsonPropertyName("internationalBankIdentifier")] - public string InternationalBankIdentifier { get; set; } = null!; - - [JsonPropertyName("nationalBankAccountIdentifier")] - public string NationalBankAccountIdentifier { get; set; } = null!; - - [JsonPropertyName("nationalBankIdentifier")] - public string NationalBankIdentifier { get; set; } = null!; - } - - public class Language - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - } - - public class Category - { - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - - [JsonPropertyName("url")] - public string Url { get; set; } = null!; - } - - public class Status - { - [JsonPropertyName("officialDenotation")] - public object OfficialDenotation { get; set; } = null!; - - [JsonPropertyName("validFrom")] - public DateTime? ValidFrom { get; set; } - - [JsonPropertyName("validUntil")] - public object ValidUntil { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - } - - public class Type - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - - [JsonPropertyName("url")] - public string Url { get; set; } = null!; - } - - public class Identifier - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - - [JsonPropertyName("issuingBody")] - public Issuingbody IssuingBody { get; set; } = null!; - - [JsonPropertyName("status")] - public Status Status { get; set; } = null!; - } - - public class Issuingbody - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - - [JsonPropertyName("url")] - public string Url { get; set; } = null!; - } - - public class Name - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("shortName")] - public object ShortName { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - - [JsonPropertyName("language")] - public Language Language { get; set; } = null!; - } - - public class Address - { - [JsonPropertyName("versions")] - public Versions Versions { get; set; } = null!; - - [JsonPropertyName("careOf")] - public object CareOf { get; set; } = null!; - - [JsonPropertyName("contexts")] - public object[] Contexts { get; set; } = null!; - - [JsonPropertyName("country")] - public Country Country { get; set; } = null!; - - [JsonPropertyName("administrativeAreas")] - public Administrativearea[] AdministrativeAreas { get; set; } = null!; - - [JsonPropertyName("postCodes")] - public Postcode[] PostCodes { get; set; } = null!; - - [JsonPropertyName("localities")] - public Locality[] Localities { get; set; } = null!; - - [JsonPropertyName("thoroughfares")] - public Thoroughfare[] Thoroughfares { get; set; } = null!; - - [JsonPropertyName("premises")] - public Premis[] Premises { get; set; } = null!; - - [JsonPropertyName("postalDeliveryPoints")] - public Postaldeliverypoint[] PostalDeliveryPoints { get; set; } = null!; - - [JsonPropertyName("geographicCoordinates")] - public object GeographicCoordinates { get; set; } = null!; - - [JsonPropertyName("types")] - public Type[] Types { get; set; } = null!; - } - - public class Postaldeliverypoint - { - [JsonPropertyName("type")] - public string Type { get; set; } = null!; - - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("shortName")] - public string ShortName { get; set; } = null!; - - [JsonPropertyName("number")] - public int? Number { get; set; } - } - - public class Premis - { - [JsonPropertyName("type")] - public string Type { get; set; } = null!; - - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("shortName")] - public string ShortName { get; set; } = null!; - - [JsonPropertyName("number")] - public int? Number { get; set; } - } - - public class Versions - { - [JsonPropertyName("characterSet")] - public Characterset CharacterSet { get; set; } = null!; - - [JsonPropertyName("language")] - public Language Language { get; set; } = null!; - } - - public class Characterset - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - } - - public class Country - { - [JsonPropertyName("technicalKey")] - public string TechnicalKey { get; set; } = null!; - - [JsonPropertyName("name")] - public string Name { get; set; } = null!; - } - - public class Administrativearea - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("shortName")] - public string ShortName { get; set; } = null!; - - [JsonPropertyName("fipsCode")] - public string FipsCode { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - - [JsonPropertyName("language")] - public Language Language { get; set; } = null!; - } - - public class Postcode - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - } - - public class Locality - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("shortName")] - public object ShortName { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - - [JsonPropertyName("language")] - public Language Language { get; set; } = null!; - } - - public class Thoroughfare - { - [JsonPropertyName("value")] - public string Value { get; set; } = null!; - - [JsonPropertyName("name")] - public object Name { get; set; } = null!; - - [JsonPropertyName("shortName")] - public object ShortName { get; set; } = null!; - - [JsonPropertyName("number")] - public string Number { get; set; } = null!; - - [JsonPropertyName("direction")] - public object Direction { get; set; } = null!; - - [JsonPropertyName("type")] - public Type Type { get; set; } = null!; - - [JsonPropertyName("language")] - public Language Language { get; set; } = null!; - } -} - diff --git a/src/registration/Registration.Service/BusinessLogic/IRegistrationBusinessLogic.cs b/src/registration/Registration.Service/BusinessLogic/IRegistrationBusinessLogic.cs index 4899e0a30b..2125f38e99 100644 --- a/src/registration/Registration.Service/BusinessLogic/IRegistrationBusinessLogic.cs +++ b/src/registration/Registration.Service/BusinessLogic/IRegistrationBusinessLogic.cs @@ -21,15 +21,12 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Model; namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic { public interface IRegistrationBusinessLogic { - [Obsolete($"use {nameof(GetCompanyBpdmDetailDataByBusinessPartnerNumber)} instead")] - IAsyncEnumerable GetCompanyByIdentifierAsync(string companyIdentifier, string token, CancellationToken cancellationToken); Task GetCompanyBpdmDetailDataByBusinessPartnerNumber(string businessPartnerNumber, string token, CancellationToken cancellationToken); IAsyncEnumerable GetClientRolesCompositeAsync(); Task UploadDocumentAsync(Guid applicationId, IFormFile document, DocumentTypeId documentTypeId, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken); diff --git a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs index cf29275daa..9eea69092c 100644 --- a/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs +++ b/src/registration/Registration.Service/BusinessLogic/RegistrationBusinessLogic.cs @@ -19,6 +19,8 @@ ********************************************************************************/ using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; @@ -33,8 +35,6 @@ using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Model; using System.Text.RegularExpressions; @@ -51,7 +51,7 @@ public class RegistrationBusinessLogic : IRegistrationBusinessLogic private readonly ILogger _logger; private readonly IApplicationChecklistCreationService _checklistService; - private static readonly Regex bpnRegex = new Regex(@"(\w|\d){16}", RegexOptions.None, TimeSpan.FromSeconds(1)); + private static readonly Regex bpnRegex = new(@"(\w|\d){16}", RegexOptions.None, TimeSpan.FromSeconds(1)); public RegistrationBusinessLogic( IOptions settings, @@ -76,17 +76,6 @@ public RegistrationBusinessLogic( public IAsyncEnumerable GetClientRolesCompositeAsync() => _portalRepositories.GetInstance().GetClientRolesCompositeAsync(_settings.KeycloakClientID); - [Obsolete($"use {nameof(GetCompanyBpdmDetailDataByBusinessPartnerNumber)} instead")] - public IAsyncEnumerable GetCompanyByIdentifierAsync(string companyIdentifier, string token, CancellationToken cancellationToken) - { - if (!bpnRegex.IsMatch(companyIdentifier)) - { - throw new ControllerArgumentException("BPN must contain exactly 16 digits or letters.", nameof(companyIdentifier)); - } - - return _bpnAccess.FetchBusinessPartner(companyIdentifier, token, cancellationToken); - } - public Task GetCompanyBpdmDetailDataByBusinessPartnerNumber(string businessPartnerNumber, string token, CancellationToken cancellationToken) { if (!bpnRegex.IsMatch(businessPartnerNumber)) @@ -103,27 +92,9 @@ private async Task GetCompanyBpdmDetailDataByBusinessPart { throw new ConflictException("Bpdm did return incorrect bpn legal-entity-data"); } - BpdmLegalEntityAddressDto? legalEntityAddress; - try - { - legalEntityAddress = await _bpnAccess.FetchLegalEntityAddressByBpn(businessPartnerNumber, token, cancellationToken).SingleOrDefaultAsync(cancellationToken).ConfigureAwait(false); - } - catch (InvalidOperationException) - { - throw new ConflictException($"bpdm returned more than a single legalEntityAddress for {businessPartnerNumber}"); - } - if (legalEntityAddress == null) - { - throw new ConflictException($"bpdm returned no legalEntityAddress for {businessPartnerNumber}"); - } - if (!businessPartnerNumber.Equals(legalEntityAddress.LegalEntity, StringComparison.OrdinalIgnoreCase)) - { - throw new ConflictException("Bpdm did return incorrect bpn address-data"); - } - - var legalAddress = legalEntityAddress.LegalAddress; - var country = legalAddress.Country.TechnicalKey; + var country = legalEntity.LegalEntityAddress.PhysicalPostalAddress?.Country?.TechnicalKey ?? + throw new ConflictException("Legal-entity-data did not contain a valid country identifier"); var bpdmIdentifiers = ParseBpdmIdentifierDtos(legalEntity.Identifiers).ToList(); var assignedIdentifiersResult = await _portalRepositories.GetInstance() @@ -140,35 +111,18 @@ private async Task GetCompanyBpdmDetailDataByBusinessPart bpdmIdentifier => bpdmIdentifier.BpdmIdentifierId, (countryIdentifier, bpdmIdentifier) => (countryIdentifier.UniqueIdentifierId, bpdmIdentifier.Value)); - TItem? SingleOrDefaultChecked(IEnumerable items, string itemName) - { - try - { - return items.SingleOrDefault(); - } - catch (InvalidOperationException) - { - throw new ConflictException($"bpdm returned more than a single {itemName} in legal entity for {businessPartnerNumber}"); - } - } - - BpdmNameDto? name = SingleOrDefaultChecked(legalEntity.Names, nameof(name)); - string? administrativeArea = SingleOrDefaultChecked(legalAddress.AdministrativeAreas, nameof(administrativeArea))?.Value; - string? postCode = SingleOrDefaultChecked(legalAddress.PostCodes, nameof(postCode))?.Value; - string? locality = SingleOrDefaultChecked(legalAddress.Localities, nameof(locality))?.Value; - BpdmThoroughfareDto? thoroughfare = SingleOrDefaultChecked(legalAddress.Thoroughfares, nameof(thoroughfare)); - + var physicalPostalAddress = legalEntity.LegalEntityAddress.PhysicalPostalAddress; return new CompanyBpdmDetailData( businessPartnerNumber, country, - name?.Value ?? "", - name?.ShortName ?? "", - locality ?? "", - thoroughfare?.Value ?? "", - administrativeArea, + legalEntity.LegalName ?? "", + legalEntity.LegalShortName ?? "", + physicalPostalAddress?.City ?? "", + physicalPostalAddress?.Street?.Name ?? "", + physicalPostalAddress?.AdministrativeAreaLevel1?.RegionCode, null, // TODO clarify how to map from bpdm data - thoroughfare?.Number, - postCode, + physicalPostalAddress?.Street?.HouseNumber, + physicalPostalAddress?.PostalCode, portalIdentifiers.Select(identifier => new CompanyUniqueIdData(identifier.UniqueIdentifierId, identifier.Value)) ); } diff --git a/src/registration/Registration.Service/Controllers/RegistrationController.cs b/src/registration/Registration.Service/Controllers/RegistrationController.cs index 5d9683fb7e..b8179e8e69 100644 --- a/src/registration/Registration.Service/Controllers/RegistrationController.cs +++ b/src/registration/Registration.Service/Controllers/RegistrationController.cs @@ -20,13 +20,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Model; using System.Net; @@ -39,40 +39,17 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Controllers [Consumes("application/json")] public class RegistrationController : ControllerBase { - private readonly ILogger _logger; private readonly IRegistrationBusinessLogic _registrationBusinessLogic; /// /// Creates a new instance of /// - /// The logger /// Access to the business logic - public RegistrationController(ILogger logger, IRegistrationBusinessLogic registrationBusinessLogic) + public RegistrationController(IRegistrationBusinessLogic registrationBusinessLogic) { - _logger = logger; _registrationBusinessLogic = registrationBusinessLogic; } - /// - /// Gets a company by its bpn - /// - /// The bpn to get the company for - /// the authorization - /// Cancellation Token - /// Returns a List with one company - /// Example: GET /api/registration/company/{bpn}CAXSDUMMYCATENAZZ - /// Returns the company - /// The requested service responded with the given error. - [Obsolete($"use {nameof(GetCompanyBpdmDetailDataAsync)} instead")] - [HttpGet] - [Authorize(Roles = "add_company_data")] - [Route("company/{bpn}")] - [ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)] - [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)] - public IAsyncEnumerable GetOneObjectAsync([FromRoute] string bpn, [FromHeader] string authorization, CancellationToken cancellationToken) => - _registrationBusinessLogic.GetCompanyByIdentifierAsync(bpn, authorization.Split(" ")[1], cancellationToken); - /// /// Gets legal entity and address data from bpdm by its bpn /// diff --git a/src/registration/Registration.Service/Program.cs b/src/registration/Registration.Service/Program.cs index c1e1b99094..15b4d0a951 100644 --- a/src/registration/Registration.Service/Program.cs +++ b/src/registration/Registration.Service/Program.cs @@ -18,13 +18,14 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Framework.Web; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Config.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; var VERSION = "v2"; diff --git a/tests/externalsystems/Bpdm.Library/BPNAccessTest.cs b/tests/externalsystems/Bpdm.Library/BPNAccessTest.cs new file mode 100644 index 0000000000..071fc1387c --- /dev/null +++ b/tests/externalsystems/Bpdm.Library/BPNAccessTest.cs @@ -0,0 +1,336 @@ +/******************************************************************************** + * Copyright (c) 2021, 2023 Microsoft and BMW Group AG + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; +using System.Net; + +namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Tests; + +public class BPNAccessTest +{ + private readonly IFixture _fixture; + + public BPNAccessTest() + { + _fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); + } + + private void ConfigureHttpClientFactoryFixture(HttpResponseMessage httpResponseMessage, Action? setMessage = null) + { + var messageHandler = A.Fake(); + A.CallTo(messageHandler) // mock protected method + .Where(x => x.Method.Name == "SendAsync") + .WithReturnType>() + .ReturnsLazily(call => + { + var message = call.Arguments.Get(0); + setMessage?.Invoke(message); + return Task.FromResult(httpResponseMessage); + }); + var httpClient = new HttpClient(messageHandler) { BaseAddress = new Uri("http://localhost") }; + _fixture.Inject(httpClient); + + var httpClientFactory = _fixture.Freeze>(); + A.CallTo(() => httpClientFactory.FakedObject.CreateClient("bpn")).Returns(httpClient); + } + + #region FetchLegalEntityByBpns + + [Fact] + public async Task FetchLegalEntityByBpn_Success_ReturnsExpected() + { + //Arrange + HttpRequestMessage? request = null; + + const string json = @"{ + ""legalName"": ""string"", + ""bpnl"": ""string"", + ""identifiers"": [ + { + ""value"": ""string"", + ""type"": { + ""technicalKey"": ""string"", + ""name"": ""string"" + }, + ""issuingBody"": ""string"" + } + ], + ""legalShortName"": ""string"", + ""legalForm"": { + ""technicalKey"": ""string"", + ""name"": ""string"", + ""abbreviation"": ""string"" + }, + ""states"": [ + { + ""officialDenotation"": ""string"", + ""validFrom"": ""2023-07-24T11:23:20.887Z"", + ""validTo"": ""2023-07-24T11:23:20.887Z"", + ""type"": { + ""technicalKey"": ""ACTIVE"", + ""name"": ""string"" + } + } + ], + ""classifications"": [ + { + ""value"": ""string"", + ""code"": ""string"", + ""type"": { + ""technicalKey"": ""NACE"", + ""name"": ""string"" + } + } + ], + ""relations"": [ + { + ""type"": { + ""technicalKey"": ""CX_LEGAL_SUCCESSOR_OF"", + ""name"": ""string"" + }, + ""startBpn"": ""string"", + ""endBpn"": ""string"", + ""validFrom"": ""2023-07-24T11:23:20.887Z"", + ""validTo"": ""2023-07-24T11:23:20.887Z"" + } + ], + ""currentness"": ""2023-07-24T11:23:20.887Z"", + ""createdAt"": ""2023-07-24T11:23:20.887Z"", + ""updatedAt"": ""2023-07-24T11:23:20.887Z"", + ""legalAddress"": { + ""bpna"": ""string"", + ""name"": ""string"", + ""states"": [ + { + ""description"": ""string"", + ""validFrom"": ""2023-07-24T11:23:20.887Z"", + ""validTo"": ""2023-07-24T11:23:20.887Z"", + ""type"": { + ""technicalKey"": ""ACTIVE"", + ""name"": ""string"" + } + } + ], + ""identifiers"": [ + { + ""value"": ""string"", + ""type"": { + ""technicalKey"": ""string"", + ""name"": ""string"" + } + } + ], + ""physicalPostalAddress"": { + ""geographicCoordinates"": { + ""longitude"": 0, + ""latitude"": 0, + ""altitude"": 0 + }, + ""country"": { + ""technicalKey"": ""UNDEFINED"", + ""name"": ""string"" + }, + ""postalCode"": ""string"", + ""city"": ""string"", + ""street"": { + ""name"": ""string"", + ""houseNumber"": ""string"", + ""milestone"": ""string"", + ""direction"": ""string"" + }, + ""administrativeAreaLevel1"": { + ""name"": ""string"", + ""regionCode"": ""string"" + }, + ""administrativeAreaLevel2"": ""string"", + ""administrativeAreaLevel3"": ""string"", + ""district"": ""string"", + ""companyPostalCode"": ""string"", + ""industrialZone"": ""string"", + ""building"": ""string"", + ""floor"": ""string"", + ""door"": ""string"" + }, + ""alternativePostalAddress"": { + ""geographicCoordinates"": { + ""longitude"": 0, + ""latitude"": 0, + ""altitude"": 0 + }, + ""country"": { + ""technicalKey"": ""UNDEFINED"", + ""name"": ""string"" + }, + ""postalCode"": ""string"", + ""city"": ""string"", + ""administrativeAreaLevel1"": { + ""name"": ""string"", + ""regionCode"": ""string"" + }, + ""deliveryServiceNumber"": ""string"", + ""type"": ""PO_BOX"", + ""deliveryServiceQualifier"": ""string"" + }, + ""bpnLegalEntity"": ""string"", + ""bpnSite"": ""string"", + ""createdAt"": ""2023-07-24T11:23:20.887Z"", + ""updatedAt"": ""2023-07-24T11:23:20.887Z"", + ""isLegalAddress"": true, + ""isMainAddress"": true + } + }"; + + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent(json) + }, requestMessage => request = requestMessage); + + var businessPartnerNumber = _fixture.Create(); + var sut = _fixture.Create(); + + //Act + var result = await sut.FetchLegalEntityByBpn(businessPartnerNumber, _fixture.Create(), CancellationToken.None); + + //Assert + request.Should().NotBeNull(); + request!.RequestUri.Should().NotBeNull(); + request.RequestUri.Should().NotBeNull(); + request.RequestUri!.LocalPath.Should().Be($"/pool/api/catena/legal-entities/{businessPartnerNumber}"); + request.RequestUri.Query.Should().Be("?idType=BPN"); + + result.Should().NotBeNull(); + result.Currentness.Should().BeExactly(DateTimeOffset.Parse("2023-07-24T11:23:20.887Z")); + } + + [Fact] + public async Task FetchLegalEntityByBpn_InvalidJsonResponse_Throws() + { + //Arrange + var json = _fixture.Create(); + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent(json) + }); + + var sut = _fixture.Create(); + + var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); + + //Act + var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); + + //Assert + result.Should().NotBeNull(); + result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); + } + + [Fact] + public async Task FetchLegalEntityByBpn_EmptyResponse_Throws() + { + //Arrange + const string json = ""; + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent(json) + }); + + var sut = _fixture.Create(); + + var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); + + //Act + var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); + + //Assert + result.Should().NotBeNull(); + result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); + } + + [Fact] + public async Task FetchLegalEntityByBpn_NoContentResponse_Throws() + { + //Arrange + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + }); + + var sut = _fixture.Create(); + + var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); + + //Act + var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); + + //Assert + result.Should().NotBeNull(); + result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); + } + + [Fact] + public async Task FetchLegalEntityByBpn_InvalidJsonType_Throws() + { + //Arrange + const string json = "{\"some\": [{\"other\": \"json\"}]}"; + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent(json) + }); + + var sut = _fixture.Create(); + + var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); + + //Act + var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); + + //Assert + result.Should().NotBeNull(); + result.Message.Should().StartWith("Access to external system bpdm did not return a valid legal entity response"); + } + + [Fact] + public async Task FetchLegalEntityByBpn_UnsuccessfulCall_Throws() + { + //Arrange + var json = _fixture.Create(); + ConfigureHttpClientFactoryFixture(new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent(json) + }); + + var sut = _fixture.Create(); + + var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); + + //Act + var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); + + //Assert + result.Message.Should().Be($"call to external system bpn-fetch-legal-entity failed with statuscode {(int)HttpStatusCode.BadRequest}"); + } + + #endregion +} diff --git a/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs b/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs index 2ebd12ad88..93d311c320 100644 --- a/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs +++ b/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs @@ -112,23 +112,23 @@ public async Task PutInputLegalEntity_WithInvalidData_ThrowsServiceException() [Fact] public async Task FetchInputLegalEntity_WithValidResult_ReturnsExpected() { + // Arrange var externalId = _fixture.Create(); var data = _fixture.Build() .With(x => x.ExternalId, externalId) .With(x => x.Bpn, "TESTBPN") - .Create(); - var pageOutputData = new PageOutputResponseBpdmLegalEntityData( - Enumerable.Repeat(data, 1), - Enumerable.Empty()); + .CreateMany(1); + var pagination = new PageOutputResponseBpdmLegalEntityData(data); + var options = new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase, Converters = { new JsonStringEnumConverter(allowIntegerValues: false) } }; - // Arrange + var httpMessageHandlerMock = new HttpMessageHandlerMock( HttpStatusCode.OK, - pageOutputData.ToJsonContent( + pagination.ToJsonContent( options, "application/json") ); @@ -144,7 +144,7 @@ public async Task FetchInputLegalEntity_WithValidResult_ReturnsExpected() // Assert result.Should().NotBeNull(); - result.ExternalId.Should().Be(data.ExternalId); + result.ExternalId.Should().Be(externalId); result.Bpn.Should().Be("TESTBPN"); } @@ -196,39 +196,6 @@ public async Task FetchInputLegalEntity_WithEmtpyResult_ThrowsServiceException() ex.IsRecoverable.Should().BeFalse(); } - [Fact] - public async Task FetchInputLegalEntity_WithError_ThrowsServiceException() - { - // Arrange - var error = new BpdmErrorInfo("SharingProcessError", "This is a test", "test"); - var pageOutputData = new PageOutputResponseBpdmLegalEntityData( - Enumerable.Empty(), - Enumerable.Repeat(error, 1)); - var options = new System.Text.Json.JsonSerializerOptions - { - PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase, - Converters = { new JsonStringEnumConverter(allowIntegerValues: false) } - }; - var httpMessageHandlerMock = new HttpMessageHandlerMock( - HttpStatusCode.OK, - pageOutputData.ToJsonContent(options, "application/json")); - - var httpClient = new HttpClient(httpMessageHandlerMock) - { - BaseAddress = new Uri("https://base.address.com") - }; - A.CallTo(() => _tokenService.GetAuthorizedClient(_options.Value, A._)).Returns(httpClient); - var sut = new BpdmService(_tokenService, _options); - - // Act - async Task Act() => await sut.FetchInputLegalEntity(_fixture.Create(), CancellationToken.None).ConfigureAwait(false); - - // Assert - var ex = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - ex.Message.Should().StartWith("The external system bpdm responded with errors ErrorCode: SharingProcessError, ErrorMessage: This is a test"); - ex.IsRecoverable.Should().BeFalse(); - } - [Fact] public async Task FetchInputLegalEntity_WithNotFoundResult_ReturnsNull() { diff --git a/tests/registration/Registration.Service.Tests/BPNAccessTest.cs b/tests/registration/Registration.Service.Tests/BPNAccessTest.cs deleted file mode 100644 index 1dd063b043..0000000000 --- a/tests/registration/Registration.Service.Tests/BPNAccessTest.cs +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 Microsoft and BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using AutoFixture; -using AutoFixture.AutoFakeItEasy; -using FakeItEasy; -using FluentAssertions; -using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model; -using System.Net; -using System.Text.Json; -using Xunit; - -namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Tests; - -public class BPNAccessTest -{ - private readonly IFixture _fixture; - - public BPNAccessTest() - { - _fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); - } - - private void ConfigureHttpClientFactoryFixture(HttpResponseMessage httpResponseMessage, Action? setMessage = null) - { - var messageHandler = A.Fake(); - A.CallTo(messageHandler) // mock protected method - .Where(x => x.Method.Name == "SendAsync") - .WithReturnType>() - .ReturnsLazily(call => - { - var message = call.Arguments.Get(0); - setMessage?.Invoke(message); - return Task.FromResult(httpResponseMessage); - }); - var httpClient = new HttpClient(messageHandler) { BaseAddress = new Uri("http://localhost") }; - _fixture.Inject(httpClient); - - var httpClientFactory = _fixture.Freeze>(); - A.CallTo(() => httpClientFactory.FakedObject.CreateClient("bpn")).Returns(httpClient); - } - - [Fact] - public async Task FetchBusinessPartner_Success() - { - var resultSet = _fixture.Create(); - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonSerializer.Serialize(resultSet)) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var result = await sut.FetchBusinessPartner("testpbn", "token", CancellationToken.None).ToListAsync().ConfigureAwait(false); - Assert.Equal(resultSet.Bpn, result.First().Bpn); - Assert.Equal("token", httpClient.DefaultRequestHeaders.Authorization?.Parameter); - } - - [Fact] - public async Task FetchBusinessPartner_Failure() - { - ConfigureHttpClientFactoryFixture(new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - async Task Act() => await sut.FetchBusinessPartner("testpbn", "token", CancellationToken.None).ToListAsync().ConfigureAwait(false); - - await Assert.ThrowsAsync(Act); - Assert.Equal("token", httpClient.DefaultRequestHeaders.Authorization?.Parameter); - } - - #region FetchLegalEntityByBpns - - [Fact] - public async Task FetchLegalEntityByBpn_Success_ReturnsExpected() - { - //Arrange - HttpRequestMessage? request = null; - - var json = "{\"bankAccounts\": [{\"currency\": {\"name\": \"string\", \"technicalKey\": \"UNDEFINED\"}, \"internationalBankAccountIdentifier\": \"string\", \"internationalBankIdentifier\": \"string\", \"nationalBankAccountIdentifier\": \"string\", \"nationalBankIdentifier\": \"string\", \"trustScores\": [0]}], \"bpn\": \"string\", \"currentness\": \"2023-01-18T12:52:41.710Z\", \"identifiers\": [{\"issuingBody\": {\"name\": \"string\", \"technicalKey\": \"string\", \"url\": \"string\"}, \"status\": {\"name\": \"string\", \"technicalKey\": \"string\"}, \"type\": {\"name\": \"string\", \"technicalKey\": \"string\", \"url\": \"string\"}, \"value\": \"string\"}], \"legalForm\": {\"categories\": [{\"name\": \"string\", \"url\": \"string\"}], \"language\": {\"name\": \"string\", \"technicalKey\": \"undefined\"}, \"mainAbbreviation\": \"string\", \"name\": \"string\", \"technicalKey\": \"string\", \"url\": \"string\"}, \"names\": [{\"language\": {\"name\": \"string\", \"technicalKey\": \"undefined\"}, \"shortName\": \"string\", \"type\": {\"name\": \"string\", \"technicalKey\": \"ACRONYM\", \"url\": \"string\"}, \"value\": \"string\"}], \"profileClassifications\": [{\"code\": \"string\", \"type\": {\"name\": \"string\", \"url\": \"string\"}, \"value\": \"string\"}], \"relations\": [{\"endedAt\": \"2023-01-18T12:52:41.710Z\", \"endNode\": \"string\", \"relationClass\": {\"name\": \"string\", \"technicalKey\": \"CDQ_HIERARCHY\"}, \"startedAt\": \"2023-01-18T12:52:41.710Z\", \"startNode\": \"string\", \"type\": {\"name\": \"string\", \"technicalKey\": \"CX_LEGAL_SUCCESSOR_OF\"}}], \"roles\": [{\"name\": \"string\", \"technicalKey\": \"string\"}], \"status\": {\"officialDenotation\": \"string\", \"type\": {\"name\": \"string\", \"technicalKey\": \"ACTIVE\", \"url\": \"string\"}, \"validFrom\": \"2023-01-18T12:52:41.709Z\", \"validUntil\": \"2023-01-18T12:52:41.709Z\"}, \"types\": [{\"name\": \"string\", \"technicalKey\": \"BRAND\", \"url\": \"string\"}]}"; - - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }, requestMessage => request = requestMessage); - - var businessPartnerNumber = _fixture.Create(); - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - //Act - var result = await sut.FetchLegalEntityByBpn(businessPartnerNumber, _fixture.Create(), CancellationToken.None); - - //Assert - request.Should().NotBeNull(); - request!.RequestUri.Should().NotBeNull(); - request.RequestUri.Should().NotBeNull(); - request.RequestUri!.LocalPath.Should().Be($"/api/catena/legal-entities/{businessPartnerNumber}"); - request.RequestUri.Query.Should().Be("?idType=BPN"); - - result.Should().NotBeNull(); - result.Currentness.Should().BeExactly(DateTimeOffset.Parse("2023-01-18T12:52:41.710Z")); - result.BankAccounts.Should().NotBeNull(); - result.BankAccounts.Should().HaveCount(1); - var account = result.BankAccounts.First(); - account.Currency.Should().NotBeNull(); - account.Currency.TechnicalKey.Should().Be("UNDEFINED"); - } - - [Fact] - public async Task FetchLegalEntityByBpn_InvalidJsonResponse_Throws() - { - //Arrange - var json = _fixture.Create(); - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); - } - - [Fact] - public async Task FetchLegalEntityByBpn_EmptyResponse_Throws() - { - //Arrange - var json = ""; - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); - } - - [Fact] - public async Task FetchLegalEntityByBpn_NoContentResponse_Throws() - { - //Arrange - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); - } - - [Fact] - public async Task FetchLegalEntityByBpn_InvalidJsonType_Throws() - { - //Arrange - var json = "{\"some\": [{\"other\": \"json\"}]}"; - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().StartWith("Access to external system bpdm did not return a valid legal entity response"); - } - - [Fact] - public async Task FetchLegalEntityByBpn_UnsuccessfulCall_Throws() - { - //Arrange - var json = _fixture.Create(); - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.BadRequest, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = () => sut.FetchLegalEntityByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Message.Should().Be($"Access to external system bpdm failed with Status Code {HttpStatusCode.BadRequest}"); - } - - #endregion - - #region FetchLegalEntityAddressByBpn - - [Fact] - public async Task FetchLegalEntityAddressByBpn_Success_ReturnsExpected() - { - //Arrange - HttpRequestMessage? request = null; - - var json = "[{\"legalAddress\": {\"administrativeAreas\": [], \"careOf\": null, \"contexts\": [], \"country\": {\"name\": \"Germany\", \"technicalKey\": \"DE\"}, \"geographicCoordinates\": null, \"localities\": [{\"language\": {\"name\": \"English\", \"technicalKey\": \"en\"}, \"shortName\": null, \"type\": {\"name\": \"Other\", \"technicalKey\": \"OTHER\", \"url\": \"\"}, \"value\": \"Bremen\"}], \"postalDeliveryPoints\": [], \"postCodes\": [{\"type\": {\"name\": \"Other type\", \"technicalKey\": \"OTHER\", \"url\": \"\"}, \"value\": \"28777\"}], \"premises\": [], \"thoroughfares\": [{\"direction\": null, \"language\": {\"name\": \"English\", \"technicalKey\": \"en\"}, \"name\": null, \"number\": \"30\", \"shortName\": null, \"type\": {\"name\": \"Other type\", \"technicalKey\": \"OTHER\", \"url\": \"\"}, \"value\": \"Heidlerchenstr.\"}], \"types\": [], \"version\": {\"characterSet\": {\"name\": \"Latin\", \"technicalKey\": \"LATIN\"}, \"language\": {\"name\": \"English\", \"technicalKey\": \"en\"}}}, \"legalEntity\": \"BPNL000000055EPN\"}]"; - - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }, requestMessage => request = requestMessage); - - var businessPartnerNumber = "BPNL000000055EPN"; - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - //Act - var result = await sut.FetchLegalEntityAddressByBpn(businessPartnerNumber, _fixture.Create(), CancellationToken.None).ToListAsync().ConfigureAwait(false); - - //Assert - request.Should().NotBeNull(); - request!.RequestUri.Should().NotBeNull(); - request.RequestUri.Should().NotBeNull(); - request.RequestUri!.LocalPath.Should().Be($"/api/catena/legal-entities/legal-addresses/search"); - request.RequestUri.Query.Should().Be(""); - - result.Should().NotBeNull(); - result.Should().HaveCount(1); - var legalEntityAddress = result.First(); - legalEntityAddress.Should().NotBeNull(); - legalEntityAddress.LegalEntity.Should().Be(businessPartnerNumber); - var legalAddress = legalEntityAddress.LegalAddress; - legalAddress.Should().NotBeNull(); - legalAddress.Country.Should().NotBeNull(); - legalAddress.Country.TechnicalKey.Should().Be("DE"); - legalAddress.PostCodes.Should().NotBeNull(); - legalAddress.PostCodes.Should().HaveCount(1); - legalAddress.PostCodes.First().Value.Should().Be("28777"); - legalAddress.Localities.Should().NotBeNull(); - legalAddress.Localities.Should().HaveCount(1); - legalAddress.Localities.First().Value.Should().Be("Bremen"); - legalAddress.Thoroughfares.Should().NotBeNull(); - legalAddress.Thoroughfares.Should().HaveCount(1); - var thoroughfare = legalAddress.Thoroughfares.First(); - thoroughfare.Value.Should().Be("Heidlerchenstr."); - thoroughfare.Number.Should().Be("30"); - } - - [Fact] - public async Task FetchLegalEntityAddressByBpn_InvalidJsonResponse_Throws() - { - //Arrange - var json = _fixture.Create(); - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = async () => await sut.FetchLegalEntityAddressByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None).ToListAsync().ConfigureAwait(false); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().StartWith("Access to external system bpdm did not return a valid json response"); - } - - [Fact] - public async Task FetchLegalEntityAddressByBpn_InvalidJsonType_Throws() - { - //Arrange - var json = "[{\"some\": [{\"other\": \"json\"}]}]"; - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = async () => await sut.FetchLegalEntityAddressByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None).ToListAsync().ConfigureAwait(false); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Should().NotBeNull(); - result.Message.Should().Be("Access to external system bpdm did not return a valid legal entity address response"); - } - - [Fact] - public async Task FetchLegalEntityAddressByBpn_UnsuccessfulCall_Throws() - { - //Arrange - var json = _fixture.Create(); - ConfigureHttpClientFactoryFixture(new HttpResponseMessage - { - StatusCode = HttpStatusCode.BadRequest, - Content = new StringContent(json) - }); - - var httpClient = _fixture.Create(); - var sut = _fixture.Create(); - - var Act = async () => await sut.FetchLegalEntityAddressByBpn(_fixture.Create(), _fixture.Create(), CancellationToken.None).ToListAsync().ConfigureAwait(false); - - //Act - var result = await Assert.ThrowsAsync(Act).ConfigureAwait(false); - - //Assert - result.Message.Should().Be($"Access to external system bpdm failed with Status Code {HttpStatusCode.BadRequest}"); - } - - #endregion -} diff --git a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs index 5d21aca39f..f642d2b773 100644 --- a/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs +++ b/tests/registration/Registration.Service.Tests/BusinessLogic/RegistrationBusinessLogicTest.cs @@ -24,6 +24,8 @@ using FluentAssertions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library; +using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; using Org.Eclipse.TractusX.Portal.Backend.Mailing.SendMail; @@ -37,13 +39,13 @@ using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Service; -using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Model; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared; using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.Extensions; using System.Collections.Immutable; using Xunit; +using Address = Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Address; namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Tests.BusinessLogic; @@ -160,56 +162,6 @@ public async Task GetClientRolesCompositeAsync_GetsAllRoles() #endregion - #region GetCompanyByIdentifier - - [Fact] - public async Task GetCompanyByIdentifierAsync_WithValidBpn_FetchesBusinessPartner() - { - //Arrange - var bpnAccess = A.Fake(); - var bpn = "THISBPNISVALID12"; - var token = "justatoken"; - var sut = new RegistrationBusinessLogic( - _options, - null!, - bpnAccess, - null!, - null!, - null!, - null!, - null!); - - // Act - var result = await sut.GetCompanyByIdentifierAsync(bpn, token, CancellationToken.None).ToListAsync().ConfigureAwait(false); - - result.Should().NotBeNull(); - A.CallTo(() => bpnAccess.FetchBusinessPartner(bpn, token, CancellationToken.None)).MustHaveHappenedOnceExactly(); - } - - [Fact] - public async Task GetCompanyByIdentifierAsync_WithValidBpn_ThrowsArgumentException() - { - //Arrange - var sut = new RegistrationBusinessLogic( - _options, - null!, - null!, - null!, - null!, - null!, - null!, - null!); - - // Act - async Task Act() => await sut.GetCompanyByIdentifierAsync("NotLongEnough", "justatoken", CancellationToken.None).ToListAsync().ConfigureAwait(false); - - // Assert - var ex = await Assert.ThrowsAsync(Act); - ex.ParamName.Should().Be("companyIdentifier"); - } - - #endregion - #region GetCompanyBpdmDetailDataByBusinessPartnerNumber [Fact] @@ -233,31 +185,29 @@ public async Task GetCompanyBpdmDetailDataByBusinessPartnerNumber_WithValidBpn_R var bpdmIdentifiers = uniqueIdSeed.Select(x => ((string TechnicalKey, string Value))(x.BpdmIdentifierId.ToString(), x.Value)); var validIdentifiers = uniqueIdSeed.Skip(2).Take(2).Select(x => (x.BpdmIdentifierId, x.UniqueIdentifierId)); - var legalEntity = _fixture.Build() + var bpdmAddress = _fixture.Build() + .With(x => x.BpnLegalEntity, name) + .With(x => x.Bpnl, businessPartnerNumber) + .With(x => x.PhysicalPostalAddress, _fixture.Build() + .With(x => x.Country, _fixture.Build().With(x => x.TechnicalKey, country).Create()) + .With(x => x.AdministrativeAreaLevel1, _fixture.Build().With(x => x.RegionCode, region).Create()) + .With(x => x.PostalCode, zipCode) + .With(x => x.City, city) + .With(x => x.Street, _fixture.Build().With(x => x.Name, streetName).With(x => x.HouseNumber, streetNumber).Create()) + .Create()) + .Create(); + var legalEntity = _fixture.Build() .With(x => x.Bpn, businessPartnerNumber) - .With(x => x.Names, new[] { _fixture.Build() - .With(x => x.Value, name) - .With(x => x.ShortName, shortName) - .Create() }) - .With(x => x.Identifiers, bpdmIdentifiers.Select(identifier => _fixture.Build() - .With(x => x.Type, _fixture.Build().With(x => x.TechnicalKey, identifier.TechnicalKey).Create()) + .With(x => x.LegalName, name) + .With(x => x.LegalShortName, shortName) + .With(x => x.Identifiers, bpdmIdentifiers.Select(identifier => _fixture.Build() + .With(x => x.Type, _fixture.Build().With(x => x.TechnicalKey, identifier.TechnicalKey).Create()) .With(x => x.Value, identifier.Value) .Create())) - .Create(); - var bpdmAddress = _fixture.Build() - .With(x => x.LegalEntity, businessPartnerNumber) - .With(x => x.LegalAddress, _fixture.Build() - .With(x => x.Country, _fixture.Build().With(x => x.TechnicalKey, country).Create()) - .With(x => x.AdministrativeAreas, new[] { _fixture.Build().With(x => x.Value, region).Create() }) - .With(x => x.PostCodes, new[] { _fixture.Build().With(x => x.Value, zipCode).Create() }) - .With(x => x.Localities, new[] { _fixture.Build().With(x => x.Value, city).Create() }) - .With(x => x.Thoroughfares, new[] { _fixture.Build().With(x => x.Value, streetName).With(x => x.Number, streetNumber).Create() }) - .Create()) + .With(x => x.LegalEntityAddress, bpdmAddress) .Create(); A.CallTo(() => bpnAccess.FetchLegalEntityByBpn(businessPartnerNumber, token, A._)) .Returns(legalEntity); - A.CallTo(() => bpnAccess.FetchLegalEntityAddressByBpn(businessPartnerNumber, token, A._)) - .Returns(new[] { bpdmAddress }.ToAsyncEnumerable()); A.CallTo(() => _staticDataRepository.GetCountryAssignedIdentifiers(A>.That.Matches>(ids => ids.SequenceEqual(uniqueIdSeed.Select(seed => seed.BpdmIdentifierId))), country)) .Returns((true, validIdentifiers)); @@ -276,8 +226,6 @@ public async Task GetCompanyBpdmDetailDataByBusinessPartnerNumber_WithValidBpn_R A.CallTo(() => bpnAccess.FetchLegalEntityByBpn(businessPartnerNumber, token, A._)) .MustHaveHappenedOnceExactly(); - A.CallTo(() => bpnAccess.FetchLegalEntityAddressByBpn(businessPartnerNumber, token, A._)) - .MustHaveHappenedOnceExactly(); A.CallTo(() => _staticDataRepository.GetCountryAssignedIdentifiers(A>.That.Matches>(ids => ids.SequenceEqual(uniqueIdSeed.Select(seed => seed.BpdmIdentifierId))), country)) .MustHaveHappenedOnceExactly(); diff --git a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs index 8303199fcc..bbe8a58384 100644 --- a/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs +++ b/tests/registration/Registration.Service.Tests/Controller/RegistrationControllerTest.cs @@ -22,7 +22,6 @@ using FakeItEasy; using FluentAssertions; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; @@ -47,8 +46,7 @@ public RegistrationControllerTest() { _fixture = new Fixture(); _registrationBusinessLogicFake = A.Fake(); - var registrationLoggerFake = A.Fake>(); - _controller = new RegistrationController(registrationLoggerFake, _registrationBusinessLogicFake); + _controller = new RegistrationController(_registrationBusinessLogicFake); _controller.AddControllerContextWithClaimAndBearer("ac-token", _identity); } From c79e50c4757b573b7c77d1753736c8461ad0c806 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 31 Jul 2023 15:08:21 +0200 Subject: [PATCH 09/10] release: bump version for v1.6.0-RC4 (#174) * merge all migrations since the last release into one migration * release: bump version for v1.6.0-RC4 * release: update changelog for v1.6.0-RC4 ----- Reviewed-By: Norbert Truchsess --- CHANGELOG.md | 23 + src/Directory.Build.props | 4 +- ...3042-ChangeNotificationCreator.Designer.cs | 7077 ----------------- ...020_CPLP-3042-ChangeNotificationCreator.cs | 65 - ...s => 20230731123725_1.6.0-rc4.Designer.cs} | 4 +- ...traints.cs => 20230731123725_1.6.0-rc4.cs} | 32 +- 6 files changed, 58 insertions(+), 7147 deletions(-) delete mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs delete mode 100644 src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230727191716_AddLastEditorConstraints.Designer.cs => 20230731123725_1.6.0-rc4.Designer.cs} (99%) rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230727191716_AddLastEditorConstraints.cs => 20230731123725_1.6.0-rc4.cs} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46349603c9..22852bab6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,29 @@ New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend. +## 1.6.0-RC4 + +### Change +* Apps Service + * Change the appInstanceId to iamClientId for the /{appId}/subscription/{subscriptionId}/provider endpoint +* BPDM Service + * BPDM Service calls are changed to the new bpdm endpoints + +### Technical Support +* reinclude http request & response messages in logging +* lastEditorId is now set whenever a auditable entity is changed + +### Bugfix +* Apps Service + * Fix /api/apps/business endpoint to return correct results + * Fix POST /api/apps/appreleaseprocess/consent/{appId}/agreementConsents to save consents and set the correct user id +* Services Service + * Fix POST /api/services/servicerelease/consent/{serviceId}/agreementConsents to save consents and set the correct user id +* Administration Service + * Ignore inactive credentials when trying to create a new credential +* AutoSetup + * fix an error that occurred when autoSetup was executed by a service-account caused by the the creator of a notification being linked to a companyUser instead of identities + ## 1.6.0-RC3 ### Change diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d62d56ea50..a3c653174f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -21,6 +21,6 @@ 1.6.0 - RC3 + RC4 - \ No newline at end of file + diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs deleted file mode 100644 index a0370b240c..0000000000 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.Designer.cs +++ /dev/null @@ -1,7077 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; - -#nullable disable - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations -{ - [DbContext(typeof(PortalDbContext))] - [Migration("20230726140020_CPLP-3042-ChangeNotificationCreator")] - partial class CPLP3042ChangeNotificationCreator - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("portal") - .UseCollation("en_US.utf8") - .HasAnnotation("ProductVersion", "6.0.7") - .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.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.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.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.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.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.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.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.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"); - - 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("AgreementType") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("agreement_type"); - - 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("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("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.AppAssignedUseCase", b => - { - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("UseCaseId") - .HasColumnType("uuid") - .HasColumnName("use_case_id"); - - b.HasKey("AppId", "UseCaseId") - .HasName("pk_app_assigned_use_cases"); - - b.HasIndex("UseCaseId") - .HasDatabaseName("ix_app_assigned_use_cases_use_case_id"); - - b.ToTable("app_assigned_use_cases", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("IamClientId") - .HasColumnType("uuid") - .HasColumnName("iam_client_id"); - - b.HasKey("Id") - .HasName("pk_app_instances"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_app_instances_app_id"); - - b.HasIndex("IamClientId") - .HasDatabaseName("ix_app_instances_iam_client_id"); - - b.ToTable("app_instances", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => - { - b.Property("AppInstanceId") - .HasColumnType("uuid") - .HasColumnName("app_instance_id"); - - b.Property("CompanyServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("company_service_account_id"); - - b.HasKey("AppInstanceId", "CompanyServiceAccountId") - .HasName("pk_app_instance_assigned_service_accounts"); - - b.HasIndex("CompanyServiceAccountId") - .HasDatabaseName("ix_app_instance_assigned_service_accounts_company_service_acco"); - - b.ToTable("app_instance_assigned_service_accounts", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("InstanceUrl") - .HasColumnType("text") - .HasColumnName("instance_url"); - - b.Property("IsSingleInstance") - .HasColumnType("boolean") - .HasColumnName("is_single_instance"); - - b.HasKey("Id") - .HasName("pk_app_instance_setups"); - - b.HasIndex("AppId") - .IsUnique() - .HasDatabaseName("ix_app_instance_setups_app_id"); - - b.ToTable("app_instance_setups", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => - { - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("LanguageShortName") - .HasMaxLength(2) - .HasColumnType("character(2)") - .HasColumnName("language_short_name"); - - b.HasKey("AppId", "LanguageShortName") - .HasName("pk_app_languages"); - - b.HasIndex("LanguageShortName") - .HasDatabaseName("ix_app_languages_language_short_name"); - - b.ToTable("app_languages", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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" - }); - }); - - 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 = "CLEARING_HOUSE" - }, - new - { - Id = 5, - Label = "SELF_DESCRIPTION_LP" - }, - new - { - Id = 6, - Label = "APPLICATION_ACTIVATION" - }); - }); - - 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("OfferSubscriptionId") - .IsUnique() - .HasDatabaseName("ix_app_subscription_details_offer_subscription_id"); - - b.ToTable("app_subscription_details", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_app_subscription_detail20221118 (\"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 OLD.id, \r\n OLD.offer_subscription_id, \r\n OLD.app_instance_id, \r\n OLD.app_subscription_url, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL AFTER DELETE\r\nON portal.app_subscription_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_APPSUBSCRIPTIONDETAIL();") - .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_detail20221118 (\"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_DATE, \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_detail20221118 (\"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_DATE, \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.AuditCompanySsiDetail20230621", 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("CompanySsiDetailStatusId") - .HasColumnType("integer") - .HasColumnName("company_ssi_detail_status_id"); - - b.Property("CreatorUserId") - .HasColumnType("uuid") - .HasColumnName("creator_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("DocumentId") - .HasColumnType("uuid") - .HasColumnName("document_id"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("expiry_date"); - - b.Property("Id") - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("LastEditorId") - .HasColumnType("uuid") - .HasColumnName("last_editor_id"); - - b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") - .HasColumnType("uuid") - .HasColumnName("verified_credential_external_type_use_case_detail_id"); - - b.Property("VerifiedCredentialTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_id"); - - b.HasKey("AuditV1Id") - .HasName("pk_audit_company_ssi_detail20230621"); - - b.ToTable("audit_company_ssi_detail20230621", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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"); - - b.HasKey("AuditV1Id") - .HasName("pk_audit_identity20230526"); - - b.ToTable("audit_identity20230526", "portal"); - }); - - 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("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name"); - - 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("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("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_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("CompanyId") - .HasDatabaseName("ix_company_applications_company_id"); - - b.ToTable("company_applications", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$\r\nBEGIN\r\n INSERT INTO portal.audit_company_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.date_created, \r\n OLD.date_last_changed, \r\n OLD.application_status_id, \r\n OLD.company_id, \r\n OLD.checklist_process_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION AFTER DELETE\r\nON portal.company_applications\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYAPPLICATION();") - .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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_application20230214 (\"id\", \"date_created\", \"date_last_changed\", \"application_status_id\", \"company_id\", \"checklist_process_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.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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" - }); - }); - - 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.ToTable("company_assigned_roles", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.company_id, \r\n OLD.company_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE AFTER DELETE\r\nON portal.company_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYASSIGNEDROLE();") - .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_DATE, \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_DATE, \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.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.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" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleAssignedRoleCollection", b => - { - b.Property("CompanyRoleId") - .HasColumnType("integer") - .HasColumnName("company_role_id"); - - b.Property("UserRoleCollectionId") - .HasColumnType("uuid") - .HasColumnName("user_role_collection_id"); - - b.HasKey("CompanyRoleId") - .HasName("pk_company_role_assigned_role_collections"); - - b.HasIndex("UserRoleCollectionId") - .IsUnique() - .HasDatabaseName("ix_company_role_assigned_role_collections_user_role_collection"); - - b.ToTable("company_role_assigned_role_collections", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleDescription", b => - { - b.Property("CompanyRoleId") - .HasColumnType("integer") - .HasColumnName("company_role_id"); - - b.Property("LanguageShortName") - .HasMaxLength(2) - .HasColumnType("character(2)") - .HasColumnName("language_short_name"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("description"); - - b.HasKey("CompanyRoleId", "LanguageShortName") - .HasName("pk_company_role_descriptions"); - - b.HasIndex("LanguageShortName") - .HasDatabaseName("ix_company_role_descriptions_language_short_name"); - - b.ToTable("company_role_descriptions", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => - { - b.Property("CompanyRoleId") - .HasColumnType("integer") - .HasColumnName("company_role_id"); - - b.Property("IsRegistrationRole") - .HasColumnType("boolean") - .HasColumnName("is_registration_role"); - - b.HasKey("CompanyRoleId") - .HasName("pk_company_role_registration_data"); - - b.ToTable("company_role_registration_data", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => - { - b.Property("Id") - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ClientClientId") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("client_client_id"); - - b.Property("ClientId") - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("client_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.HasKey("Id") - .HasName("pk_company_service_accounts"); - - b.HasIndex("ClientClientId") - .IsUnique() - .HasDatabaseName("ix_company_service_accounts_client_client_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.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.CompanySsiDetail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CompanySsiDetailStatusId") - .HasColumnType("integer") - .HasColumnName("company_ssi_detail_status_id"); - - b.Property("CreatorUserId") - .HasColumnType("uuid") - .HasColumnName("creator_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("DocumentId") - .HasColumnType("uuid") - .HasColumnName("document_id"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("expiry_date"); - - b.Property("LastEditorId") - .HasColumnType("uuid") - .HasColumnName("last_editor_id"); - - b.Property("VerifiedCredentialExternalTypeUseCaseDetailId") - .HasColumnType("uuid") - .HasColumnName("verified_credential_external_type_use_case_detail_id"); - - b.Property("VerifiedCredentialTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_id"); - - b.HasKey("Id") - .HasName("pk_company_ssi_details"); - - b.HasIndex("CompanyId") - .HasDatabaseName("ix_company_ssi_details_company_id"); - - b.HasIndex("CompanySsiDetailStatusId") - .HasDatabaseName("ix_company_ssi_details_company_ssi_detail_status_id"); - - b.HasIndex("CreatorUserId") - .HasDatabaseName("ix_company_ssi_details_creator_user_id"); - - b.HasIndex("DocumentId") - .IsUnique() - .HasDatabaseName("ix_company_ssi_details_document_id"); - - b.HasIndex("VerifiedCredentialExternalTypeUseCaseDetailId") - .HasDatabaseName("ix_company_ssi_details_verified_credential_external_type_use_c"); - - b.HasIndex("VerifiedCredentialTypeId") - .HasDatabaseName("ix_company_ssi_details_verified_credential_type_id"); - - b.ToTable("company_ssi_details", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_id\", \"date_last_changed\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.verified_credential_type_id, \r\n OLD.company_ssi_detail_status_id, \r\n OLD.document_id, \r\n OLD.date_created, \r\n OLD.creator_user_id, \r\n OLD.expiry_date, \r\n OLD.verified_credential_external_type_use_case_detail_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL AFTER DELETE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYSSIDETAIL();") - .HasAnnotation("LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL AFTER INSERT\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_COMPANYSSIDETAIL();") - .HasAnnotation("LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_company_ssi_detail20230621 (\"id\", \"company_id\", \"verified_credential_type_id\", \"company_ssi_detail_status_id\", \"document_id\", \"date_created\", \"creator_user_id\", \"expiry_date\", \"verified_credential_external_type_use_case_detail_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.company_id, \r\n NEW.verified_credential_type_id, \r\n NEW.company_ssi_detail_status_id, \r\n NEW.document_id, \r\n NEW.date_created, \r\n NEW.creator_user_id, \r\n NEW.expiry_date, \r\n NEW.verified_credential_external_type_use_case_detail_id, \r\n NEW.date_last_changed, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL AFTER UPDATE\r\nON portal.company_ssi_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_UPDATE_COMPANYSSIDETAIL();"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", 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_ssi_detail_statuses"); - - b.ToTable("company_ssi_detail_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.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.ToTable("company_users", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_COMPANYUSER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.id, \r\n OLD.email, \r\n OLD.firstname, \r\n OLD.lastlogin, \r\n OLD.lastname, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_COMPANYUSER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_COMPANYUSER AFTER DELETE\r\nON portal.company_users\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_COMPANYUSER();") - .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_DATE, \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_DATE, \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.Connector", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("company_service_account_id"); - - b.Property("ConnectorUrl") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("connector_url"); - - b.Property("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("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("SelfDescriptionDocumentId") - .HasColumnType("uuid") - .HasColumnName("self_description_document_id"); - - b.Property("SelfDescriptionMessage") - .HasColumnType("text") - .HasColumnName("self_description_message"); - - b.Property("StatusId") - .HasColumnType("integer") - .HasColumnName("status_id"); - - b.Property("TypeId") - .HasColumnType("integer") - .HasColumnName("type_id"); - - b.HasKey("Id") - .HasName("pk_connectors"); - - b.HasIndex("CompanyServiceAccountId") - .IsUnique() - .HasDatabaseName("ix_connectors_company_service_account_id"); - - b.HasIndex("HostId") - .HasDatabaseName("ix_connectors_host_id"); - - b.HasIndex("LastEditorId") - .HasDatabaseName("ix_connectors_last_editor_id"); - - b.HasIndex("LocationId") - .HasDatabaseName("ix_connectors_location_id"); - - b.HasIndex("ProviderId") - .HasDatabaseName("ix_connectors_provider_id"); - - b.HasIndex("SelfDescriptionDocumentId") - .IsUnique() - .HasDatabaseName("ix_connectors_self_description_document_id"); - - b.HasIndex("StatusId") - .HasDatabaseName("ix_connectors_status_id"); - - b.HasIndex("TypeId") - .HasDatabaseName("ix_connectors_type_id"); - - b.ToTable("connectors", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONNECTOR", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.daps_registration_successful, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_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.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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.ConnectorClientDetail", b => - { - b.Property("ConnectorId") - .HasColumnType("uuid") - .HasColumnName("connector_id"); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("text") - .HasColumnName("client_id"); - - b.HasKey("ConnectorId") - .HasName("pk_connector_client_details"); - - b.ToTable("connector_client_details", "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.ToTable("consents", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_CONSENT", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONSENT() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONSENT$\r\nBEGIN\r\n INSERT INTO portal.audit_consent20230412 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.comment, \r\n OLD.consent_status_id, \r\n OLD.target, \r\n OLD.agreement_id, \r\n OLD.company_id, \r\n OLD.document_id, \r\n OLD.company_user_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONSENT$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONSENT AFTER DELETE\r\nON portal.consents\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONSENT();") - .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_consent20230412 (\"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_DATE, \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_consent20230412 (\"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_DATE, \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(); - - b.Property("Alpha3Code") - .HasMaxLength(3) - .HasColumnType("character(3)") - .HasColumnName("alpha3code") - .IsFixedLength(); - - b.Property("CountryNameDe") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("country_name_de"); - - b.Property("CountryNameEn") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("country_name_en"); - - 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"); - - 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.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("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("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"); - }); - - 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" - }); - }); - - 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.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"); - - 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("UserEntityId") - .IsUnique() - .HasDatabaseName("ix_identities_user_entity_id"); - - b.HasIndex("UserStatusId") - .HasDatabaseName("ix_identities_user_status_id"); - - b.ToTable("identities", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITY", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITY() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_IDENTITY$\r\nBEGIN\r\n INSERT INTO portal.audit_identity20230526 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.company_id, \r\n OLD.user_status_id, \r\n OLD.user_entity_id, \r\n OLD.identity_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITY$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITY AFTER DELETE\r\nON portal.identities\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITY();") - .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_identity20230526 (\"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_DATE, \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_identity20230526 (\"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_DATE, \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("UserRoleId") - .HasDatabaseName("ix_identity_assigned_roles_user_role_id"); - - b.ToTable("identity_assigned_roles", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_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 OLD.identity_id, \r\n OLD.user_role_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE AFTER DELETE\r\nON portal.identity_assigned_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_IDENTITYASSIGNEDROLE();") - .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_DATE, \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_DATE, \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.HasKey("Id") - .HasName("pk_identity_providers"); - - b.HasIndex("IdentityProviderCategoryId") - .HasDatabaseName("ix_identity_providers_identity_provider_category_id"); - - b.ToTable("identity_providers", "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 = 1, - Label = "KEYCLOAK_SHARED" - }, - new - { - Id = 2, - Label = "KEYCLOAK_OIDC" - }, - new - { - Id = 3, - Label = "KEYCLOAK_SAML" - }); - }); - - 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" - }); - }); - - 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.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.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" - }); - }); - - 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("Provider") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("provider"); - - 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("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"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFER", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFER() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFER$\r\nBEGIN\r\n INSERT INTO portal.audit_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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 OLD.id, \r\n OLD.name, \r\n OLD.date_created, \r\n OLD.date_released, \r\n OLD.marketing_url, \r\n OLD.contact_email, \r\n OLD.contact_number, \r\n OLD.provider, \r\n OLD.offer_type_id, \r\n OLD.sales_manager_id, \r\n OLD.provider_company_id, \r\n OLD.offer_status_id, \r\n OLD.license_type_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFER$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFER AFTER DELETE\r\nON portal.offers\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFER();") - .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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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_offer20230406 (\"id\", \"name\", \"date_created\", \"date_released\", \"marketing_url\", \"contact_email\", \"contact_number\", \"provider\", \"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.provider, \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_DATE, \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("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("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"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$\r\nBEGIN\r\n INSERT INTO portal.audit_offer_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.company_id, \r\n OLD.offer_id, \r\n OLD.offer_subscription_status_id, \r\n OLD.display_name, \r\n OLD.description, \r\n OLD.requester_id, \r\n OLD.last_editor_id, \r\n OLD.process_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION AFTER DELETE\r\nON portal.offer_subscriptions\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_OFFERSUBSCRIPTION();") - .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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \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_subscription20230317 (\"id\", \"company_id\", \"offer_id\", \"offer_subscription_status_id\", \"display_name\", \"description\", \"requester_id\", \"last_editor_id\", \"process_id\", \"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 gen_random_uuid(), \r\n 2, \r\n CURRENT_DATE, \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("OfferSubscriptionId") - .HasColumnType("uuid") - .HasColumnName("offer_subscription_id"); - - b.Property("OfferUrl") - .IsRequired() - .HasColumnType("text") - .HasColumnName("offer_url"); - - b.HasKey("OfferSubscriptionId") - .HasName("pk_offer_subscriptions_process_datas"); - - 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"); - - 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.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 = "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 = "END_CLEARING_HOUSE" - }, - 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 = 15, - Label = "OVERRIDE_BUSINESS_PARTNER_NUMBER" - }, - new - { - Id = 16, - Label = "TRIGGER_OVERRIDE_CLEARING_HOUSE" - }, - new - { - Id = 17, - Label = "START_OVERRIDE_CLEARING_HOUSE" - }, - new - { - Id = 18, - Label = "FINISH_SELF_DESCRIPTION_LP" - }, - new - { - Id = 19, - Label = "DECLINE_APPLICATION" - }, - new - { - Id = 100, - Label = "TRIGGER_PROVIDER" - }, - new - { - Id = 101, - Label = "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" - }); - }); - - 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" - }); - }); - - 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.ToTable("provider_company_details", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$\r\nBEGIN\r\n INSERT INTO portal.audit_provider_company_detail20230614 (\"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 OLD.id, \r\n OLD.date_created, \r\n OLD.auto_setup_url, \r\n OLD.auto_setup_callback_url, \r\n OLD.company_id, \r\n OLD.date_last_changed, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL AFTER DELETE\r\nON portal.provider_company_details\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_PROVIDERCOMPANYDETAIL();") - .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_detail20230614 (\"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_DATE, \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_detail20230614 (\"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_DATE, \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 = "CONSULTANCE_SERVICE" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("OfferId") - .HasColumnType("uuid") - .HasColumnName("offer_id"); - - b.HasKey("Id") - .HasName("pk_technical_user_profiles"); - - b.HasIndex("OfferId") - .HasDatabaseName("ix_technical_user_profiles_offer_id"); - - b.ToTable("technical_user_profiles", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => - { - b.Property("TechnicalUserProfileId") - .HasColumnType("uuid") - .HasColumnName("technical_user_profile_id"); - - b.Property("UserRoleId") - .HasColumnType("uuid") - .HasColumnName("user_role_id"); - - b.HasKey("TechnicalUserProfileId", "UserRoleId") - .HasName("pk_technical_user_profile_assigned_user_roles"); - - b.HasIndex("UserRoleId") - .HasDatabaseName("ix_technical_user_profile_assigned_user_roles_user_role_id"); - - b.ToTable("technical_user_profile_assigned_user_roles", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("label"); - - b.HasKey("Id") - .HasName("pk_unique_identifiers"); - - b.ToTable("unique_identifiers", "portal"); - - b.HasData( - new - { - Id = 1, - Label = "COMMERCIAL_REG_NUMBER" - }, - new - { - Id = 2, - Label = "VAT_ID" - }, - new - { - Id = 3, - Label = "LEI_CODE" - }, - new - { - Id = 4, - Label = "VIES" - }, - new - { - Id = 5, - Label = "EORI" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name"); - - b.Property("Shortname") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("shortname"); - - b.HasKey("Id") - .HasName("pk_use_cases"); - - b.ToTable("use_cases", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCaseDescription", b => - { - b.Property("UseCaseId") - .HasColumnType("uuid") - .HasColumnName("use_case_id"); - - b.Property("LanguageShortName") - .HasMaxLength(2) - .HasColumnType("character(2)") - .HasColumnName("language_short_name"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description"); - - b.HasKey("UseCaseId", "LanguageShortName") - .HasName("pk_use_case_descriptions"); - - b.HasIndex("LanguageShortName") - .HasDatabaseName("ix_use_case_descriptions_language_short_name"); - - b.ToTable("use_case_descriptions", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("LastEditorId") - .HasColumnType("uuid") - .HasColumnName("last_editor_id"); - - b.Property("OfferId") - .HasColumnType("uuid") - .HasColumnName("offer_id"); - - b.Property("UserRoleText") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("user_role"); - - b.HasKey("Id") - .HasName("pk_user_roles"); - - b.HasIndex("OfferId") - .HasDatabaseName("ix_user_roles_offer_id"); - - b.ToTable("user_roles", "portal"); - - b - .HasAnnotation("LC_TRIGGER_AFTER_DELETE_USERROLE", "CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_USERROLE() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_USERROLE$\r\nBEGIN\r\n INSERT INTO portal.audit_user_role20221017 (\"id\", \"user_role\", \"offer_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.user_role, \r\n OLD.offer_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_USERROLE$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_USERROLE AFTER DELETE\r\nON portal.user_roles\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_USERROLE();") - .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_role20221017 (\"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_DATE, \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_role20221017 (\"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_DATE, \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.Entities.VerifiedCredentialExternalType", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("Label") - .IsRequired() - .HasColumnType("text") - .HasColumnName("label"); - - b.HasKey("Id") - .HasName("pk_verified_credential_external_types"); - - b.ToTable("verified_credential_external_types", "portal"); - - b.HasData( - new - { - Id = 1, - Label = "TRACEABILITY_CREDENTIAL" - }, - new - { - Id = 2, - Label = "PCF_CREDENTIAL" - }, - new - { - Id = 3, - Label = "BEHAVIOR_TWIN_CREDENTIAL" - }, - new - { - Id = 4, - Label = "VEHICLE_DISMANTLE" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Expiry") - .HasColumnType("timestamp with time zone") - .HasColumnName("expiry"); - - b.Property("Template") - .IsRequired() - .HasColumnType("text") - .HasColumnName("template"); - - b.Property("ValidFrom") - .HasColumnType("timestamp with time zone") - .HasColumnName("valid_from"); - - b.Property("VerifiedCredentialExternalTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_external_type_id"); - - b.Property("Version") - .IsRequired() - .HasColumnType("text") - .HasColumnName("version"); - - b.HasKey("Id") - .HasName("pk_verified_credential_external_type_use_case_detail_versions"); - - b.HasIndex("VerifiedCredentialExternalTypeId", "Version") - .IsUnique() - .HasDatabaseName("ix_verified_credential_external_type_use_case_detail_versions_"); - - b.ToTable("verified_credential_external_type_use_case_detail_versions", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", 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_verified_credential_types"); - - b.ToTable("verified_credential_types", "portal"); - - b.HasData( - new - { - Id = 1, - Label = "TRACEABILITY_FRAMEWORK" - }, - new - { - Id = 2, - Label = "PCF_FRAMEWORK" - }, - new - { - Id = 3, - Label = "BEHAVIOR_TWIN_FRAMEWORK" - }, - new - { - Id = 4, - Label = "DISMANTLER_CERTIFICATE" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => - { - b.Property("VerifiedCredentialTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_id"); - - b.Property("VerifiedCredentialExternalTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_external_type_id"); - - b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialExternalTypeId") - .HasName("pk_verified_credential_type_assigned_external_types"); - - b.HasIndex("VerifiedCredentialExternalTypeId") - .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c"); - - b.HasIndex("VerifiedCredentialTypeId") - .IsUnique() - .HasDatabaseName("ix_verified_credential_type_assigned_external_types_verified_c1"); - - b.ToTable("verified_credential_type_assigned_external_types", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => - { - b.Property("VerifiedCredentialTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_id"); - - b.Property("VerifiedCredentialTypeKindId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_kind_id"); - - b.HasKey("VerifiedCredentialTypeId", "VerifiedCredentialTypeKindId") - .HasName("pk_verified_credential_type_assigned_kinds"); - - b.HasIndex("VerifiedCredentialTypeId") - .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential"); - - b.HasIndex("VerifiedCredentialTypeKindId") - .HasDatabaseName("ix_verified_credential_type_assigned_kinds_verified_credential1"); - - b.ToTable("verified_credential_type_assigned_kinds", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => - { - b.Property("VerifiedCredentialTypeId") - .HasColumnType("integer") - .HasColumnName("verified_credential_type_id"); - - b.Property("UseCaseId") - .HasColumnType("uuid") - .HasColumnName("use_case_id"); - - b.HasKey("VerifiedCredentialTypeId", "UseCaseId") - .HasName("pk_verified_credential_type_assigned_use_cases"); - - b.HasIndex("UseCaseId") - .IsUnique() - .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_use_case_id"); - - b.HasIndex("VerifiedCredentialTypeId") - .IsUnique() - .HasDatabaseName("ix_verified_credential_type_assigned_use_cases_verified_creden"); - - b.ToTable("verified_credential_type_assigned_use_cases", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", 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_verified_credential_type_kinds"); - - b.ToTable("verified_credential_type_kinds", "portal"); - - b.HasData( - new - { - Id = 1, - Label = "USE_CASE" - }, - new - { - Id = 2, - Label = "CERTIFICATE" - }); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => - { - b.Property("ServiceAccountId") - .HasColumnType("uuid") - .HasColumnName("service_account_id"); - - b.Property("Owners") - .HasColumnType("uuid") - .HasColumnName("owners"); - - b.Property("Provider") - .HasColumnType("uuid") - .HasColumnName("provider"); - - b.HasKey("ServiceAccountId"); - - b.ToTable((string)null); - - b.ToView("company_linked_service_accounts", "portal"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.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_temp_id"); - - 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.Document", "Document") - .WithMany("Agreements") - .HasForeignKey("DocumentId") - .HasConstraintName("fk_agreements_documents_document_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "IssuerCompany") - .WithMany("Agreements") - .HasForeignKey("IssuerCompanyId") - .IsRequired() - .HasConstraintName("fk_agreements_companies_issuer_company_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") - .WithMany("Agreements") - .HasForeignKey("UseCaseId") - .HasConstraintName("fk_agreements_use_cases_use_case_id"); - - b.Navigation("AgreementCategory"); - - b.Navigation("Document"); - - b.Navigation("IssuerCompany"); - - b.Navigation("UseCase"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedCompanyRole", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") - .WithMany("AgreementAssignedCompanyRoles") - .HasForeignKey("AgreementId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_company_roles_agreements_agreement_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") - .WithMany("AgreementAssignedCompanyRoles") - .HasForeignKey("CompanyRoleId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_company_roles_company_roles_company_role"); - - b.Navigation("Agreement"); - - b.Navigation("CompanyRole"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOffer", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") - .WithMany("AgreementAssignedOffers") - .HasForeignKey("AgreementId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_offers_agreements_agreement_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") - .WithMany("AgreementAssignedOffers") - .HasForeignKey("OfferId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_offers_offers_offer_id"); - - b.Navigation("Agreement"); - - b.Navigation("Offer"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AgreementAssignedOfferType", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Agreement", "Agreement") - .WithMany("AgreementAssignedOfferTypes") - .HasForeignKey("AgreementId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_offer_types_agreements_agreement_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", "OfferType") - .WithMany("AgreementAssignedOfferTypes") - .HasForeignKey("OfferTypeId") - .IsRequired() - .HasConstraintName("fk_agreement_assigned_offer_types_offer_types_offer_type_id"); - - b.Navigation("Agreement"); - - b.Navigation("OfferType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppAssignedUseCase", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") - .WithMany() - .HasForeignKey("AppId") - .IsRequired() - .HasConstraintName("fk_app_assigned_use_cases_offers_app_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") - .WithMany() - .HasForeignKey("UseCaseId") - .IsRequired() - .HasConstraintName("fk_app_assigned_use_cases_use_cases_use_case_id"); - - b.Navigation("App"); - - b.Navigation("UseCase"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") - .WithMany("AppInstances") - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.SetNull) - .IsRequired() - .HasConstraintName("fk_app_instances_offers_app_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", "IamClient") - .WithMany("AppInstances") - .HasForeignKey("IamClientId") - .OnDelete(DeleteBehavior.SetNull) - .IsRequired() - .HasConstraintName("fk_app_instances_iam_clients_iam_client_id"); - - b.Navigation("App"); - - b.Navigation("IamClient"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceAssignedCompanyServiceAccount", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstance", "AppInstance") - .WithMany("ServiceAccounts") - .HasForeignKey("AppInstanceId") - .IsRequired() - .HasConstraintName("fk_app_instance_assigned_service_accounts_app_instances_app_in"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") - .WithMany("AppInstances") - .HasForeignKey("CompanyServiceAccountId") - .IsRequired() - .HasConstraintName("fk_app_instance_assigned_service_accounts_company_service_acco"); - - b.Navigation("AppInstance"); - - b.Navigation("CompanyServiceAccount"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") - .WithOne("AppInstanceSetup") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppInstanceSetup", "AppId") - .IsRequired() - .HasConstraintName("fk_app_instance_setups_offers_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.AppLanguage", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "App") - .WithMany() - .HasForeignKey("AppId") - .IsRequired() - .HasConstraintName("fk_app_languages_offers_app_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Language", "Language") - .WithMany() - .HasForeignKey("LanguageShortName") - .IsRequired() - .HasConstraintName("fk_app_languages_languages_language_temp_id"); - - b.Navigation("App"); - - b.Navigation("Language"); - }); - - 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.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.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("OfferSubscription"); - }); - - 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.Document", "SelfDescriptionDocument") - .WithMany("Companies") - .HasForeignKey("SelfDescriptionDocumentId") - .HasConstraintName("fk_companies_documents_self_description_document_id"); - - b.Navigation("Address"); - - b.Navigation("CompanyStatus"); - - 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.Company", "Company") - .WithMany("CompanyApplications") - .HasForeignKey("CompanyId") - .IsRequired() - .HasConstraintName("fk_company_applications_companies_company_id"); - - b.Navigation("ApplicationStatus"); - - b.Navigation("ChecklistProcess"); - - b.Navigation("Company"); - }); - - 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.Navigation("Company"); - - b.Navigation("CompanyRole"); - }); - - 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.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") - .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") - .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.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_temp_id1"); - - b.Navigation("CompanyRole"); - - b.Navigation("Language"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRole", "CompanyRole") - .WithOne("CompanyRoleRegistrationData") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyRoleRegistrationData", "CompanyRoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_company_role_registration_data_company_roles_company_role_id"); - - b.Navigation("CompanyRole"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.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_identity_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("CompanyServiceAccountType"); - - b.Navigation("Identity"); - - b.Navigation("OfferSubscription"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") - .WithMany("CompanySsiDetails") - .HasForeignKey("CompanyId") - .IsRequired() - .HasConstraintName("fk_company_ssi_details_companies_company_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetailStatus", "CompanySsiDetailStatus") - .WithMany("CompanySsiDetails") - .HasForeignKey("CompanySsiDetailStatusId") - .IsRequired() - .HasConstraintName("fk_company_ssi_details_company_ssi_detail_statuses_company_ssi"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CreatorUser") - .WithMany("CompanySsiDetails") - .HasForeignKey("CreatorUserId") - .IsRequired() - .HasConstraintName("fk_company_ssi_details_company_users_creator_user_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", "Document") - .WithOne("CompanySsiDetail") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanySsiDetail", "DocumentId") - .IsRequired() - .HasConstraintName("fk_company_ssi_details_documents_document_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", "VerifiedCredentialExternalTypeUseCaseDetailVersion") - .WithMany("CompanySsiDetails") - .HasForeignKey("VerifiedCredentialExternalTypeUseCaseDetailId") - .HasConstraintName("fk_company_ssi_details_verified_credential_external_type_use_c"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") - .WithMany("CompanySsiDetails") - .HasForeignKey("VerifiedCredentialTypeId") - .IsRequired() - .HasConstraintName("fk_company_ssi_details_verified_credential_types_verified_cred"); - - b.Navigation("Company"); - - b.Navigation("CompanySsiDetailStatus"); - - b.Navigation("CreatorUser"); - - b.Navigation("Document"); - - b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersion"); - - b.Navigation("VerifiedCredentialType"); - }); - - 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_identity_id"); - - b.Navigation("Identity"); - }); - - 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.Connector", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") - .WithOne("Connector") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "CompanyServiceAccountId") - .HasConstraintName("fk_connectors_company_service_accounts_company_service_account"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Host") - .WithMany("HostedConnectors") - .HasForeignKey("HostId") - .HasConstraintName("fk_connectors_companies_host_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", "LastEditor") - .WithMany() - .HasForeignKey("LastEditorId") - .HasConstraintName("fk_connectors_identities_last_editor_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Country", "Location") - .WithMany("Connectors") - .HasForeignKey("LocationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_connectors_countries_location_temp_id1"); - - 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.Document", "SelfDescriptionDocument") - .WithOne("Connector") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "SelfDescriptionDocumentId") - .HasConstraintName("fk_connectors_documents_self_description_document_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorStatus", "Status") - .WithMany("Connectors") - .HasForeignKey("StatusId") - .IsRequired() - .HasConstraintName("fk_connectors_connector_statuses_status_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorType", "Type") - .WithMany("Connectors") - .HasForeignKey("TypeId") - .IsRequired() - .HasConstraintName("fk_connectors_connector_types_type_id"); - - b.Navigation("CompanyServiceAccount"); - - b.Navigation("Host"); - - b.Navigation("LastEditor"); - - b.Navigation("Location"); - - b.Navigation("Provider"); - - b.Navigation("SelfDescriptionDocument"); - - b.Navigation("Status"); - - b.Navigation("Type"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorAssignedOfferSubscription", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") - .WithMany("ConnectorAssignedOfferSubscriptions") - .HasForeignKey("ConnectorId") - .IsRequired() - .HasConstraintName("fk_connector_assigned_offer_subscriptions_connectors_connector"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", "OfferSubscription") - .WithMany("ConnectorAssignedOfferSubscriptions") - .HasForeignKey("OfferSubscriptionId") - .IsRequired() - .HasConstraintName("fk_connector_assigned_offer_subscriptions_offer_subscriptions_"); - - b.Navigation("Connector"); - - b.Navigation("OfferSubscription"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Connector", "Connector") - .WithOne("ClientDetails") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ConnectorClientDetail", "ConnectorId") - .OnDelete(DeleteBehavior.SetNull) - .IsRequired() - .HasConstraintName("fk_connector_client_details_connectors_connector_id"); - - b.Navigation("Connector"); - }); - - 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.Navigation("Agreement"); - - b.Navigation("Company"); - - b.Navigation("CompanyUser"); - - b.Navigation("ConsentStatus"); - - b.Navigation("Document"); - }); - - 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.Document", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyUser", "CompanyUser") - .WithMany("Documents") - .HasForeignKey("CompanyUserId") - .HasConstraintName("fk_documents_company_users_company_user_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", "DocumentStatus") - .WithMany("Documents") - .HasForeignKey("DocumentStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_documents_document_status_document_status_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", "DocumentType") - .WithMany("Documents") - .HasForeignKey("DocumentTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_documents_document_types_document_type_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.MediaType", "MediaType") - .WithMany("Documents") - .HasForeignKey("MediaTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_documents_media_types_media_type_id"); - - b.Navigation("CompanyUser"); - - b.Navigation("DocumentStatus"); - - b.Navigation("DocumentType"); - - b.Navigation("MediaType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", "IdentityProvider") - .WithOne("IamIdentityProvider") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamIdentityProvider", "IdentityProviderId") - .IsRequired() - .HasConstraintName("fk_iam_identity_providers_identity_providers_identity_provider"); - - b.Navigation("IdentityProvider"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Company", "Company") - .WithMany("Identities") - .HasForeignKey("CompanyId") - .IsRequired() - .HasConstraintName("fk_identities_companies_company_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityType", "IdentityType") - .WithMany("Identities") - .HasForeignKey("IdentityTypeId") - .IsRequired() - .HasConstraintName("fk_identities_identity_type_identity_type_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityUserStatus", "IdentityStatus") - .WithMany("Identities") - .HasForeignKey("UserStatusId") - .IsRequired() - .HasConstraintName("fk_identities_identity_user_statuses_identity_status_id"); - - b.Navigation("Company"); - - b.Navigation("IdentityStatus"); - - b.Navigation("IdentityType"); - }); - - 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.UserRole", "UserRole") - .WithMany("IdentityAssignedRoles") - .HasForeignKey("UserRoleId") - .IsRequired() - .HasConstraintName("fk_identity_assigned_roles_user_roles_user_role_id"); - - b.Navigation("Identity"); - - 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.Navigation("IdentityProviderCategory"); - }); - - 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_long_name_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_language_short_name"); - - b.Navigation("Language"); - - b.Navigation("LongNameLanguage"); - }); - - 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_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_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.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") - .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("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.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("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.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.Navigation("Company"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceDetail", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Service") - .WithMany("ServiceDetails") - .HasForeignKey("ServiceId") - .IsRequired() - .HasConstraintName("fk_service_details_offers_service_id"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.ServiceType", "ServiceType") - .WithMany("ServiceDetails") - .HasForeignKey("ServiceTypeId") - .IsRequired() - .HasConstraintName("fk_service_details_service_types_service_type_id"); - - b.Navigation("Service"); - - b.Navigation("ServiceType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", "Offer") - .WithMany("TechnicalUserProfiles") - .HasForeignKey("OfferId") - .IsRequired() - .HasConstraintName("fk_technical_user_profiles_offers_offer_id"); - - b.Navigation("Offer"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfileAssignedUserRole", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.TechnicalUserProfile", "TechnicalUserProfile") - .WithMany("TechnicalUserProfileAssignedUserRoles") - .HasForeignKey("TechnicalUserProfileId") - .IsRequired() - .HasConstraintName("fk_technical_user_profile_assigned_user_roles_technical_user_p"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UserRole", "UserRole") - .WithMany("TechnicalUserProfileAssignedUserRole") - .HasForeignKey("UserRoleId") - .IsRequired() - .HasConstraintName("fk_technical_user_profile_assigned_user_roles_user_roles_user_r"); - - 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.Offer", "Offer") - .WithMany("UserRoles") - .HasForeignKey("OfferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_user_roles_offers_offer_id"); - - 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.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") - .WithMany("VerifiedCredentialExternalTypeUseCaseDetailVersions") - .HasForeignKey("VerifiedCredentialExternalTypeId") - .IsRequired() - .HasConstraintName("fk_verified_credential_external_type_use_case_detail_versions_"); - - b.Navigation("VerifiedCredentialExternalType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", "VerifiedCredentialExternalType") - .WithMany("VerifiedCredentialTypeAssignedExternalTypes") - .HasForeignKey("VerifiedCredentialExternalTypeId") - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") - .WithOne("VerifiedCredentialTypeAssignedExternalType") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedExternalType", "VerifiedCredentialTypeId") - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_external_types_verified_c1"); - - b.Navigation("VerifiedCredentialExternalType"); - - b.Navigation("VerifiedCredentialType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") - .WithOne("VerifiedCredentialTypeAssignedKind") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedKind", "VerifiedCredentialTypeId") - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", "VerifiedCredentialTypeKind") - .WithMany("VerifiedCredentialTypeAssignedKinds") - .HasForeignKey("VerifiedCredentialTypeKindId") - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_kinds_verified_credential1"); - - b.Navigation("VerifiedCredentialType"); - - b.Navigation("VerifiedCredentialTypeKind"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", "UseCase") - .WithOne("VerifiedCredentialAssignedUseCase") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "UseCaseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_use_cases_use_cases_use_c"); - - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", "VerifiedCredentialType") - .WithOne("VerifiedCredentialTypeAssignedUseCase") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeAssignedUseCase", "VerifiedCredentialTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_verified_credential_type_assigned_use_cases_verified_creden"); - - b.Navigation("UseCase"); - - b.Navigation("VerifiedCredentialType"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", b => - { - b.HasOne("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", "CompanyServiceAccount") - .WithOne("CompaniesLinkedServiceAccount") - .HasForeignKey("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Views.CompaniesLinkedServiceAccount", "ServiceAccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_company_linked_service_accounts_company_service_accounts_co"); - - b.Navigation("CompanyServiceAccount"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.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.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("CompanyIdentifiers"); - - b.Navigation("CompanySsiDetails"); - - b.Navigation("Consents"); - - b.Navigation("HostedConnectors"); - - b.Navigation("Identities"); - - b.Navigation("OfferSubscriptions"); - - 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("Invitations"); - }); - - 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.CompanyRole", b => - { - b.Navigation("AgreementAssignedCompanyRoles"); - - b.Navigation("CompanyAssignedRoles"); - - b.Navigation("CompanyRoleAssignedRoleCollection"); - - b.Navigation("CompanyRoleDescriptions"); - - b.Navigation("CompanyRoleRegistrationData"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.CompanyServiceAccount", b => - { - b.Navigation("AppInstances"); - - b.Navigation("CompaniesLinkedServiceAccount"); - - b.Navigation("Connector"); - }); - - 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.CompanySsiDetailStatus", b => - { - b.Navigation("CompanySsiDetails"); - }); - - 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("CompanySsiDetails"); - - b.Navigation("CompanyUserAssignedBusinessPartners"); - - 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("ClientDetails"); - - 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"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Document", b => - { - b.Navigation("Agreements"); - - b.Navigation("Companies"); - - b.Navigation("CompanySsiDetail"); - - b.Navigation("Connector"); - - b.Navigation("Consents"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentStatus", b => - { - b.Navigation("Documents"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.DocumentType", b => - { - b.Navigation("Documents"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IamClient", b => - { - b.Navigation("AppInstances"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Identity", b => - { - b.Navigation("CompanyServiceAccount"); - - b.Navigation("CompanyUser"); - - b.Navigation("CreatedNotifications"); - - b.Navigation("IdentityAssignedRoles"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.IdentityProvider", b => - { - b.Navigation("CompanyIdentityProviders"); - - b.Navigation("IamIdentityProvider"); - }); - - 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.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("CompanyRoleDescriptions"); - - 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.MediaType", b => - { - b.Navigation("Documents"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationTopic", b => - { - b.Navigation("NotificationTypeAssignedTopics"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.NotificationType", b => - { - b.Navigation("NotificationTypeAssignedTopic"); - - b.Navigation("Notifications"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Offer", b => - { - b.Navigation("AgreementAssignedOffers"); - - b.Navigation("AppInstanceSetup"); - - b.Navigation("AppInstances"); - - b.Navigation("ConsentAssignedOffers"); - - b.Navigation("OfferAssignedPrivacyPolicies"); - - b.Navigation("OfferDescriptions"); - - b.Navigation("OfferSubscriptions"); - - b.Navigation("ServiceDetails"); - - b.Navigation("Tags"); - - b.Navigation("TechnicalUserProfiles"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferStatus", b => - { - b.Navigation("Offers"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscription", b => - { - b.Navigation("AppSubscriptionDetail"); - - b.Navigation("CompanyServiceAccounts"); - - b.Navigation("ConnectorAssignedOfferSubscriptions"); - - b.Navigation("ConsentAssignedOfferSubscriptions"); - - b.Navigation("OfferSubscriptionProcessData"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferSubscriptionStatus", b => - { - b.Navigation("OfferSubscriptions"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.OfferType", b => - { - b.Navigation("AgreementAssignedOfferTypes"); - - b.Navigation("Offers"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.PrivacyPolicy", b => - { - b.Navigation("OfferAssignedPrivacyPolicies"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.Process", b => - { - b.Navigation("CompanyApplication"); - - b.Navigation("OfferSubscription"); - - b.Navigation("ProcessSteps"); - }); - - 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.TechnicalUserProfile", b => - { - b.Navigation("TechnicalUserProfileAssignedUserRoles"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UniqueIdentifier", b => - { - b.Navigation("CompanyIdentifiers"); - - b.Navigation("CountryAssignedIdentifiers"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.UseCase", b => - { - b.Navigation("Agreements"); - - b.Navigation("CompanyAssignedUseCase"); - - b.Navigation("UseCaseDescriptions"); - - b.Navigation("VerifiedCredentialAssignedUseCase"); - }); - - 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"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalType", b => - { - b.Navigation("VerifiedCredentialExternalTypeUseCaseDetailVersions"); - - b.Navigation("VerifiedCredentialTypeAssignedExternalTypes"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialExternalTypeUseCaseDetailVersion", b => - { - b.Navigation("CompanySsiDetails"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialType", b => - { - b.Navigation("CompanySsiDetails"); - - b.Navigation("VerifiedCredentialTypeAssignedExternalType"); - - b.Navigation("VerifiedCredentialTypeAssignedKind"); - - b.Navigation("VerifiedCredentialTypeAssignedUseCase"); - }); - - modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities.VerifiedCredentialTypeKind", b => - { - b.Navigation("VerifiedCredentialTypeAssignedKinds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs deleted file mode 100644 index e7dbaae581..0000000000 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230726140020_CPLP-3042-ChangeNotificationCreator.cs +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2021, 2023 BMW Group AG - * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations -{ - public partial class CPLP3042ChangeNotificationCreator : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_notifications_company_users_creator_id", - schema: "portal", - table: "notifications"); - - migrationBuilder.AddForeignKey( - name: "fk_notifications_identities_creator_id", - schema: "portal", - table: "notifications", - column: "creator_user_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_notifications_identities_creator_id", - schema: "portal", - table: "notifications"); - - migrationBuilder.Sql("UPDATE portal.notifications as n SET creator_user_id = null FROM (SELECT id FROM portal.identities where identity_type_id = 2) AS i WHERE i.id = n.creator_user_id"); - - migrationBuilder.AddForeignKey( - name: "fk_notifications_company_users_creator_id", - schema: "portal", - table: "notifications", - column: "creator_user_id", - principalSchema: "portal", - principalTable: "company_users", - principalColumn: "id"); - } - } -} diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs similarity index 99% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs index c7afaa442c..62059ffa8c 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.Designer.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs @@ -29,8 +29,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { [DbContext(typeof(PortalDbContext))] - [Migration("20230727191716_AddLastEditorConstraints")] - partial class AddLastEditorConstraints + [Migration("20230731123725_1.6.0-rc4")] + partial class _160rc4 { protected override void BuildTargetModel(ModelBuilder modelBuilder) { diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.cs similarity index 90% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.cs index e643e5a4f6..d7958903f1 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230727191716_AddLastEditorConstraints.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.cs @@ -24,10 +24,15 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { - public partial class AddLastEditorConstraints : Migration + public partial class _160rc4 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.DropForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications"); + migrationBuilder.CreateIndex( name: "ix_user_roles_last_editor_id", schema: "portal", @@ -172,6 +177,15 @@ protected override void Up(MigrationBuilder migrationBuilder) principalTable: "identities", principalColumn: "id"); + migrationBuilder.AddForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + migrationBuilder.AddForeignKey( name: "fk_offer_subscriptions_identities_last_editor_id", schema: "portal", @@ -251,6 +265,11 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: "portal", table: "identity_assigned_roles"); + migrationBuilder.DropForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications"); + migrationBuilder.DropForeignKey( name: "fk_offer_subscriptions_identities_last_editor_id", schema: "portal", @@ -330,6 +349,17 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "ix_app_subscription_details_last_editor_id", schema: "portal", table: "app_subscription_details"); + + migrationBuilder.Sql("UPDATE portal.notifications as n SET creator_user_id = null FROM (SELECT id FROM portal.identities where identity_type_id = 2) AS i WHERE i.id = n.creator_user_id"); + + migrationBuilder.AddForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "company_users", + principalColumn: "id"); } } } From 60c9b3a40eb1451379fb4b7aa3dcdc3bf98e0fb8 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 31 Jul 2023 15:09:00 +0200 Subject: [PATCH 10/10] fix(invitedUsers): filter deleted users for invitedUsers endpoint (#155) Refs: CPLP-2986 Co-authored-by: Norbert Truchsess Reviewed-By: Norbert Truchsess --- .../Repositories/InvitationRepository.cs | 23 +++++----- .../InvitationRepositoryTests.cs | 43 ++++++++++++++++++- .../Seeder/Data/company_users.test.json | 18 ++++++++ .../Seeder/Data/identities.test.json | 16 +++++++ .../Seeder/Data/invitations.test.json | 16 ++++++- 5 files changed, 101 insertions(+), 15 deletions(-) diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs index 547f5a39be..1a435a024c 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs @@ -22,6 +22,7 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; @@ -33,19 +34,17 @@ public InvitationRepository(PortalDbContext dbContext) { _dbContext = dbContext; } - public IAsyncEnumerable GetInvitedUserDetailsUntrackedAsync(Guid applicationId) => - (from invitation in _dbContext.Invitations - join invitationStatus in _dbContext.InvitationStatuses on invitation.InvitationStatusId equals invitationStatus.Id - join companyuser in _dbContext.CompanyUsers on invitation.CompanyUserId equals companyuser.Id - where invitation.CompanyApplicationId == applicationId - select new InvitedUserDetail( - companyuser.Identity!.UserEntityId, - invitationStatus.Id, - companyuser.Email - )) - .AsNoTracking() - .AsAsyncEnumerable(); + _dbContext.Invitations + .AsNoTracking() + .Where(invitation => + invitation.CompanyApplicationId == applicationId && + invitation.CompanyUser!.Identity!.UserStatusId != UserStatusId.DELETED) + .Select(invitation => new InvitedUserDetail( + invitation.CompanyUser!.Identity!.UserEntityId, + invitation.InvitationStatusId, + invitation.CompanyUser.Email)) + .AsAsyncEnumerable(); public Task GetInvitationStatusAsync(Guid companyUserId) => _dbContext.Invitations diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/InvitationRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/InvitationRepositoryTests.cs index fc9c5f8749..a060ad8650 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/InvitationRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/InvitationRepositoryTests.cs @@ -1,7 +1,46 @@ +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; +using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; +using Xunit.Extensions.AssemblyFixture; + namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests; -public class InvitationRepositoryTests +public class InvitationRepositoryTests : IAssemblyFixture { + private readonly TestDbFixture _dbTestDbFixture; + private readonly Guid _applicationId = new("6b2d1263-c073-4a48-bfaf-704dc154ca9e"); + + public InvitationRepositoryTests(TestDbFixture testDbFixture) + { + var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); + fixture.Behaviors.OfType().ToList() + .ForEach(b => fixture.Behaviors.Remove(b)); + + fixture.Behaviors.Add(new OmitOnRecursionBehavior()); + _dbTestDbFixture = testDbFixture; + } + + [Fact] + public async Task GetInvitedUserDetailsUntrackedAsync_WithValid_ReturnsExpected() + { + var sut = await CreateSut().ConfigureAwait(false); + + var result = await sut.GetInvitedUserDetailsUntrackedAsync(_applicationId).ToListAsync().ConfigureAwait(false); + + result.Should().HaveCount(2) + .And.Satisfy( + x => x.EmailId == "test@user.com" && x.InvitationStatus == InvitationStatusId.CREATED, + x => x.EmailId == "company.admin1@acme.corp" && x.InvitationStatus == InvitationStatusId.CREATED); + } + + #region Setup + + private async Task CreateSut() + { + var context = await _dbTestDbFixture.GetPortalDbContext().ConfigureAwait(false); + var sut = new InvitationRepository(context); + return sut; + } - // TODO (PS): GetInvitedUserDetailsUntrackedAsync + #endregion } diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_users.test.json b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_users.test.json index 397cb5899b..b2802a1af8 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_users.test.json +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/company_users.test.json @@ -70,5 +70,23 @@ "lastlogin": null, "lastname": "Provider", "last_editor_id": null + }, + { + "id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f5", + "date_last_changed": "2022-10-01 18:01:33.570000 +00:00", + "email": "test@user.com", + "firstname": "Test", + "lastlogin": null, + "lastname": "User", + "last_editor_id": null + }, + { + "id": "1dceacb8-c5a5-4573-a77d-e2487ac4a8aa", + "date_last_changed": "2022-10-01 18:01:33.570000 +00:00", + "email": "test@user.com", + "firstname": "Deleted", + "lastlogin": null, + "lastname": "User", + "last_editor_id": null } ] diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/identities.test.json b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/identities.test.json index da9cd1c656..c491aa8f2b 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/identities.test.json +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/identities.test.json @@ -102,5 +102,21 @@ "user_status_id": 1, "user_entity_id": null, "identity_type_id": 2 + }, + { + "id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f5", + "date_created": "2022-06-01 18:01:33.439000 +00:00", + "company_id": "41fd2ab8-71cd-4546-9bef-a388d91b2542", + "user_status_id": 1, + "user_entity_id": null, + "identity_type_id": 1 + }, + { + "id": "1dceacb8-c5a5-4573-a77d-e2487ac4a8aa", + "date_created": "2022-06-01 18:01:33.439000 +00:00", + "company_id": "41fd2ab8-71cd-4546-9bef-a388d91b2542", + "user_status_id": 3, + "user_entity_id": null, + "identity_type_id": 1 } ] diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/invitations.test.json b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/invitations.test.json index 9f8131d0fc..c0e1e7fd58 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/invitations.test.json +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/Seeder/Data/invitations.test.json @@ -12,5 +12,19 @@ "invitation_status_id": 1, "company_application_id": "6b2d1263-c073-4a48-bfaf-704dc154ca9e", "company_user_id": "ac1cf001-7fbc-1f2f-817f-bce058019994" + }, + { + "id": "d54db875-774c-479f-9f14-375f2cb8b263", + "date_created": "2022-03-24 18:01:33.439000 +00:00", + "invitation_status_id": 1, + "company_application_id": "6b2d1263-c073-4a48-bfaf-704dc154ca9e", + "company_user_id": "d0c8ae19-d4f3-49cc-9cb4-6c766d4680f5" + }, + { + "id": "d54db875-774c-479f-9f14-375f2cb8b264", + "date_created": "2022-03-24 18:01:33.439000 +00:00", + "invitation_status_id": 1, + "company_application_id": "6b2d1263-c073-4a48-bfaf-704dc154ca9e", + "company_user_id": "1dceacb8-c5a5-4573-a77d-e2487ac4a8aa" } -] \ No newline at end of file +]