// using System; using AMREZ.EOP.Infrastructures.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace AMREZ.EOP.Infrastructures.Migrations { [DbContext(typeof(AppDbContext))] [Migration("20251009040810_AddCustomer")] partial class AddCustomer { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Permission", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Code") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Name") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Code") .IsUnique(); b.ToTable("permissions", null, t => { t.HasCheckConstraint("ck_permissions_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_permissions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Role", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Code") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Name") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Code") .IsUnique(); b.ToTable("roles", null, t => { t.HasCheckConstraint("ck_roles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_roles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.RolePermission", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("PermissionId") .HasColumnType("uuid"); b.Property("RoleId") .HasColumnType("uuid"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("PermissionId"); b.HasIndex("RoleId"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "PermissionId"); b.HasIndex("TenantId", "RoleId", "PermissionId") .IsUnique(); b.ToTable("role_permissions", null, t => { t.HasCheckConstraint("ck_role_permissions_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_role_permissions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(0); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsActive") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("LockoutEndUtc") .HasColumnType("timestamp with time zone"); b.Property("MfaEnabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("SecurityStamp") .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.ToTable("users", null, t => { t.HasCheckConstraint("ck_users_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_users_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserExternalAccount", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("Email") .HasColumnType("text"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("LinkedAt") .HasColumnType("timestamp with time zone"); b.Property("Provider") .HasColumnType("integer"); b.Property("Subject") .IsRequired() .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserId"); b.HasIndex("TenantId", "Provider", "Subject") .IsUnique(); b.ToTable("user_external_accounts", null, t => { t.HasCheckConstraint("ck_user_external_accounts_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_external_accounts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserIdentity", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("Identifier") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IsPrimary") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.Property("VerifiedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Type", "Identifier") .IsUnique(); b.HasIndex("TenantId", "UserId", "Type", "IsPrimary") .HasDatabaseName("ix_user_identity_primary_per_type"); b.ToTable("user_identities", null, t => { t.HasCheckConstraint("ck_user_identities_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_identities_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserMfaFactor", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AddedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CredentialId") .HasColumnType("text"); b.Property("Email") .HasColumnType("text"); b.Property("Enabled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Label") .HasColumnType("text"); b.Property("LastUsedAt") .HasColumnType("timestamp with time zone"); b.Property("PhoneE164") .HasColumnType("text"); b.Property("PublicKey") .HasColumnType("text"); b.Property("Secret") .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserId"); b.ToTable("user_mfa_factors", null, t => { t.HasCheckConstraint("ck_user_mfa_factors_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_mfa_factors_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserPasswordHistory", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("ChangedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserId", "ChangedAt"); b.ToTable("user_password_histories", null, t => { t.HasCheckConstraint("ck_user_password_histories_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_password_histories_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserRole", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("RoleId") .HasColumnType("uuid"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("RoleId"); b.HasIndex("TenantId"); b.HasIndex("UserId"); b.HasIndex("TenantId", "RoleId"); b.HasIndex("TenantId", "UserId", "RoleId") .IsUnique(); b.ToTable("user_roles", null, t => { t.HasCheckConstraint("ck_user_roles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_roles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserSession", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("DeviceId") .HasColumnType("text"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("IpAddress") .HasColumnType("text"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IssuedAt") .HasColumnType("timestamp with time zone"); b.Property("RefreshTokenHash") .IsRequired() .HasColumnType("text"); b.Property("RevokedAt") .HasColumnType("timestamp with time zone"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserAgent") .HasColumnType("text"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "DeviceId"); b.HasIndex("TenantId", "UserId"); b.ToTable("user_sessions", null, t => { t.HasCheckConstraint("ck_user_sessions_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_sessions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.Address", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CountryCode") .IsRequired() .HasMaxLength(2) .HasColumnType("character varying(2)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("District") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("GeoLat") .HasColumnType("double precision"); b.Property("GeoLng") .HasColumnType("double precision"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Line1") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("Line2") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("PostalCode") .HasMaxLength(10) .HasColumnType("character varying(10)"); b.Property("Province") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Road") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Soi") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Subdistrict") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("Verified") .HasColumnType("boolean"); b.Property("Village") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.ToTable("addresses", null, t => { t.HasCheckConstraint("ck_addresses_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_addresses_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerAddress", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AddressId") .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CustomerProfileId") .HasColumnType("uuid"); b.Property("IsDefault") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Label") .HasColumnType("integer"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "AddressId"); b.HasIndex("TenantId", "CustomerProfileId", "Label"); b.HasIndex("TenantId", "CustomerProfileId", "Label", "IsDefault") .IsUnique() .HasDatabaseName("ux_default_customer_address_per_label") .HasFilter("\"IsDefault\" = TRUE"); b.ToTable("customer_addresses", null, t => { t.HasCheckConstraint("ck_customer_addresses_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_customer_addresses_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerContact", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CustomerProfileId") .HasColumnType("uuid"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IsPrimary") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("IsVerified") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("Value") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "CustomerProfileId", "Type"); b.HasIndex("TenantId", "CustomerProfileId", "Type", "IsPrimary") .IsUnique() .HasDatabaseName("ux_customer_contact_primary_per_type") .HasFilter("\"IsPrimary\" = TRUE"); b.ToTable("customer_contacts", null, t => { t.HasCheckConstraint("ck_customer_contacts_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_customer_contacts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("DisplayName") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Status") .HasColumnType("integer"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "DisplayName"); b.ToTable("customer_profiles", null, t => { t.HasCheckConstraint("ck_customer_profiles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_customer_profiles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerTag", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CustomerProfileId") .HasColumnType("uuid"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Tag") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "CustomerProfileId", "Tag") .IsUnique(); b.ToTable("customer_tags", null, t => { t.HasCheckConstraint("ck_customer_tags_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_customer_tags_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.OrganizationProfile", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("BranchCode") .HasMaxLength(5) .HasColumnType("character varying(5)"); b.Property("CompanyType") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CustomerProfileId") .HasColumnType("uuid"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("LegalNameEn") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("LegalNameTh") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("RegistrationNo") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("TaxId13") .HasMaxLength(13) .HasColumnType("character varying(13)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "CustomerProfileId") .IsUnique(); b.HasIndex("TenantId", "TaxId13", "BranchCode") .IsUnique() .HasFilter("\"TaxId13\" IS NOT NULL"); b.ToTable("organization_profiles", null, t => { t.HasCheckConstraint("ck_organization_profiles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_organization_profiles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.PersonProfile", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("BirthDate") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("CustomerProfileId") .HasColumnType("uuid"); b.Property("FirstNameEn") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("FirstNameTh") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("LastNameEn") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("LastNameTh") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("NationalId") .HasMaxLength(13) .HasColumnType("character varying(13)"); b.Property("PassportNo") .HasMaxLength(32) .HasColumnType("character varying(32)"); b.Property("Prefix") .HasMaxLength(32) .HasColumnType("character varying(32)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "CustomerProfileId") .IsUnique(); b.ToTable("person_profiles", null, t => { t.HasCheckConstraint("ck_person_profiles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_person_profiles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Code") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Name") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("ParentDepartmentId") .HasColumnType("uuid"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Code") .IsUnique(); b.HasIndex("TenantId", "ParentDepartmentId"); b.ToTable("departments", null, t => { t.HasCheckConstraint("ck_departments_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_departments_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmergencyContact", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("Email") .HasColumnType("text"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IsPrimary") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Phone") .HasColumnType("text"); b.Property("Relationship") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserProfileId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserProfileId", "IsPrimary"); b.ToTable("emergency_contacts", null, t => { t.HasCheckConstraint("ck_emergency_contacts_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_emergency_contacts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeAddress", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("City") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Country") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IsPrimary") .HasColumnType("boolean"); b.Property("Line1") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("Line2") .HasColumnType("text"); b.Property("PostalCode") .IsRequired() .HasMaxLength(32) .HasColumnType("character varying(32)"); b.Property("State") .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserProfileId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserProfileId", "IsPrimary"); b.ToTable("employee_addresses", null, t => { t.HasCheckConstraint("ck_employee_addresses_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_employee_addresses_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeBankAccount", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AccountHolder") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("AccountNumber") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("BankName") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Branch") .HasColumnType("text"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("IsPrimary") .HasColumnType("boolean"); b.Property("Note") .HasColumnType("text"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserProfileId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserProfileId", "IsPrimary"); b.ToTable("employee_bank_accounts", null, t => { t.HasCheckConstraint("ck_employee_bank_accounts_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_employee_bank_accounts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Employment", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("DepartmentId") .HasColumnType("uuid"); b.Property("EmploymentType") .HasColumnType("integer"); b.Property("EndDate") .HasColumnType("timestamp with time zone"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("ManagerUserId") .HasColumnType("uuid"); b.Property("PositionId") .HasColumnType("uuid"); b.Property("StartDate") .HasColumnType("timestamp with time zone"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserProfileId") .HasColumnType("uuid"); b.Property("WorkEmail") .HasColumnType("text"); b.Property("WorkPhone") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "DepartmentId"); b.HasIndex("TenantId", "PositionId"); b.HasIndex("TenantId", "UserProfileId", "StartDate"); b.ToTable("employments", null, t => { t.HasCheckConstraint("ck_employments_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_employments_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Position", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Code") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("Level") .HasColumnType("integer"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("Title") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "Code") .IsUnique(); b.ToTable("positions", null, t => { t.HasCheckConstraint("ck_positions_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_positions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("created_at") .HasDefaultValueSql("now() at time zone 'utc'"); b.Property("CreatedBy") .HasColumnType("text") .HasColumnName("created_by"); b.Property("DateOfBirth") .HasColumnType("timestamp with time zone"); b.Property("DepartmentId") .HasColumnType("uuid"); b.Property("FirstName") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Gender") .HasColumnType("integer"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("is_deleted"); b.Property("LastName") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("MiddleName") .HasColumnType("text"); b.Property("Nickname") .HasColumnType("text"); b.Property("PositionId") .HasColumnType("uuid"); b.Property("TenantId") .HasColumnType("uuid") .HasColumnName("tenant_id"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updated_at"); b.Property("UpdatedBy") .HasColumnType("text") .HasColumnName("updated_by"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("DepartmentId"); b.HasIndex("PositionId"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "UserId") .IsUnique(); b.ToTable("user_profiles", null, t => { t.HasCheckConstraint("ck_user_profiles_tenant_not_null", "tenant_id is not null"); t.HasCheckConstraint("ck_user_profiles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'"); }); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantConfig", b => { b.Property("TenantKey") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("ConnectionString") .HasColumnType("text"); b.Property("IsActive") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); b.Property("Mode") .HasColumnType("integer"); b.Property("Schema") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("TenantId") .HasColumnType("uuid"); b.Property("UpdatedAtUtc") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("updated_at_utc") .HasDefaultValueSql("now() at time zone 'utc'"); b.HasKey("TenantKey"); b.HasAlternateKey("TenantId"); b.HasIndex("IsActive"); b.HasIndex("TenantId") .IsUnique(); b.ToTable("tenants", "meta"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantDomain", b => { b.Property("Domain") .HasMaxLength(253) .HasColumnType("character varying(253)"); b.Property("IsActive") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); b.Property("IsPlatformBaseDomain") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("TenantKey") .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("UpdatedAtUtc") .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone") .HasColumnName("updated_at_utc") .HasDefaultValueSql("now() at time zone 'utc'"); b.HasKey("Domain"); b.HasIndex("IsActive"); b.HasIndex("IsPlatformBaseDomain"); b.HasIndex("TenantKey"); b.ToTable("tenant_domains", "meta"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.RolePermission", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Permission", "Permission") .WithMany("RolePermissions") .HasForeignKey("PermissionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", "Role") .WithMany("RolePermissions") .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Permission", null) .WithMany() .HasForeignKey("TenantId", "PermissionId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", null) .WithMany() .HasForeignKey("TenantId", "RoleId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Permission"); b.Navigation("Role"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserExternalAccount", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("ExternalAccounts") .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserIdentity", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("Identities") .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserMfaFactor", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("MfaFactors") .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserPasswordHistory", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("PasswordHistories") .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserRole", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", "Role") .WithMany("UserRoles") .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("UserRoles") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", null) .WithMany() .HasForeignKey("TenantId", "RoleId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", null) .WithMany() .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Role"); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserSession", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithMany("Sessions") .HasForeignKey("TenantId", "UserId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerAddress", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Customers.Address", "Address") .WithMany("CustomerLinks") .HasForeignKey("TenantId", "AddressId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "Customer") .WithMany("Addresses") .HasForeignKey("TenantId", "CustomerProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Address"); b.Navigation("Customer"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerContact", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "Customer") .WithMany("Contacts") .HasForeignKey("TenantId", "CustomerProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Customer"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerTag", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "Customer") .WithMany("Tags") .HasForeignKey("TenantId", "CustomerProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Customer"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.OrganizationProfile", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "Customer") .WithOne("Organization") .HasForeignKey("AMREZ.EOP.Domain.Entities.Customers.OrganizationProfile", "TenantId", "CustomerProfileId") .HasPrincipalKey("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Customer"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.PersonProfile", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "Customer") .WithOne("Person") .HasForeignKey("AMREZ.EOP.Domain.Entities.Customers.PersonProfile", "TenantId", "CustomerProfileId") .HasPrincipalKey("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", "TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Customer"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", "Parent") .WithMany("Children") .HasForeignKey("TenantId", "ParentDepartmentId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Restrict); b.Navigation("Parent"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmergencyContact", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile") .WithMany("EmergencyContacts") .HasForeignKey("TenantId", "UserProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("UserProfile"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeAddress", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile") .WithMany("Addresses") .HasForeignKey("TenantId", "UserProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("UserProfile"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeBankAccount", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile") .WithMany("BankAccounts") .HasForeignKey("TenantId", "UserProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("UserProfile"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Employment", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", "Department") .WithMany() .HasForeignKey("TenantId", "DepartmentId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Restrict); b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Position", "Position") .WithMany() .HasForeignKey("TenantId", "PositionId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Restrict); b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile") .WithMany("Employments") .HasForeignKey("TenantId", "UserProfileId") .HasPrincipalKey("TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Department"); b.Navigation("Position"); b.Navigation("UserProfile"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b => { b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", null) .WithMany("Profiles") .HasForeignKey("DepartmentId"); b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Position", null) .WithMany("Profiles") .HasForeignKey("PositionId"); b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User") .WithOne() .HasForeignKey("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "TenantId", "UserId") .HasPrincipalKey("AMREZ.EOP.Domain.Entities.Authentications.User", "TenantId", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantDomain", b => { b.HasOne("AMREZ.EOP.Domain.Entities.Tenancy.TenantConfig", null) .WithMany() .HasForeignKey("TenantKey") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Permission", b => { b.Navigation("RolePermissions"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Role", b => { b.Navigation("RolePermissions"); b.Navigation("UserRoles"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.User", b => { b.Navigation("ExternalAccounts"); b.Navigation("Identities"); b.Navigation("MfaFactors"); b.Navigation("PasswordHistories"); b.Navigation("Sessions"); b.Navigation("UserRoles"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.Address", b => { b.Navigation("CustomerLinks"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Customers.CustomerProfile", b => { b.Navigation("Addresses"); b.Navigation("Contacts"); b.Navigation("Organization"); b.Navigation("Person"); b.Navigation("Tags"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b => { b.Navigation("Children"); b.Navigation("Profiles"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Position", b => { b.Navigation("Profiles"); }); modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b => { b.Navigation("Addresses"); b.Navigation("BankAccounts"); b.Navigation("EmergencyContacts"); b.Navigation("Employments"); }); #pragma warning restore 612, 618 } } }