From 886f84cfabefcf06bab00724d572c42e3b07b36b Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Fri, 16 Jul 2021 14:51:19 +0300 Subject: [PATCH 01/70] fix: resolve version mismatch --- src/EventHub.Admin.Web/EventHub.Admin.Web.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EventHub.Admin.Web/EventHub.Admin.Web.csproj b/src/EventHub.Admin.Web/EventHub.Admin.Web.csproj index 51d7080..aaa7547 100644 --- a/src/EventHub.Admin.Web/EventHub.Admin.Web.csproj +++ b/src/EventHub.Admin.Web/EventHub.Admin.Web.csproj @@ -11,8 +11,8 @@ - - + + From fa03c0ccc9607f83378a048ec4d6960bbf907ef4 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 27 Jul 2021 17:16:32 +0300 Subject: [PATCH 02/70] Add MemberCount to Organization --- .../Organizations/Organization.cs | 2 + ...ed_MemberCount_To_Organization.Designer.cs | 2628 +++++++++++++++++ ...70707_Added_MemberCount_To_Organization.cs | 24 + .../EventHubDbContextModelSnapshot.cs | 5 +- 4 files changed, 2658 insertions(+), 1 deletion(-) create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.Designer.cs create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.cs diff --git a/src/EventHub.Domain/Organizations/Organization.cs b/src/EventHub.Domain/Organizations/Organization.cs index 88db74b..557f988 100644 --- a/src/EventHub.Domain/Organizations/Organization.cs +++ b/src/EventHub.Domain/Organizations/Organization.cs @@ -26,6 +26,8 @@ namespace EventHub.Organizations public string MediumUsername { get; set; } + public int MemberCount { get; internal set; } + private Organization() { } diff --git a/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.Designer.cs b/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.Designer.cs new file mode 100644 index 0000000..183e466 --- /dev/null +++ b/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.Designer.cs @@ -0,0 +1,2628 @@ +// +using System; +using EventHub.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Volo.Abp.EntityFrameworkCore; + +namespace EventHub.Migrations +{ + [DbContext(typeof(EventHubDbContext))] + [Migration("20210727070707_Added_MemberCount_To_Organization")] + partial class Added_MemberCount_To_Organization + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.8") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("EventHub.Countries.Country", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("EhCountries"); + }); + + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Capacity") + .HasColumnType("integer"); + + b.Property("City") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CountryId") + .HasColumnType("uuid"); + + b.Property("CountryName") + .HasColumnType("text"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("EndTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEmailSentToMembers") + .HasColumnType("boolean"); + + b.Property("IsOnline") + .HasColumnType("boolean"); + + b.Property("IsRemindingEmailSent") + .HasColumnType("boolean"); + + b.Property("IsTimingChangeEmailSent") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("Language") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("OnlineLink") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("StartTime") + .HasColumnType("timestamp without time zone"); + + b.Property("TimingChangeCount") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(69) + .HasColumnType("character varying(69)"); + + b.Property("UrlCode") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("character varying(8)"); + + b.HasKey("Id"); + + b.HasIndex("CountryId"); + + b.HasIndex("IsEmailSentToMembers"); + + b.HasIndex("StartTime"); + + b.HasIndex("UrlCode"); + + b.HasIndex("IsRemindingEmailSent", "StartTime"); + + b.HasIndex("OrganizationId", "StartTime"); + + b.ToTable("EhEvents"); + }); + + modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("EventId") + .HasColumnType("uuid"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("EventId", "UserId"); + + b.ToTable("EhEventRegistrations"); + }); + + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("OrganizationId", "UserId"); + + b.ToTable("EhOrganizationMemberships"); + }); + + modelBuilder.Entity("EventHub.Organizations.Organization", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("FacebookUsername") + .HasColumnType("text"); + + b.Property("GitHubUsername") + .HasColumnType("text"); + + b.Property("InstagramUsername") + .HasColumnType("text"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("MediumUsername") + .HasColumnType("text"); + + b.Property("MemberCount") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("OwnerUserId") + .HasColumnType("uuid"); + + b.Property("TwitterUsername") + .HasColumnType("text"); + + b.Property("Website") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DisplayName"); + + b.HasIndex("Name"); + + b.HasIndex("OwnerUserId"); + + b.ToTable("EhOrganizations"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("text"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("integer") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("text"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("smallint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uuid"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("EntityChangeId") + .HasColumnType("uuid"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("character varying(1048576)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("NextTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uuid"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("bytea"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ValueType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("SourceTenantId") + .HasColumnType("uuid"); + + b.Property("SourceUserId") + .HasColumnType("uuid"); + + b.Property("TargetTenantId") + .HasColumnType("uuid"); + + b.Property("TargetUserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique(); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("boolean") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("boolean") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("boolean") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("character varying(196)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("character varying(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Emphasize") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.Property("ApiScopeId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ApiScopeId", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.Property("ApiScopeId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ApiScopeId", "Key", "Value"); + + b.ToTable("IdentityServerApiScopeProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("integer"); + + b.Property("AccessTokenLifetime") + .HasColumnType("integer"); + + b.Property("AccessTokenType") + .HasColumnType("integer"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("boolean"); + + b.Property("AllowOfflineAccess") + .HasColumnType("boolean"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("boolean"); + + b.Property("AllowRememberConsent") + .HasColumnType("boolean"); + + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("boolean"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("boolean"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("integer"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("boolean"); + + b.Property("BackChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("ClientClaimsPrefix") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentLifetime") + .HasColumnType("integer"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DeviceCodeLifetime") + .HasColumnType("integer"); + + b.Property("EnableLocalLogin") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("boolean"); + + b.Property("FrontChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("IdentityTokenLifetime") + .HasColumnType("integer"); + + b.Property("IncludeJwtId") + .HasColumnType("boolean"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("PairWiseSubjectSalt") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("RefreshTokenExpiration") + .HasColumnType("integer"); + + b.Property("RefreshTokenUsage") + .HasColumnType("integer"); + + b.Property("RequireClientSecret") + .HasColumnType("boolean"); + + b.Property("RequireConsent") + .HasColumnType("boolean"); + + b.Property("RequirePkce") + .HasColumnType("boolean"); + + b.Property("RequireRequestObject") + .HasColumnType("boolean"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("integer"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("boolean"); + + b.Property("UserCodeType") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("UserSsoLifetime") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Origin") + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("GrantType") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Provider") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("PostLogoutRedirectUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "Key", "Value"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("RedirectUri") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode"); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsumedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.HasIndex("SubjectId", "SessionId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Emphasize") + .HasColumnType("boolean"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uuid"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("EventHub.Events.Event", b => + { + b.HasOne("EventHub.Countries.Country", null) + .WithMany() + .HasForeignKey("CountryId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("EventHub.Organizations.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => + { + b.HasOne("EventHub.Events.Event", null) + .WithMany() + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => + { + b.HasOne("EventHub.Organizations.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("EventHub.Organizations.Organization", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("OwnerUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.cs b/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.cs new file mode 100644 index 0000000..d926cb7 --- /dev/null +++ b/src/EventHub.EntityFrameworkCore/Migrations/20210727070707_Added_MemberCount_To_Organization.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EventHub.Migrations +{ + public partial class Added_MemberCount_To_Organization : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "MemberCount", + table: "EhOrganizations", + type: "integer", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "MemberCount", + table: "EhOrganizations"); + } + } +} diff --git a/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs b/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs index c1e1de6..9e891c7 100644 --- a/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs +++ b/src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace EventHub.Migrations modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.7") + .HasAnnotation("ProductVersion", "5.0.8") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("EventHub.Countries.Country", b => @@ -310,6 +310,9 @@ namespace EventHub.Migrations b.Property("MediumUsername") .HasColumnType("text"); + b.Property("MemberCount") + .HasColumnType("integer"); + b.Property("Name") .IsRequired() .HasMaxLength(32) From 891e62cc44141a36e854dd5e10ad51327f07b485 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 27 Jul 2021 17:16:51 +0300 Subject: [PATCH 03/70] Create OrganizationMembershipChangedEventHandler --- ...ganizationMembershipChangedEventHandler.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipChangedEventHandler.cs diff --git a/src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipChangedEventHandler.cs b/src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipChangedEventHandler.cs new file mode 100644 index 0000000..4625fd1 --- /dev/null +++ b/src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipChangedEventHandler.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading.Tasks; +using EventHub.Organizations; +using EventHub.Organizations.Memberships; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.EventBus; + +namespace EventHub.Domain.Organizations.Memberships +{ + public class OrganizationMembershipChangedEventHandler : ILocalEventHandler>, + ILocalEventHandler>, ITransientDependency + { + private readonly IRepository _organizationRepository; + + public OrganizationMembershipChangedEventHandler(IRepository organizationRepository) + { + _organizationRepository = organizationRepository; + } + + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var organization = await _organizationRepository.GetAsync(eventData.Entity.OrganizationId); + + organization.MemberCount++; + + await _organizationRepository.UpdateAsync(organization); + } + + public async Task HandleEventAsync(EntityDeletedEventData eventData) + { + var organization = await _organizationRepository.GetAsync(eventData.Entity.OrganizationId); + + organization.MemberCount--; + + await _organizationRepository.UpdateAsync(organization); + } + } +} From a66596387cce4f5c739dda37931ff5f06abc64a3 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 27 Jul 2021 17:20:46 +0300 Subject: [PATCH 04/70] Feature(Admin-Backend): Create necessary backend for organization admin ui --- .../Organizations/IOrganizationAppService.cs | 19 +++ .../Organizations/OrganizationInListDto.cs | 14 ++ .../OrganizationListFilterDto.cs | 16 ++ .../Organizations/OrganizationProfileDto.cs | 32 ++++ .../Organizations/UpdateOrganizationDto.cs | 45 ++++++ .../EventHubPermissionDefinitionProvider.cs | 8 +- .../Permissions/EventHubPermissions.cs | 9 +- .../EventHubAdminAppService.cs | 13 ++ .../EventHubAdminApplicationModule.cs | 11 +- .../EventHubApplicationAutoMapperProfile.cs | 20 +++ .../Organizations/OrganizationAppService.cs | 138 ++++++++++++++++++ .../Controllers/OrganizationController.cs | 50 +++++++ .../EventHubBlazorAutoMapperProfile.cs | 3 +- .../Organizations/OrganizationContst.cs | 3 +- 14 files changed, 373 insertions(+), 8 deletions(-) create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs create mode 100644 src/EventHub.Admin.Application/EventHubAdminAppService.cs create mode 100644 src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs create mode 100644 src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs create mode 100644 src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs new file mode 100644 index 0000000..e2ac1ce --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs @@ -0,0 +1,19 @@ +using System; +using System.Threading.Tasks; +using EventHub.Admin.Application.Contracts.Organizations; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace EventHub.Admin.Organizations +{ + public interface IOrganizationAppService : IApplicationService + { + Task> GetListAsync(OrganizationListFilterDto input); + + Task GetAsync(Guid id); + + Task UpdateAsync(Guid id, UpdateOrganizationDto input); + + Task DeleteAsync(Guid id); + } +} diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs new file mode 100644 index 0000000..796ed3d --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Organizations +{ + public class OrganizationInListDto : EntityDto + { + public string Name { get; set; } + + public string DisplayName { get; set; } + + public int MemberCount { get; set; } + } +} diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs new file mode 100644 index 0000000..d9acaf1 --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Application.Contracts.Organizations +{ + public class OrganizationListFilterDto : PagedAndSortedResultRequestDto + { + public string? Name { get; set; } + + public string? DisplayName { get; set; } + + public int? MinMemberCount { get; set; } + + public int? MaxMemberCount { get; set; } + } +} diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs new file mode 100644 index 0000000..86b469c --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs @@ -0,0 +1,32 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Organizations +{ + public class OrganizationProfileDto : EntityDto + { + public string Name { get; set; } + + public string DisplayName { get; set; } + + public byte[] ProfilePictureContent { get; set; } + + public string OwnerUserName { get; set; } + + public string OwnerEmail { get; set; } + + public string Description { get; set; } + + public string Website { get; set; } + + public string TwitterUsername { get; set; } + + public string GitHubUsername { get; set; } + + public string FacebookUsername { get; set; } + + public string InstagramUsername { get; set; } + + public string MediumUsername { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs new file mode 100644 index 0000000..fcc0ce9 --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs @@ -0,0 +1,45 @@ +using System; +using System.ComponentModel.DataAnnotations; +using EventHub.Organizations; +using JetBrains.Annotations; + +namespace EventHub.Admin.Organizations +{ + public class UpdateOrganizationDto + { + [Required] + [StringLength(OrganizationConsts.MaxDisplayNameLength, MinimumLength = OrganizationConsts.MinDisplayNameLength)] + public string DisplayName { get; set; } + + [Required] + [StringLength(OrganizationConsts.MaxDescriptionNameLength, MinimumLength = OrganizationConsts.MinDescriptionNameLength)] + public string Description { get; set; } + + [CanBeNull] + public byte[] ProfilePictureContent { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxWebsiteLength)] + public string Website { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxTwitterUsernameLength)] + public string TwitterUsername { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxGitHubUsernameLength)] + public string GitHubUsername { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxFacebookUsernameLength)] + public string FacebookUsername { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxInstagramUsernameLength)] + public string InstagramUsername { get; set; } + + [CanBeNull] + [StringLength(OrganizationConsts.MaxMediumUsernameLength)] + public string MediumUsername { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs index e0f7571..469f16e 100644 --- a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs +++ b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs @@ -8,10 +8,12 @@ namespace EventHub.Admin.Permissions { public override void Define(IPermissionDefinitionContext context) { - var myGroup = context.AddGroup(EventHubPermissions.GroupName); + var eventHubGroup = context.AddGroup(EventHubPermissions.GroupName); - //Define your own permissions here. Example: - //myGroup.AddPermission(EventHubPermissions.MyPermission1, L("Permission:MyPermission1")); + var tenantsPermission = eventHubGroup.AddPermission(EventHubPermissions.Organizations.Default, L("Permission:OrganizationManagement")); + tenantsPermission.AddChild(EventHubPermissions.Organizations.Create, L("Permission:Create")); + tenantsPermission.AddChild(EventHubPermissions.Organizations.Update, L("Permission:Edit")); + tenantsPermission.AddChild(EventHubPermissions.Organizations.Delete, L("Permission:Delete")); } private static LocalizableString L(string name) diff --git a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs index b7fbe16..ecae825 100644 --- a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs +++ b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs @@ -4,7 +4,12 @@ { public const string GroupName = "EventHub"; - //Add your own permission names. Example: - //public const string MyPermission1 = GroupName + ".MyPermission1"; + public static class Organizations + { + public const string Default = GroupName + ".Organizations"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } } } \ No newline at end of file diff --git a/src/EventHub.Admin.Application/EventHubAdminAppService.cs b/src/EventHub.Admin.Application/EventHubAdminAppService.cs new file mode 100644 index 0000000..3ef4f1b --- /dev/null +++ b/src/EventHub.Admin.Application/EventHubAdminAppService.cs @@ -0,0 +1,13 @@ +using EventHub.Localization; +using Volo.Abp.Application.Services; + +namespace EventHub.Admin.Application +{ + public class EventHubAdminAppService : ApplicationService + { + public EventHubAdminAppService() + { + LocalizationResource = typeof(EventHubResource); + } + } +} diff --git a/src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs b/src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs index b046665..64fc7dc 100644 --- a/src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs +++ b/src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs @@ -1,4 +1,5 @@ using Volo.Abp.Account; +using Volo.Abp.AutoMapper; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; @@ -10,9 +11,17 @@ namespace EventHub.Admin typeof(AbpAccountApplicationModule), typeof(EventHubAdminApplicationContractsModule), typeof(AbpIdentityApplicationModule), - typeof(AbpPermissionManagementApplicationModule) + typeof(AbpPermissionManagementApplicationModule), + typeof(AbpAutoMapperModule) )] public class EventHubAdminApplicationModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.AddProfile(validate: true); + }); + } } } \ No newline at end of file diff --git a/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs new file mode 100644 index 0000000..6b20518 --- /dev/null +++ b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs @@ -0,0 +1,20 @@ +using AutoMapper; +using EventHub.Admin.Organizations; +using EventHub.Organizations; +using Volo.Abp.AutoMapper; + +namespace EventHub.Admin +{ + public class EventHubAdminApplicationAutoMapperProfile : Profile + { + public EventHubAdminApplicationAutoMapperProfile() + { + CreateMap(); + + CreateMap() + .Ignore(x => x.OwnerUserName) + .Ignore(x => x.OwnerEmail) + .Ignore(x => x.ProfilePictureContent); + } + } +} diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs new file mode 100644 index 0000000..fc164c1 --- /dev/null +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading.Tasks; +using EventHub.Admin.Application; +using EventHub.Admin.Application.Contracts.Organizations; +using EventHub.Admin.Permissions; +using EventHub.Organizations; +using EventHub.Organizations.Memberships; +using EventHub.Users; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; +using Volo.Abp.BlobStoring; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.Identity.Settings; + +namespace EventHub.Admin.Organizations +{ + [Authorize(EventHubPermissions.Organizations.Default)] + public class OrganizationAppService : EventHubAdminAppService, IOrganizationAppService + { + private readonly IRepository _organizationRepository; + private readonly IRepository _identityUserRepository; + private readonly IBlobContainer _organizationBlobContainer; + + public OrganizationAppService( + IRepository organizationRepository, + IRepository identityUserRepository, + IBlobContainer organizationBlobContainer) + { + _organizationRepository = organizationRepository; + _identityUserRepository = identityUserRepository; + _organizationBlobContainer = organizationBlobContainer; + } + + public async Task> GetListAsync(OrganizationListFilterDto input) + { + var query = await _organizationRepository.GetQueryableAsync(); + + if (!input.Name.IsNullOrWhiteSpace()) + { + query = query.Where(o => o.Name.Contains(input.Name)); + } + + if (!input.DisplayName.IsNullOrWhiteSpace()) + { + query = query.Where(o => o.DisplayName.Contains(input.DisplayName)); + } + + if (!input.DisplayName.IsNullOrWhiteSpace()) + { + query = query.Where(o => o.DisplayName.Contains(input.DisplayName)); + } + + if (input.MinMemberCount != null) + { + query = query.Where(o => o.MemberCount >= input.MinMemberCount); + } + + if (input.MaxMemberCount != null) + { + query = query.Where(o => o.MemberCount <= input.MaxMemberCount); + } + + var totalCount = await AsyncExecuter.CountAsync(query); + + query = query.OrderBy(string.IsNullOrWhiteSpace(input.Sorting) ? OrganizationConsts.DefaultSorting : input.Sorting); + + query = query.PageBy(input); + + var organizationListDto = ObjectMapper + .Map, List>(await AsyncExecuter.ToListAsync(query)); + + return new PagedResultDto(totalCount, organizationListDto); + } + + public async Task GetAsync(Guid id) + { + var organization = await _organizationRepository.GetAsync(id); + + var dto = ObjectMapper.Map(organization); + + var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); + dto.OwnerUserName = user.UserName; + dto.OwnerEmail = user.Email; + + dto.ProfilePictureContent = await GetCoverImageAsync(id); + + return dto; + } + + public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) + { + var organization = await _organizationRepository.GetAsync(id); + + organization.SetDisplayName(input.DisplayName); + organization.SetDescription(input.Description); + + organization.Website = input.Website; + organization.TwitterUsername = input.TwitterUsername; + organization.GitHubUsername = input.GitHubUsername; + organization.FacebookUsername = input.FacebookUsername; + organization.InstagramUsername = input.InstagramUsername; + organization.MediumUsername = input.MediumUsername; + + if (input.ProfilePictureContent?.Length > 0) + { + await SaveCoverImageAsync(organization.Id, input.ProfilePictureContent); + } + + await _organizationRepository.UpdateAsync(organization); + + return ObjectMapper.Map(organization); + } + + [Authorize(EventHubPermissions.Organizations.Delete)] + public async Task DeleteAsync(Guid id) + { + await _organizationRepository.DeleteAsync(id); + } + + private async Task GetCoverImageAsync(Guid id) + { + var blobName = id.ToString(); + + return await _organizationBlobContainer.GetAllBytesOrNullAsync(blobName); + } + + private async Task SaveCoverImageAsync(Guid id, byte[] coverImageContent) + { + var blobName = id.ToString(); + + await _organizationBlobContainer.SaveAsync(blobName, coverImageContent, overrideExisting: true); + } + } +} diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs new file mode 100644 index 0000000..93984b7 --- /dev/null +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading.Tasks; +using EventHub.Admin.Application.Contracts.Organizations; +using EventHub.Admin.Organizations; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Admin.Controllers +{ + [Controller] + [Area("eventhub-admin")] + [ControllerName("Organization")] + [Route("/api/eventhub/organizations")] + public class OrganizationController : AbpController, IOrganizationAppService + { + private readonly IOrganizationAppService _organizationAppService; + + public OrganizationController(IOrganizationAppService organizationAppService) + { + _organizationAppService = organizationAppService; + } + + [HttpGet] + public Task> GetListAsync(OrganizationListFilterDto input) + { + return _organizationAppService.GetListAsync(input); + } + + [HttpGet] + [Route("{id}")] + public Task GetAsync(Guid id) + { + return _organizationAppService.GetAsync(id); + } + + [HttpPut] + public Task UpdateAsync(Guid id, UpdateOrganizationDto input) + { + return _organizationAppService.UpdateAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public Task DeleteAsync(Guid id) + { + return _organizationAppService.DeleteAsync(id); + } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs b/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs index 3cdc492..c0b5d01 100644 --- a/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs +++ b/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using EventHub.Admin.Organizations; namespace EventHub.Admin.Web { @@ -6,7 +7,7 @@ namespace EventHub.Admin.Web { public EventHubBlazorAutoMapperProfile() { - //Define your AutoMapper configuration here for the Blazor project. + CreateMap(); } } } diff --git a/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs b/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs index 7b9fedc..712dcf6 100644 --- a/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs +++ b/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs @@ -2,6 +2,8 @@ { public static class OrganizationConsts { + public const string DefaultSorting = "CreationTime desc"; + public const int MinNameLength = 2; public const int MaxNameLength = 32; @@ -24,6 +26,5 @@ public const int MaxInstagramUsernameLength = 24; public const int MaxMediumUsernameLength = 24; - } } From 7d3425c977a19d8cbdbb4344b68c24f78875647a Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Wed, 28 Jul 2021 18:24:00 +0300 Subject: [PATCH 05/70] Feat(Admin): Manage organizations --- .../Organizations/IOrganizationAppService.cs | 1 - .../IOrganizationMembershipAppService.cs | 11 + .../Memberships/OrganizationMemberDto.cs | 16 ++ .../OrganizationMemberListFilterDto.cs | 12 + .../OrganizationListFilterDto.cs | 7 +- .../Organizations/UpdateOrganizationDto.cs | 1 - .../EventHubPermissionDefinitionProvider.cs | 9 +- .../Permissions/EventHubPermissions.cs | 5 + .../EventHubAdminAppService.cs | 4 +- .../EventHubApplicationAutoMapperProfile.cs | 4 + .../OrganizationMembershipAppService.cs | 52 ++++ .../Organizations/OrganizationAppService.cs | 19 +- .../OrganizationMembershipController.cs | 28 ++ .../OrganizationController.cs | 3 +- .../Menus/EventHubMenuContributor.cs | 20 +- src/EventHub.Admin.Web/Menus/EventHubMenus.cs | 8 +- .../Pages/OrganizationManagement.razor | 255 ++++++++++++++++++ .../Pages/OrganizationManagement.razor.cs | 162 +++++++++++ .../OrganizationMembershipManagement.razor | 63 +++++ .../OrganizationMembershipManagement.razor.cs | 76 ++++++ .../OrganizationMembershipAppService.cs | 1 - .../IOrganizationMembershipRepository.cs | 24 ++ .../OrganizationMembershipRepository.cs | 64 +++++ 23 files changed, 812 insertions(+), 33 deletions(-) create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs create mode 100644 src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs create mode 100644 src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs create mode 100644 src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs rename src/EventHub.Admin.HttpApi.Host/Controllers/{ => Organizations}/OrganizationController.cs (93%) create mode 100644 src/EventHub.Admin.Web/Pages/OrganizationManagement.razor create mode 100644 src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs create mode 100644 src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor create mode 100644 src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs create mode 100644 src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs create mode 100644 src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs index e2ac1ce..0a1a715 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using EventHub.Admin.Application.Contracts.Organizations; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs new file mode 100644 index 0000000..b471473 --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace EventHub.Admin.Organizations.Memberships +{ + public interface IOrganizationMembershipAppService : IApplicationService + { + Task> GetListAsync(OrganizationMemberListFilterDto input); + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs new file mode 100644 index 0000000..f356ca1 --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Organizations.Memberships +{ + public class OrganizationMemberDto : EntityDto + { + public string UserName { get; set; } + + public string Email { get; set; } + + public string Name { get; set; } + + public string Surname { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs new file mode 100644 index 0000000..8c6cce2 --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Organizations.Memberships +{ + public class OrganizationMemberListFilterDto : PagedResultRequestDto + { + public Guid? OrganizationId { get; set; } + + public string UserName { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs index d9acaf1..43c2a65 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs @@ -1,13 +1,12 @@ -using System; using Volo.Abp.Application.Dtos; -namespace EventHub.Admin.Application.Contracts.Organizations +namespace EventHub.Admin.Organizations { public class OrganizationListFilterDto : PagedAndSortedResultRequestDto { - public string? Name { get; set; } + public string Name { get; set; } - public string? DisplayName { get; set; } + public string DisplayName { get; set; } public int? MinMemberCount { get; set; } diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs index fcc0ce9..c90c59b 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs @@ -1,4 +1,3 @@ -using System; using System.ComponentModel.DataAnnotations; using EventHub.Organizations; using JetBrains.Annotations; diff --git a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs index 469f16e..b9790b9 100644 --- a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs +++ b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs @@ -10,10 +10,11 @@ namespace EventHub.Admin.Permissions { var eventHubGroup = context.AddGroup(EventHubPermissions.GroupName); - var tenantsPermission = eventHubGroup.AddPermission(EventHubPermissions.Organizations.Default, L("Permission:OrganizationManagement")); - tenantsPermission.AddChild(EventHubPermissions.Organizations.Create, L("Permission:Create")); - tenantsPermission.AddChild(EventHubPermissions.Organizations.Update, L("Permission:Edit")); - tenantsPermission.AddChild(EventHubPermissions.Organizations.Delete, L("Permission:Delete")); + var organizationsPermission = eventHubGroup.AddPermission(EventHubPermissions.Organizations.Default, L("Permission:OrganizationManagement")); + organizationsPermission.AddChild(EventHubPermissions.Organizations.Create, L("Permission:Create")); + organizationsPermission.AddChild(EventHubPermissions.Organizations.Update, L("Permission:Edit")); + organizationsPermission.AddChild(EventHubPermissions.Organizations.Delete, L("Permission:Delete")); + organizationsPermission.AddChild(EventHubPermissions.Organizations.Memberships.Default, L("Permission:MembershipManagement")); } private static LocalizableString L(string name) diff --git a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs index ecae825..a1003bc 100644 --- a/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs +++ b/src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs @@ -10,6 +10,11 @@ public const string Create = Default + ".Create"; public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; + + public static class Memberships + { + public const string Default = Organizations.Default + ".Memberships"; + } } } } \ No newline at end of file diff --git a/src/EventHub.Admin.Application/EventHubAdminAppService.cs b/src/EventHub.Admin.Application/EventHubAdminAppService.cs index 3ef4f1b..5fd1056 100644 --- a/src/EventHub.Admin.Application/EventHubAdminAppService.cs +++ b/src/EventHub.Admin.Application/EventHubAdminAppService.cs @@ -1,11 +1,11 @@ using EventHub.Localization; using Volo.Abp.Application.Services; -namespace EventHub.Admin.Application +namespace EventHub.Admin { public class EventHubAdminAppService : ApplicationService { - public EventHubAdminAppService() + protected EventHubAdminAppService() { LocalizationResource = typeof(EventHubResource); } diff --git a/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs index 6b20518..6d40c34 100644 --- a/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs +++ b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs @@ -1,7 +1,9 @@ using AutoMapper; using EventHub.Admin.Organizations; +using EventHub.Admin.Organizations.Memberships; using EventHub.Organizations; using Volo.Abp.AutoMapper; +using Volo.Abp.Identity; namespace EventHub.Admin { @@ -15,6 +17,8 @@ namespace EventHub.Admin .Ignore(x => x.OwnerUserName) .Ignore(x => x.OwnerEmail) .Ignore(x => x.ProfilePictureContent); + + CreateMap(); } } } diff --git a/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs new file mode 100644 index 0000000..6dbbb00 --- /dev/null +++ b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using EventHub.Admin.Permissions; +using EventHub.Organizations.Memberships; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; + + +namespace EventHub.Admin.Organizations.Memberships +{ + [Authorize(EventHubPermissions.Organizations.Memberships.Default)] + public class OrganizationMembershipAppService : ApplicationService, IOrganizationMembershipAppService + { + private readonly IOrganizationMembershipRepository _organizationMembershipRepository; + private readonly IRepository _userRepository; + + public OrganizationMembershipAppService( + IOrganizationMembershipRepository organizationMembershipRepository, + IRepository userRepository) + { + _organizationMembershipRepository = organizationMembershipRepository; + _userRepository = userRepository; + } + + public async Task> GetListAsync(OrganizationMemberListFilterDto input) + { + IdentityUser user = null; + if (!input.UserName.IsNullOrWhiteSpace()) + { + input.UserName = input.UserName.ToLower(); + user = await _userRepository.SingleOrDefaultAsync(x => x.UserName.ToLower().Contains(input.UserName)); + if (user is null) + { + throw new EntityNotFoundException(typeof(IdentityUser), input.UserName); + } + } + + var members = await _organizationMembershipRepository.GetMemberListAsync(input.OrganizationId, user?.Id, input.SkipCount, input.MaxResultCount); + var totalCount = await _organizationMembershipRepository.GetCountAsync(input.OrganizationId, user?.Id); + + return new PagedResultDto( + totalCount, + ObjectMapper.Map, List>(members) + ); + } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs index fc164c1..79c3c5c 100644 --- a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -3,18 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; using System.Threading.Tasks; -using EventHub.Admin.Application; -using EventHub.Admin.Application.Contracts.Organizations; using EventHub.Admin.Permissions; using EventHub.Organizations; -using EventHub.Organizations.Memberships; -using EventHub.Users; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.BlobStoring; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; -using Volo.Abp.Identity.Settings; namespace EventHub.Admin.Organizations { @@ -41,17 +36,14 @@ namespace EventHub.Admin.Organizations if (!input.Name.IsNullOrWhiteSpace()) { - query = query.Where(o => o.Name.Contains(input.Name)); + input.Name = input.Name.ToLower(); + query = query.Where(o => o.Name.ToLower().Contains(input.Name)); } if (!input.DisplayName.IsNullOrWhiteSpace()) { - query = query.Where(o => o.DisplayName.Contains(input.DisplayName)); - } - - if (!input.DisplayName.IsNullOrWhiteSpace()) - { - query = query.Where(o => o.DisplayName.Contains(input.DisplayName)); + input.DisplayName = input.DisplayName.ToLower(); + query = query.Where(o => o.DisplayName.ToLower().Contains(input.DisplayName)); } if (input.MinMemberCount != null) @@ -86,11 +78,12 @@ namespace EventHub.Admin.Organizations dto.OwnerUserName = user.UserName; dto.OwnerEmail = user.Email; - dto.ProfilePictureContent = await GetCoverImageAsync(id); + dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); return dto; } + [Authorize(EventHubPermissions.Organizations.Update)] public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) { var organization = await _organizationRepository.GetAsync(id); diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs new file mode 100644 index 0000000..0dbc4cb --- /dev/null +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs @@ -0,0 +1,28 @@ +using System.Threading.Tasks; +using EventHub.Admin.Organizations.Memberships; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Admin.Controllers.Organizations.Memberships +{ + [Controller] + [Area("eventhub-admin")] + [ControllerName("OrganizationMembership")] + [Route("/api/eventhub/organization-memberships")] + public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService + { + private readonly IOrganizationMembershipAppService _organizationMembershipAppService; + + public OrganizationMembershipController(IOrganizationMembershipAppService organizationMembershipAppService) + { + _organizationMembershipAppService = organizationMembershipAppService; + } + + [HttpGet] + public async Task> GetListAsync(OrganizationMemberListFilterDto input) + { + return await _organizationMembershipAppService.GetListAsync(input); + } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs similarity index 93% rename from src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs rename to src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs index 93984b7..9774488 100644 --- a/src/EventHub.Admin.HttpApi.Host/Controllers/OrganizationController.cs +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs @@ -1,12 +1,11 @@ using System; using System.Threading.Tasks; -using EventHub.Admin.Application.Contracts.Organizations; using EventHub.Admin.Organizations; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc; -namespace EventHub.Admin.Controllers +namespace EventHub.Admin.Controllers.Organizations { [Controller] [Area("eventhub-admin")] diff --git a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs index 90fd929..9e5e401 100644 --- a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs +++ b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs @@ -1,9 +1,12 @@ using System; using System.Threading.Tasks; +using EventHub.Admin.Permissions; using EventHub.Localization; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; using Volo.Abp.Account.Localization; +using Volo.Abp.Authorization.Permissions; using Volo.Abp.UI.Navigation; using Volo.Abp.Users; @@ -30,7 +33,7 @@ namespace EventHub.Admin.Web.Menus } } - private Task ConfigureMainMenuAsync(MenuConfigurationContext context) + private async Task ConfigureMainMenuAsync(MenuConfigurationContext context) { var l = context.GetLocalizer(); @@ -43,8 +46,8 @@ namespace EventHub.Admin.Web.Menus icon: "fas fa-home" ) ); - - return Task.CompletedTask; + + await AddOrganizationMenu(context, l); } private Task ConfigureUserMenuAsync(MenuConfigurationContext context) @@ -67,5 +70,16 @@ namespace EventHub.Admin.Web.Menus return Task.CompletedTask; } + + private Task AddOrganizationMenu(MenuConfigurationContext context, IStringLocalizer l) + { + var organizationMenu = new ApplicationMenuItem(EventHubMenus.OrganizationManagement.GroupName, l["Menu:OrganizationManagement"], icon: "fa fa-sitemap"); + context.Menu.Items.Insert(2, organizationMenu); + + organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.Organizations, l["Organizations"], url: "/organizations").RequirePermissions(EventHubPermissions.Organizations.Default)); + organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.OrganizationMemberships, l["OrganizationMemberships"], url: "/organization-memberships").RequirePermissions(EventHubPermissions.Organizations.Memberships.Default)); + + return Task.CompletedTask; + } } } diff --git a/src/EventHub.Admin.Web/Menus/EventHubMenus.cs b/src/EventHub.Admin.Web/Menus/EventHubMenus.cs index e24ac1c..66562a1 100644 --- a/src/EventHub.Admin.Web/Menus/EventHubMenus.cs +++ b/src/EventHub.Admin.Web/Menus/EventHubMenus.cs @@ -5,7 +5,11 @@ private const string Prefix = "EventHub"; public const string Home = Prefix + ".Home"; - //Add your menu items here... - + public static class OrganizationManagement + { + public const string GroupName = Prefix + ".OrganizationManagement"; + public const string Organizations = GroupName + ".Organizations"; + public const string OrganizationMemberships = GroupName + ".OrganizationMemberships"; + } } } \ No newline at end of file diff --git a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor new file mode 100644 index 0000000..5a8a0c3 --- /dev/null +++ b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor @@ -0,0 +1,255 @@ +@page "/organizations" +@using Volo.Abp.BlazoriseUI.Components +@using EventHub.Admin.Permissions +@using Microsoft.AspNetCore.Authorization +@using EventHub.Admin.Organizations +@using EventHub.Organizations +@inherits EventHubComponentBase +@inject NavigationManager NavigationManager +@attribute [Authorize(EventHubPermissions.Organizations.Default)] +@inject IOrganizationAppService OrganizationAppService + + + + @* ************************* PAGE HEADER ************************* *@ +

@L["Organizations"]

+
+ +@* ************************* SEARCH ************************* *@ + + +
+
+ + + @L["Name"] + + + + + + + @L["DisplayName"] + + + + + + + @L["MinMemberCount"] + + + + + + + @L["MaxMemberCount"] + + + +
+
+ + @* ************************* DATA GRID ************************* *@ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +@* ************************* EDIT MODAL ************************* *@ + + + +
+ + @L["UpdateOrganization"] + + + + + + Organization Info + Profile Image + + + + + + + @L["DisplayName"] * + + + + + + + + + + + @L["Description"] + + + + + + + + + + + @L["Website"] + + + + + + + + + + + @L["TwitterUsername"] + + + + + + + + + + + @L["GitHubUsername"] + + + + + + + + + + + @L["FacebookUsername"] + + + + + + + + + + + + @L["InstagramUsername"] + + + + + + + + + + + @L["MediumUsername"] + + + + + + + + + + + + @if (!ProfileImageUrl.IsNullOrEmpty()) + { + @if (!IsLoadingProfileImage) + { +
+ profile-image +
+ } + else + { +
+
+ Loading... +
+
+ } + } + +
+ + @L["ChooseProfileImage"] + + + + +
+
+
+
+
+ + + + +
+
+
\ No newline at end of file diff --git a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs new file mode 100644 index 0000000..f4135b2 --- /dev/null +++ b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Blazorise; +using Blazorise.DataGrid; +using EventHub.Admin.Organizations; +using Microsoft.AspNetCore.Components.Web; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Web.Pages +{ + public partial class OrganizationManagement + { + private IReadOnlyList OrganizationList { get; set; } + private OrganizationListFilterDto Filter { get; set; } + private int CurrentPage { get; set; } + private string CurrentSorting { get; set; } + private int TotalCount { get; set; } + private int PageSize { get; } + + private OrganizationProfileDto Organization { get; set; } + private string ProfileImageUrl { get; set; } + + private Guid EditingOrganizationId { get; set; } + private UpdateOrganizationDto EditingOrganization { get; set; } + private Modal EditOrganizationModal { get; set; } + private IFileEntry FileEntry { get; set; } + private bool IsLoadingProfileImage { get; set; } + private string SelectedTabInEditModal { get; set; } + + public OrganizationManagement() + { + Filter = new OrganizationListFilterDto(); + PageSize = LimitedResultRequestDto.DefaultMaxResultCount; + + OrganizationList = new List(); + EditingOrganization = new UpdateOrganizationDto(); + IsLoadingProfileImage = false; + SelectedTabInEditModal = TabContentInEditModal.OrganizationProfile.ToString(); + } + + protected override async Task OnInitializedAsync() + { + await GetOrganizationsAsync(); + } + + private async Task OnDataGridReadAsync(DataGridReadDataEventArgs e) + { + CurrentSorting = e.Columns + .Where(c => c.Direction != SortDirection.None) + .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : "")) + .JoinAsString(","); + CurrentPage = e.Page - 1; + await GetOrganizationsAsync(); + await InvokeAsync(StateHasChanged); + } + + private async Task GetOrganizationsAsync() + { + Filter.MaxResultCount = PageSize; + Filter.SkipCount = CurrentPage * PageSize; + Filter.Sorting = CurrentSorting; + + var result = await OrganizationAppService.GetListAsync(Filter); + OrganizationList = result.Items; + TotalCount = (int) result.TotalCount; + } + + private async Task OpenEditOrganizationModal(OrganizationInListDto input) + { + EditingOrganizationId = input.Id; + Organization = await OrganizationAppService.GetAsync(EditingOrganizationId); + FillProfileImageUrl(Organization.ProfilePictureContent); + + EditingOrganization = ObjectMapper.Map(Organization); + EditOrganizationModal.Show(); + } + + private async Task UpdateOrganizationAsync() + { + await OrganizationAppService.UpdateAsync(EditingOrganizationId, EditingOrganization); + await GetOrganizationsAsync(); + EditOrganizationModal.Hide(); + } + + private async Task DeleteOrganizationAsync(OrganizationInListDto organization) + { + await OrganizationAppService.DeleteAsync(organization.Id); + await GetOrganizationsAsync(); + } + + private async Task OnProfileImageFileChanged(FileChangedEventArgs e) + { + IsLoadingProfileImage = true; + + if (e.Files != null && e.Files.Any()) + { + FileEntry = e.Files[0]; + + if (FileEntry != null) + { + using (var stream = new MemoryStream()) + { + await FileEntry.WriteToStreamAsync(stream); + + stream.Seek(0, SeekOrigin.Begin); + EditingOrganization.ProfilePictureContent = stream.ToArray(); + FillProfileImageUrl(EditingOrganization.ProfilePictureContent); + await InvokeAsync(StateHasChanged); + } + } + } + } + + private void FillProfileImageUrl(byte[] content) + { + if (content != null) + { + var imageBase64Data = Convert.ToBase64String(content); + var imageDataUrl = $"data:image/png;base64,{imageBase64Data}"; + ProfileImageUrl = imageDataUrl; + } + } + + private void OnProgressedForProfileImage(FileProgressedEventArgs e) + { + if (e.Percentage == 100D) + { + IsLoadingProfileImage = false; + } + } + + private void OnSelectedTabChangedInEditModal(string name) + { + SelectedTabInEditModal = name; + } + + private void OnEditModalClosing(CancelEventArgs e) + { + IsLoadingProfileImage = false; + SelectedTabInEditModal = TabContentInEditModal.OrganizationProfile.ToString(); + + } + + private async Task OnKeyPress(KeyboardEventArgs e) + { + if (e.Code == "Enter" || e.Code == "NumpadEnter") + { + await GetOrganizationsAsync(); + } + } + } + + public enum TabContentInEditModal : byte + { + OrganizationProfile = 0, + ProfileImage + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor new file mode 100644 index 0000000..3474b5e --- /dev/null +++ b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor @@ -0,0 +1,63 @@ +@page "/organization-memberships/{OrganizationId:guid?}" +@using Volo.Abp.BlazoriseUI.Components +@using EventHub.Admin.Organizations.Memberships +@using EventHub.Admin.Permissions +@using Microsoft.AspNetCore.Authorization +@inherits EventHubComponentBase +@attribute [Authorize(EventHubPermissions.Organizations.Memberships.Default)] +@inject IOrganizationMembershipAppService OrganizationMembershipAppService + + + + @* ************************* HEADER ************************* *@ +

+ @L["OrganizationMemberships"] + @if (OrganizationId.HasValue && !OrganizationName.IsNullOrWhiteSpace()) + { + (@OrganizationName) + } +

+
+ + @* ************************* SEARCH ************************* *@ + +
+ + @L["UserName"] + + +
+ + @* ************************* DATA GRID ************************* *@ + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs new file mode 100644 index 0000000..f8e6a86 --- /dev/null +++ b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Blazorise.DataGrid; +using EventHub.Admin.Organizations; +using EventHub.Admin.Organizations.Memberships; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Admin.Web.Pages +{ + public partial class OrganizationMembershipManagement + { + [Parameter] + public Guid? OrganizationId { get; set; } + public string OrganizationName { get; set; } + [Inject] + protected IOrganizationAppService OrganizationAppService { get; set; } + + + private IReadOnlyList OrganizationMemberList { get; set; } + private OrganizationMemberListFilterDto Filter { get; set; } + private int CurrentPage { get; set; } + private int TotalCount { get; set; } + private int PageSize { get; } + + public OrganizationMembershipManagement() + { + Filter = new OrganizationMemberListFilterDto(); + PageSize = LimitedResultRequestDto.DefaultMaxResultCount; + + OrganizationMemberList = new List(); + } + + protected override async Task OnInitializedAsync() + { + await GetOrganizationMembershipsAsync(); + + if (OrganizationId.HasValue) + { + OrganizationName = (await OrganizationAppService.GetAsync(OrganizationId.Value)).Name; + } + } + + private async Task OnDataGridReadAsync(DataGridReadDataEventArgs e) + { + CurrentPage = e.Page - 1; + await GetOrganizationMembershipsAsync(); + await InvokeAsync(StateHasChanged); + } + + private async Task GetOrganizationMembershipsAsync() + { + Filter.MaxResultCount = PageSize; + Filter.SkipCount = CurrentPage * PageSize; + + if (OrganizationId.HasValue) + { + Filter.OrganizationId = OrganizationId!.Value; + } + + var result = await OrganizationMembershipAppService.GetListAsync(Filter); + OrganizationMemberList = result.Items; + TotalCount = (int) result.TotalCount; + } + + private async Task OnKeyPress(KeyboardEventArgs e) + { + if (e.Code == "Enter" || e.Code == "NumpadEnter") + { + await GetOrganizationMembershipsAsync(); + } + } + } +} \ No newline at end of file diff --git a/src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs b/src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs index 744d74d..d6a43ea 100644 --- a/src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs +++ b/src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using EventHub.Users; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; diff --git a/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs b/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs new file mode 100644 index 0000000..c8b25b7 --- /dev/null +++ b/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; + +namespace EventHub.Organizations.Memberships +{ + public interface IOrganizationMembershipRepository : IRepository + { + Task> GetMemberListAsync( + Guid? organizationId, + Guid? userId, + int skipCount, + int maxResultCount, + CancellationToken cancellationToken = default); + + Task GetCountAsync( + Guid? organizationId, + Guid? userId, + CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs new file mode 100644 index 0000000..91fa861 --- /dev/null +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using EventHub.Organizations.Memberships; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Identity; + +namespace EventHub.EntityFrameworkCore.Organizations.Memberships +{ + public class OrganizationMembershipRepository : EfCoreRepository, IOrganizationMembershipRepository + { + public OrganizationMembershipRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + + } + + public async Task> GetMemberListAsync( + Guid? organizationId, + Guid? userId, + int skipCount, + int maxResultCount, + CancellationToken cancellationToken = default) + { + var dbContext = await GetDbContextAsync(); + + var organizationMembershipsDbSet = dbContext.Set(); + var identityUserDbSet = dbContext.Set(); + + var query = organizationMembershipsDbSet + .Join(identityUserDbSet, organizationMember => organizationMember.UserId, user => user.Id, + (organizationMember, user) => new {organizationMember, user}) + .WhereIf(userId.HasValue, t => t.user.Id == userId) + .WhereIf(organizationId.HasValue, t => t.organizationMember.OrganizationId == organizationId) + .OrderByDescending(x => x.organizationMember.CreationTime) + .Select(x => x.user); + + return await query + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async Task GetCountAsync( + Guid? organizationId, + Guid? userId, + CancellationToken cancellationToken = default) + { + var dbContext = await GetDbContextAsync(); + + var organizationMembershipsDbSet = dbContext.Set(); + var identityUserDbSet = dbContext.Set(); + + return await organizationMembershipsDbSet + .Join(identityUserDbSet, organizationMember => organizationMember.UserId, user => user.Id, + (organizationMember, user) => new {organizationMember, user}) + .WhereIf(userId.HasValue, t => t.user.Id == userId) + .WhereIf(organizationId.HasValue, t => t.organizationMember.OrganizationId == organizationId) + .CountAsync(GetCancellationToken(cancellationToken)); + } + } +} \ No newline at end of file From 01a1cb9bb47d0e7072619e7f39106b9134b446e8 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 29 Jul 2021 14:05:25 +0300 Subject: [PATCH 06/70] Add missing localizations and add delete cover image button --- .../OrganizationMembershipAppService.cs | 5 +- .../Organizations/OrganizationAppService.cs | 11 ++++ .../Menus/EventHubMenuContributor.cs | 4 +- .../Pages/OrganizationManagement.razor | 49 ++++++++++------ .../Pages/OrganizationManagement.razor.cs | 57 ++++++++++--------- .../EventHubErrorCodes.cs | 1 + .../Localization/EventHub/en.json | 33 ++++++++++- 7 files changed, 111 insertions(+), 49 deletions(-) diff --git a/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs index 6dbbb00..f06fe45 100644 --- a/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs @@ -4,9 +4,9 @@ using System.Threading.Tasks; using EventHub.Admin.Permissions; using EventHub.Organizations.Memberships; using Microsoft.AspNetCore.Authorization; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; -using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; @@ -36,7 +36,8 @@ namespace EventHub.Admin.Organizations.Memberships user = await _userRepository.SingleOrDefaultAsync(x => x.UserName.ToLower().Contains(input.UserName)); if (user is null) { - throw new EntityNotFoundException(typeof(IdentityUser), input.UserName); + throw new BusinessException(EventHubErrorCodes.UserNotFound) + .WithData("UserName", input.UserName); } } diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs index 79c3c5c..d21de44 100644 --- a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -102,6 +102,10 @@ namespace EventHub.Admin.Organizations { await SaveCoverImageAsync(organization.Id, input.ProfilePictureContent); } + else + { + await DeleteCoverImageAsync(organization.Id); + } await _organizationRepository.UpdateAsync(organization); @@ -127,5 +131,12 @@ namespace EventHub.Admin.Organizations await _organizationBlobContainer.SaveAsync(blobName, coverImageContent, overrideExisting: true); } + + private async Task DeleteCoverImageAsync(Guid id) + { + var blobName = id.ToString(); + + await _organizationBlobContainer.DeleteAsync(blobName); + } } } diff --git a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs index 9e5e401..8bd135c 100644 --- a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs +++ b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs @@ -76,8 +76,8 @@ namespace EventHub.Admin.Web.Menus var organizationMenu = new ApplicationMenuItem(EventHubMenus.OrganizationManagement.GroupName, l["Menu:OrganizationManagement"], icon: "fa fa-sitemap"); context.Menu.Items.Insert(2, organizationMenu); - organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.Organizations, l["Organizations"], url: "/organizations").RequirePermissions(EventHubPermissions.Organizations.Default)); - organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.OrganizationMemberships, l["OrganizationMemberships"], url: "/organization-memberships").RequirePermissions(EventHubPermissions.Organizations.Memberships.Default)); + organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.Organizations, l["Menu:Organizations"], url: "/organizations").RequirePermissions(EventHubPermissions.Organizations.Default)); + organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.OrganizationMemberships, l["Menu:OrganizationMemberships"], url: "/organization-memberships").RequirePermissions(EventHubPermissions.Organizations.Memberships.Default)); return Task.CompletedTask; } diff --git a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor index 5a8a0c3..6a81b63 100644 --- a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor +++ b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor @@ -4,10 +4,12 @@ @using Microsoft.AspNetCore.Authorization @using EventHub.Admin.Organizations @using EventHub.Organizations +@using Volo.Abp.AspNetCore.Components.Notifications @inherits EventHubComponentBase @inject NavigationManager NavigationManager @attribute [Authorize(EventHubPermissions.Organizations.Default)] @inject IOrganizationAppService OrganizationAppService +@inject IUiNotificationService UiNotificationService @@ -15,7 +17,7 @@

@L["Organizations"]

-@* ************************* SEARCH ************************* *@ + @* ************************* SEARCH ************************* *@
@@ -65,7 +67,8 @@ + Text="@L["Members"]"> + - Organization Info - Profile Image + @L["OrganizationInfo"] + @L["ProfileImage"] @@ -131,12 +134,12 @@ - @L["Description"] - + @L["Description"] * + - + @@ -210,30 +213,40 @@ - @if (!ProfileImageUrl.IsNullOrEmpty()) + @if (!IsLoadingProfileImage) { - @if (!IsLoadingProfileImage) + @if (!ProfileImageUrl.IsNullOrEmpty()) {
profile-image
} - else - { -
-
- Loading... -
+ } + else + { +
+
+ @L["Loading"]...
- } +
} -
+
@L["ChooseProfileImage"] - + + + @if (!ProfileImageUrl.IsNullOrWhiteSpace()) + { + + } + else + { + + } +
diff --git a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs index f4135b2..d441bae 100644 --- a/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs +++ b/src/EventHub.Admin.Web/Pages/OrganizationManagement.razor.cs @@ -23,14 +23,14 @@ namespace EventHub.Admin.Web.Pages private OrganizationProfileDto Organization { get; set; } private string ProfileImageUrl { get; set; } - + private Guid EditingOrganizationId { get; set; } private UpdateOrganizationDto EditingOrganization { get; set; } private Modal EditOrganizationModal { get; set; } private IFileEntry FileEntry { get; set; } private bool IsLoadingProfileImage { get; set; } private string SelectedTabInEditModal { get; set; } - + public OrganizationManagement() { Filter = new OrganizationListFilterDto(); @@ -74,7 +74,7 @@ namespace EventHub.Admin.Web.Pages EditingOrganizationId = input.Id; Organization = await OrganizationAppService.GetAsync(EditingOrganizationId); FillProfileImageUrl(Organization.ProfilePictureContent); - + EditingOrganization = ObjectMapper.Map(Organization); EditOrganizationModal.Show(); } @@ -86,35 +86,41 @@ namespace EventHub.Admin.Web.Pages EditOrganizationModal.Hide(); } + private void OnDeleteCoverImageButtonClicked() + { + EditingOrganization.ProfilePictureContent = null; + FileEntry = new FileEntry(); + ProfileImageUrl = null; + IsLoadingProfileImage = false; + } + private async Task DeleteOrganizationAsync(OrganizationInListDto organization) { await OrganizationAppService.DeleteAsync(organization.Id); await GetOrganizationsAsync(); } - + private async Task OnProfileImageFileChanged(FileChangedEventArgs e) { + FileEntry = e.Files.FirstOrDefault(); + if (FileEntry is null) + { + return; + } + IsLoadingProfileImage = true; - - if (e.Files != null && e.Files.Any()) - { - FileEntry = e.Files[0]; - - if (FileEntry != null) - { - using (var stream = new MemoryStream()) - { - await FileEntry.WriteToStreamAsync(stream); - - stream.Seek(0, SeekOrigin.Begin); - EditingOrganization.ProfilePictureContent = stream.ToArray(); - FillProfileImageUrl(EditingOrganization.ProfilePictureContent); - await InvokeAsync(StateHasChanged); - } - } + + using (var stream = new MemoryStream()) + { + await FileEntry.WriteToStreamAsync(stream); + + stream.Seek(0, SeekOrigin.Begin); + EditingOrganization.ProfilePictureContent = stream.ToArray(); + FillProfileImageUrl(EditingOrganization.ProfilePictureContent); + await InvokeAsync(StateHasChanged); } } - + private void FillProfileImageUrl(byte[] content) { if (content != null) @@ -124,7 +130,7 @@ namespace EventHub.Admin.Web.Pages ProfileImageUrl = imageDataUrl; } } - + private void OnProgressedForProfileImage(FileProgressedEventArgs e) { if (e.Percentage == 100D) @@ -137,12 +143,11 @@ namespace EventHub.Admin.Web.Pages { SelectedTabInEditModal = name; } - + private void OnEditModalClosing(CancelEventArgs e) { IsLoadingProfileImage = false; SelectedTabInEditModal = TabContentInEditModal.OrganizationProfile.ToString(); - } private async Task OnKeyPress(KeyboardEventArgs e) @@ -153,7 +158,7 @@ namespace EventHub.Admin.Web.Pages } } } - + public enum TabContentInEditModal : byte { OrganizationProfile = 0, diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index 4b4bccd..e2bc477 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -11,5 +11,6 @@ public const string CapacityCantBeLowerThanRegisteredUserCount = "EventHub:CapacityCantBeLowerThanRegisteredUserCount"; public const string NotAuthorizedToUpdateEvent = "EventHub:NotAuthorizedToUpdateEvent"; public const string CantChangeEventTiming = "EventHub:CantChangeEventTiming"; + public const string UserNotFound = "EventHub:UserNotFound"; } } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index fa2b05b..5eab35a 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -82,6 +82,37 @@ "EventTimingPreview": "Event Timing Preview", "CoverImagePreview": "Cover Image Preview", "EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!", - "PastEvent": "Past Event" + "PastEvent": "Past Event", + "Menu:OrganizationManagement": "Organization Management", + "Menu:OrganizationMemberships": "Memberships", + "Permission:OrganizationManagement": "Organization Management", + "Permission:MembershipManagement": "Membership Management", + "Permission:Create": "Create", + "Permission:Edit": "Edit", + "Permission:Delete": "Delete", + "UserName": "User name", + "Email": "Email", + "Name": "Name", + "Surname": "Surname", + "DisplayName": "Display Name", + "MinMemberCount": "Min Member Count", + "MaxMemberCount": "Max Member Count", + "MemberCount": "Member Count", + "UpdateOrganization": "Update Organization", + "Description": "Description", + "Website": "Website", + "TwitterUsername": "Twitter Username", + "GitHubUsername": "GitHub Username", + "FacebookUsername": "Facebook Username", + "InstagramUsername": "Instagram Username", + "MediumUsername": "Medium Username", + "ChooseProfileImage": "Choose profile image:", + "OrganizationMemberships": "Organization Memberships", + "EventHub:UserNotFound": "There is no user named \"{UserName}\"", + "DeleteCoverImage": "Delete Cover Image", + "DeleteConfirmationMessage": "Are you sure you want to delete this item?", + "Loading": "Loading", + "OrganizationInfo": "Organization Info", + "ProfileImage": "Profile Image" } } From 96c419d6cd83741d5db5de101537512bb6953024 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 29 Jul 2021 14:13:43 +0300 Subject: [PATCH 07/70] fix(Admin): bad indentation --- .../Organizations/OrganizationInListDto.cs | 14 +- .../Organizations/OrganizationAppService.cs | 256 +++++++++--------- .../Organizations/OrganizationController.cs | 2 +- .../EventHubBlazorAutoMapperProfile.cs | 2 +- .../Menus/EventHubMenuContributor.cs | 20 +- 5 files changed, 151 insertions(+), 143 deletions(-) diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs index 796ed3d..e5ddbff 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs @@ -3,12 +3,12 @@ using Volo.Abp.Application.Dtos; namespace EventHub.Admin.Organizations { - public class OrganizationInListDto : EntityDto - { - public string Name { get; set; } + public class OrganizationInListDto : EntityDto + { + public string Name { get; set; } - public string DisplayName { get; set; } + public string DisplayName { get; set; } - public int MemberCount { get; set; } - } -} + public int MemberCount { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs index d21de44..bbf2c37 100644 --- a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -13,130 +13,132 @@ using Volo.Abp.Identity; namespace EventHub.Admin.Organizations { - [Authorize(EventHubPermissions.Organizations.Default)] - public class OrganizationAppService : EventHubAdminAppService, IOrganizationAppService - { - private readonly IRepository _organizationRepository; - private readonly IRepository _identityUserRepository; - private readonly IBlobContainer _organizationBlobContainer; - - public OrganizationAppService( - IRepository organizationRepository, - IRepository identityUserRepository, - IBlobContainer organizationBlobContainer) - { - _organizationRepository = organizationRepository; - _identityUserRepository = identityUserRepository; - _organizationBlobContainer = organizationBlobContainer; - } - - public async Task> GetListAsync(OrganizationListFilterDto input) - { - var query = await _organizationRepository.GetQueryableAsync(); - - if (!input.Name.IsNullOrWhiteSpace()) - { - input.Name = input.Name.ToLower(); - query = query.Where(o => o.Name.ToLower().Contains(input.Name)); - } - - if (!input.DisplayName.IsNullOrWhiteSpace()) - { - input.DisplayName = input.DisplayName.ToLower(); - query = query.Where(o => o.DisplayName.ToLower().Contains(input.DisplayName)); - } - - if (input.MinMemberCount != null) - { - query = query.Where(o => o.MemberCount >= input.MinMemberCount); - } - - if (input.MaxMemberCount != null) - { - query = query.Where(o => o.MemberCount <= input.MaxMemberCount); - } - - var totalCount = await AsyncExecuter.CountAsync(query); - - query = query.OrderBy(string.IsNullOrWhiteSpace(input.Sorting) ? OrganizationConsts.DefaultSorting : input.Sorting); - - query = query.PageBy(input); - - var organizationListDto = ObjectMapper - .Map, List>(await AsyncExecuter.ToListAsync(query)); - - return new PagedResultDto(totalCount, organizationListDto); - } - - public async Task GetAsync(Guid id) - { - var organization = await _organizationRepository.GetAsync(id); - - var dto = ObjectMapper.Map(organization); - - var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); - dto.OwnerUserName = user.UserName; - dto.OwnerEmail = user.Email; - - dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); - - return dto; - } - - [Authorize(EventHubPermissions.Organizations.Update)] - public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) - { - var organization = await _organizationRepository.GetAsync(id); - - organization.SetDisplayName(input.DisplayName); - organization.SetDescription(input.Description); - - organization.Website = input.Website; - organization.TwitterUsername = input.TwitterUsername; - organization.GitHubUsername = input.GitHubUsername; - organization.FacebookUsername = input.FacebookUsername; - organization.InstagramUsername = input.InstagramUsername; - organization.MediumUsername = input.MediumUsername; - - if (input.ProfilePictureContent?.Length > 0) - { - await SaveCoverImageAsync(organization.Id, input.ProfilePictureContent); - } - else - { - await DeleteCoverImageAsync(organization.Id); - } - - await _organizationRepository.UpdateAsync(organization); - - return ObjectMapper.Map(organization); - } - - [Authorize(EventHubPermissions.Organizations.Delete)] - public async Task DeleteAsync(Guid id) - { - await _organizationRepository.DeleteAsync(id); - } - - private async Task GetCoverImageAsync(Guid id) - { - var blobName = id.ToString(); - - return await _organizationBlobContainer.GetAllBytesOrNullAsync(blobName); - } - - private async Task SaveCoverImageAsync(Guid id, byte[] coverImageContent) - { - var blobName = id.ToString(); - - await _organizationBlobContainer.SaveAsync(blobName, coverImageContent, overrideExisting: true); - } - - private async Task DeleteCoverImageAsync(Guid id) - { - var blobName = id.ToString(); - - await _organizationBlobContainer.DeleteAsync(blobName); - } - } -} + [Authorize(EventHubPermissions.Organizations.Default)] + public class OrganizationAppService : EventHubAdminAppService, IOrganizationAppService + { + private readonly IRepository _organizationRepository; + private readonly IRepository _identityUserRepository; + private readonly IBlobContainer _organizationBlobContainer; + + public OrganizationAppService( + IRepository organizationRepository, + IRepository identityUserRepository, + IBlobContainer organizationBlobContainer) + { + _organizationRepository = organizationRepository; + _identityUserRepository = identityUserRepository; + _organizationBlobContainer = organizationBlobContainer; + } + + public async Task> GetListAsync(OrganizationListFilterDto input) + { + var query = await _organizationRepository.GetQueryableAsync(); + + if (!input.Name.IsNullOrWhiteSpace()) + { + input.Name = input.Name.ToLower(); + query = query.Where(o => o.Name.ToLower().Contains(input.Name)); + } + + if (!input.DisplayName.IsNullOrWhiteSpace()) + { + input.DisplayName = input.DisplayName.ToLower(); + query = query.Where(o => o.DisplayName.ToLower().Contains(input.DisplayName)); + } + + if (input.MinMemberCount != null) + { + query = query.Where(o => o.MemberCount >= input.MinMemberCount); + } + + if (input.MaxMemberCount != null) + { + query = query.Where(o => o.MemberCount <= input.MaxMemberCount); + } + + var totalCount = await AsyncExecuter.CountAsync(query); + + query = query.OrderBy(string.IsNullOrWhiteSpace(input.Sorting) + ? OrganizationConsts.DefaultSorting + : input.Sorting); + + query = query.PageBy(input); + + var organizationListDto = ObjectMapper + .Map, List>(await AsyncExecuter.ToListAsync(query)); + + return new PagedResultDto(totalCount, organizationListDto); + } + + public async Task GetAsync(Guid id) + { + var organization = await _organizationRepository.GetAsync(id); + + var dto = ObjectMapper.Map(organization); + + var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); + dto.OwnerUserName = user.UserName; + dto.OwnerEmail = user.Email; + + dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); + + return dto; + } + + [Authorize(EventHubPermissions.Organizations.Update)] + public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) + { + var organization = await _organizationRepository.GetAsync(id); + + organization.SetDisplayName(input.DisplayName); + organization.SetDescription(input.Description); + + organization.Website = input.Website; + organization.TwitterUsername = input.TwitterUsername; + organization.GitHubUsername = input.GitHubUsername; + organization.FacebookUsername = input.FacebookUsername; + organization.InstagramUsername = input.InstagramUsername; + organization.MediumUsername = input.MediumUsername; + + if (input.ProfilePictureContent?.Length > 0) + { + await SaveCoverImageAsync(organization.Id, input.ProfilePictureContent); + } + else + { + await DeleteCoverImageAsync(organization.Id); + } + + await _organizationRepository.UpdateAsync(organization); + + return ObjectMapper.Map(organization); + } + + [Authorize(EventHubPermissions.Organizations.Delete)] + public async Task DeleteAsync(Guid id) + { + await _organizationRepository.DeleteAsync(id); + } + + private async Task GetCoverImageAsync(Guid id) + { + var blobName = id.ToString(); + + return await _organizationBlobContainer.GetAllBytesOrNullAsync(blobName); + } + + private async Task SaveCoverImageAsync(Guid id, byte[] coverImageContent) + { + var blobName = id.ToString(); + + await _organizationBlobContainer.SaveAsync(blobName, coverImageContent, overrideExisting: true); + } + + private async Task DeleteCoverImageAsync(Guid id) + { + var blobName = id.ToString(); + + await _organizationBlobContainer.DeleteAsync(blobName); + } + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs index 9774488..53d70fa 100644 --- a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs @@ -19,7 +19,7 @@ namespace EventHub.Admin.Controllers.Organizations { _organizationAppService = organizationAppService; } - + [HttpGet] public Task> GetListAsync(OrganizationListFilterDto input) { diff --git a/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs b/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs index c0b5d01..53cffe5 100644 --- a/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs +++ b/src/EventHub.Admin.Web/EventHubBlazorAutoMapperProfile.cs @@ -10,4 +10,4 @@ namespace EventHub.Admin.Web CreateMap(); } } -} +} \ No newline at end of file diff --git a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs index 8bd135c..1aa0481 100644 --- a/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs +++ b/src/EventHub.Admin.Web/Menus/EventHubMenuContributor.cs @@ -46,7 +46,7 @@ namespace EventHub.Admin.Web.Menus icon: "fas fa-home" ) ); - + await AddOrganizationMenu(context, l); } @@ -70,16 +70,22 @@ namespace EventHub.Admin.Web.Menus return Task.CompletedTask; } - + private Task AddOrganizationMenu(MenuConfigurationContext context, IStringLocalizer l) { - var organizationMenu = new ApplicationMenuItem(EventHubMenus.OrganizationManagement.GroupName, l["Menu:OrganizationManagement"], icon: "fa fa-sitemap"); + var organizationMenu = new ApplicationMenuItem(EventHubMenus.OrganizationManagement.GroupName, + l["Menu:OrganizationManagement"], icon: "fa fa-sitemap"); context.Menu.Items.Insert(2, organizationMenu); - organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.Organizations, l["Menu:Organizations"], url: "/organizations").RequirePermissions(EventHubPermissions.Organizations.Default)); - organizationMenu.AddItem(new ApplicationMenuItem(EventHubMenus.OrganizationManagement.OrganizationMemberships, l["Menu:OrganizationMemberships"], url: "/organization-memberships").RequirePermissions(EventHubPermissions.Organizations.Memberships.Default)); - + organizationMenu.AddItem( + new ApplicationMenuItem(EventHubMenus.OrganizationManagement.Organizations, l["Menu:Organizations"], + url: "/organizations").RequirePermissions(EventHubPermissions.Organizations.Default)); + organizationMenu.AddItem( + new ApplicationMenuItem(EventHubMenus.OrganizationManagement.OrganizationMemberships, + l["Menu:OrganizationMemberships"], url: "/organization-memberships") + .RequirePermissions(EventHubPermissions.Organizations.Memberships.Default)); + return Task.CompletedTask; } } -} +} \ No newline at end of file From 1f61892afec99ef7832dae944cf7bbe84988b321 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 29 Jul 2021 16:18:21 +0300 Subject: [PATCH 08/70] Feat: Add Organization name on Organization memberships page --- .../Organizations/IOrganizationAppService.cs | 2 ++ .../Memberships/OrganizationMemberDto.cs | 2 ++ .../EventHubApplicationAutoMapperProfile.cs | 4 +-- .../OrganizationMembershipAppService.cs | 4 +-- .../Organizations/OrganizationAppService.cs | 21 +++++++++++++++ .../Organizations/OrganizationController.cs | 7 +++++ .../OrganizationMembershipManagement.razor | 25 ++++++++++++++---- .../OrganizationMembershipManagement.razor.cs | 26 +++++++++++++++++-- .../EventHubErrorCodes.cs | 1 + .../Localization/EventHub/en.json | 4 ++- .../IOrganizationMembershipRepository.cs | 2 +- .../OrganizationMemberWithDetails.cs | 18 +++++++++++++ .../OrganizationMembershipRepository.cs | 25 +++++++++++++----- 13 files changed, 121 insertions(+), 20 deletions(-) create mode 100644 src/EventHub.Domain/Organizations/Memberships/OrganizationMemberWithDetails.cs diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs index 0a1a715..b0850b8 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs @@ -11,6 +11,8 @@ namespace EventHub.Admin.Organizations Task GetAsync(Guid id); + Task GetByNameAsync(string name); + Task UpdateAsync(Guid id, UpdateOrganizationDto input); Task DeleteAsync(Guid id); diff --git a/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs index f356ca1..e4e3550 100644 --- a/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs +++ b/src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs @@ -5,6 +5,8 @@ namespace EventHub.Admin.Organizations.Memberships { public class OrganizationMemberDto : EntityDto { + public string OrganizationName { get; set; } + public string UserName { get; set; } public string Email { get; set; } diff --git a/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs index 6d40c34..b11a97c 100644 --- a/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs +++ b/src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs @@ -2,8 +2,8 @@ using AutoMapper; using EventHub.Admin.Organizations; using EventHub.Admin.Organizations.Memberships; using EventHub.Organizations; +using EventHub.Organizations.Memberships; using Volo.Abp.AutoMapper; -using Volo.Abp.Identity; namespace EventHub.Admin { @@ -18,7 +18,7 @@ namespace EventHub.Admin .Ignore(x => x.OwnerEmail) .Ignore(x => x.ProfilePictureContent); - CreateMap(); + CreateMap(); } } } diff --git a/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs index f06fe45..b97d381 100644 --- a/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs @@ -33,7 +33,7 @@ namespace EventHub.Admin.Organizations.Memberships if (!input.UserName.IsNullOrWhiteSpace()) { input.UserName = input.UserName.ToLower(); - user = await _userRepository.SingleOrDefaultAsync(x => x.UserName.ToLower().Contains(input.UserName)); + user = await _userRepository.SingleOrDefaultAsync(x => x.UserName.ToLower() == input.UserName); if (user is null) { throw new BusinessException(EventHubErrorCodes.UserNotFound) @@ -46,7 +46,7 @@ namespace EventHub.Admin.Organizations.Memberships return new PagedResultDto( totalCount, - ObjectMapper.Map, List>(members) + ObjectMapper.Map, List>(members) ); } } diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs index bbf2c37..9551782 100644 --- a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using EventHub.Admin.Permissions; using EventHub.Organizations; using Microsoft.AspNetCore.Authorization; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.BlobStoring; using Volo.Abp.Domain.Repositories; @@ -84,6 +85,26 @@ namespace EventHub.Admin.Organizations return dto; } + + public async Task GetByNameAsync(string name) + { + var organization = await _organizationRepository.FindAsync(x => x.Name.ToLower() == name.ToLower()); + if (organization is null) + { + throw new BusinessException(EventHubErrorCodes.OrganizationNotFound) + .WithData("OrganizationName", name); + } + + var dto = ObjectMapper.Map(organization); + + var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); + dto.OwnerUserName = user.UserName; + dto.OwnerEmail = user.Email; + + dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); + + return dto; + } [Authorize(EventHubPermissions.Organizations.Update)] public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs index 53d70fa..50a6c07 100644 --- a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs @@ -32,6 +32,13 @@ namespace EventHub.Admin.Controllers.Organizations { return _organizationAppService.GetAsync(id); } + + [HttpGet] + [Route("by-name/{name}")] + public Task GetByNameAsync(string name) + { + return _organizationAppService.GetByNameAsync(name); + } [HttpPut] public Task UpdateAsync(Guid id, UpdateOrganizationDto input) diff --git a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor index 3474b5e..a304b2d 100644 --- a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor +++ b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor @@ -14,7 +14,7 @@ @L["OrganizationMemberships"] @if (OrganizationId.HasValue && !OrganizationName.IsNullOrWhiteSpace()) { - (@OrganizationName) + (@OrganizationName) } @@ -22,10 +22,21 @@ @* ************************* SEARCH ************************* *@
- - @L["UserName"] - - + + + + @L["OrganizationName"] + + + + + + + @L["UserName"] + + + +
@* ************************* DATA GRID ************************* *@ @@ -38,6 +49,10 @@ Responsive="true" Sortable="false"> + + diff --git a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs index f8e6a86..8d9a017 100644 --- a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs +++ b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor.cs @@ -14,7 +14,8 @@ namespace EventHub.Admin.Web.Pages { [Parameter] public Guid? OrganizationId { get; set; } - public string OrganizationName { get; set; } + private string OrganizationName { get; set; } + [Inject] protected IOrganizationAppService OrganizationAppService { get; set; } @@ -59,7 +60,16 @@ namespace EventHub.Admin.Web.Pages { Filter.OrganizationId = OrganizationId!.Value; } - + else + { + Filter.OrganizationId = null; + } + + if (!Filter.UserName.IsNullOrWhiteSpace()) + { + Filter.UserName = Filter.UserName.Trim(); + } + var result = await OrganizationMembershipAppService.GetListAsync(Filter); OrganizationMemberList = result.Items; TotalCount = (int) result.TotalCount; @@ -69,6 +79,18 @@ namespace EventHub.Admin.Web.Pages { if (e.Code == "Enter" || e.Code == "NumpadEnter") { + if (OrganizationName.IsNullOrWhiteSpace()) + { + OrganizationId = null; + OrganizationName = null; + } + else + { + var organization = await OrganizationAppService.GetByNameAsync(OrganizationName.Trim()); + OrganizationId = organization.Id; + OrganizationName = organization.Name; + } + await GetOrganizationMembershipsAsync(); } } diff --git a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs index e2bc477..d35d621 100644 --- a/src/EventHub.Domain.Shared/EventHubErrorCodes.cs +++ b/src/EventHub.Domain.Shared/EventHubErrorCodes.cs @@ -12,5 +12,6 @@ public const string NotAuthorizedToUpdateEvent = "EventHub:NotAuthorizedToUpdateEvent"; public const string CantChangeEventTiming = "EventHub:CantChangeEventTiming"; public const string UserNotFound = "EventHub:UserNotFound"; + public const string OrganizationNotFound = "EventHub:OrganizationNotFound"; } } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index 5eab35a..1bf060c 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -109,10 +109,12 @@ "ChooseProfileImage": "Choose profile image:", "OrganizationMemberships": "Organization Memberships", "EventHub:UserNotFound": "There is no user named \"{UserName}\"", + "EventHub:OrganizationNotFound": "There is no organization named \"{OrganizationName}\"", "DeleteCoverImage": "Delete Cover Image", "DeleteConfirmationMessage": "Are you sure you want to delete this item?", "Loading": "Loading", "OrganizationInfo": "Organization Info", - "ProfileImage": "Profile Image" + "ProfileImage": "Profile Image", + "OrganizationName": "Organization Name" } } diff --git a/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs b/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs index c8b25b7..07f542a 100644 --- a/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs +++ b/src/EventHub.Domain/Organizations/Memberships/IOrganizationMembershipRepository.cs @@ -9,7 +9,7 @@ namespace EventHub.Organizations.Memberships { public interface IOrganizationMembershipRepository : IRepository { - Task> GetMemberListAsync( + Task> GetMemberListAsync( Guid? organizationId, Guid? userId, int skipCount, diff --git a/src/EventHub.Domain/Organizations/Memberships/OrganizationMemberWithDetails.cs b/src/EventHub.Domain/Organizations/Memberships/OrganizationMemberWithDetails.cs new file mode 100644 index 0000000..df907f3 --- /dev/null +++ b/src/EventHub.Domain/Organizations/Memberships/OrganizationMemberWithDetails.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace EventHub.Organizations.Memberships +{ + public class OrganizationMemberWithDetails : Entity + { + public string OrganizationName { get; set; } + + public string UserName { get; set; } + + public string Email { get; set; } + + public string Name { get; set; } + + public string Surname { get; set; } + } +} \ No newline at end of file diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs index 91fa861..f540e94 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using EventHub.Organizations; using EventHub.Organizations.Memberships; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -18,7 +19,7 @@ namespace EventHub.EntityFrameworkCore.Organizations.Memberships } - public async Task> GetMemberListAsync( + public async Task> GetMemberListAsync( Guid? organizationId, Guid? userId, int skipCount, @@ -29,14 +30,24 @@ namespace EventHub.EntityFrameworkCore.Organizations.Memberships var organizationMembershipsDbSet = dbContext.Set(); var identityUserDbSet = dbContext.Set(); - + var organizationDbSet = dbContext.Set(); + var query = organizationMembershipsDbSet - .Join(identityUserDbSet, organizationMember => organizationMember.UserId, user => user.Id, - (organizationMember, user) => new {organizationMember, user}) + .Join(organizationDbSet, t => t.OrganizationId, organization => organization.Id + , (organizationMember, organization) => new {organizationMember, organization}) + .Join(identityUserDbSet, organizationWithMember => organizationWithMember.organizationMember.UserId, user => user.Id, + (organizationWithMember, user) => new {organizationWithMember, user}) .WhereIf(userId.HasValue, t => t.user.Id == userId) - .WhereIf(organizationId.HasValue, t => t.organizationMember.OrganizationId == organizationId) - .OrderByDescending(x => x.organizationMember.CreationTime) - .Select(x => x.user); + .WhereIf(organizationId.HasValue, t => t.organizationWithMember.organizationMember.OrganizationId == organizationId) + .OrderByDescending(o => o.organizationWithMember.organizationMember.CreationTime) + .Select(t => new OrganizationMemberWithDetails + { + OrganizationName = t.organizationWithMember.organization.Name, + UserName = t.user.UserName, + Email = t.user.Email, + Name = t.user.Name, + Surname = t.user.Surname + }); return await query .PageBy(skipCount, maxResultCount) From 9895a1ddfb4b08dd131dbd97c2b744721afda8b0 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 29 Jul 2021 16:35:03 +0300 Subject: [PATCH 09/70] fix(Admin): bad indentation --- .../OrganizationMembershipManagement.razor | 4 +-- .../OrganizationMembershipRepository.cs | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor index a304b2d..79f6f18 100644 --- a/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor +++ b/src/EventHub.Admin.Web/Pages/OrganizationMembershipManagement.razor @@ -23,14 +23,14 @@
- + @L["OrganizationName"] - + @L["UserName"] diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs index f540e94..fa1b3bb 100644 --- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs +++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/Organizations/Memberships/OrganizationMembershipRepository.cs @@ -12,17 +12,18 @@ using Volo.Abp.Identity; namespace EventHub.EntityFrameworkCore.Organizations.Memberships { - public class OrganizationMembershipRepository : EfCoreRepository, IOrganizationMembershipRepository + public class OrganizationMembershipRepository : EfCoreRepository, + IOrganizationMembershipRepository { - public OrganizationMembershipRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + public OrganizationMembershipRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) { - } public async Task> GetMemberListAsync( - Guid? organizationId, + Guid? organizationId, Guid? userId, - int skipCount, + int skipCount, int maxResultCount, CancellationToken cancellationToken = default) { @@ -31,14 +32,15 @@ namespace EventHub.EntityFrameworkCore.Organizations.Memberships var organizationMembershipsDbSet = dbContext.Set(); var identityUserDbSet = dbContext.Set(); var organizationDbSet = dbContext.Set(); - + var query = organizationMembershipsDbSet - .Join(organizationDbSet, t => t.OrganizationId, organization => organization.Id - , (organizationMember, organization) => new {organizationMember, organization}) - .Join(identityUserDbSet, organizationWithMember => organizationWithMember.organizationMember.UserId, user => user.Id, - (organizationWithMember, user) => new {organizationWithMember, user}) + .Join(organizationDbSet, t => t.OrganizationId, organization => organization.Id, + (organizationMember, organization) => new {organizationMember, organization}) + .Join(identityUserDbSet, organizationWithMember => organizationWithMember.organizationMember.UserId, + user => user.Id, (organizationWithMember, user) => new {organizationWithMember, user}) .WhereIf(userId.HasValue, t => t.user.Id == userId) - .WhereIf(organizationId.HasValue, t => t.organizationWithMember.organizationMember.OrganizationId == organizationId) + .WhereIf(organizationId.HasValue, + t => t.organizationWithMember.organizationMember.OrganizationId == organizationId) .OrderByDescending(o => o.organizationWithMember.organizationMember.CreationTime) .Select(t => new OrganizationMemberWithDetails { @@ -48,14 +50,14 @@ namespace EventHub.EntityFrameworkCore.Organizations.Memberships Name = t.user.Name, Surname = t.user.Surname }); - + return await query .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetCountAsync( - Guid? organizationId, + Guid? organizationId, Guid? userId, CancellationToken cancellationToken = default) { From 58eced8118ab466f5f4d7d64994c2626dc317070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 11:58:38 +0300 Subject: [PATCH 10/70] Created postgresql chart --- etc/k8s/helm-chart/eventhub/Chart.yaml | 6 +++++ .../eventhub/charts/postgresql/Chart.yaml | 6 +++++ .../templates/postgresql-service.yaml | 15 +++++++++++ .../postgresql/templates/postgresql.yaml | 25 +++++++++++++++++++ .../eventhub/charts/postgresql/values.yaml | 0 etc/k8s/helm-chart/eventhub/values.yaml | 0 6 files changed, 52 insertions(+) create mode 100644 etc/k8s/helm-chart/eventhub/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/postgresql/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/values.yaml diff --git a/etc/k8s/helm-chart/eventhub/Chart.yaml b/etc/k8s/helm-chart/eventhub/Chart.yaml new file mode 100644 index 0000000..5c0b700 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: eventhub +appVersion: "1.0" +description: Eventhub application chart +version: 1.0.0 +type: application diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml new file mode 100644 index 0000000..49bbcd8 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: database +appVersion: "1.0" +description: Runs PostgreSQL Instance +version: 1.0.0 +type: application diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml new file mode 100644 index 0000000..c4fa04a --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: postgresql + name: postgresql +spec: + type: LoadBalancer + ports: + - name: postgresql + port: 5435 + targetPort: 5432 + selector: + app: postgresql + diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml new file mode 100644 index 0000000..fd6e1e0 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgresql +spec: + replicas: 1 + selector: + matchLabels: + app: postgresql + template: + metadata: + labels: + app: postgresql + spec: + containers: + - image: postgres + name: postgresql + ports: + - name: postgresql + containerPort: 5432 + env: + - name: POSTGRES_USER + value: "root" + - name: POSTGRES_PASSWORD + value: "root" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/values.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml new file mode 100644 index 0000000..e69de29 From 3b98092967fdf2e01287676b4d7090c3de3cb03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 12:21:21 +0300 Subject: [PATCH 11/70] Created dbmigrator chart --- .../eventhub/charts/dbmigrator/Chart.yaml | 6 ++++++ .../charts/dbmigrator/templates/migrator.yaml | 14 ++++++++++++++ src/EventHub.DbMigrator/Dockerfile | 4 ++++ src/EventHub.DbMigrator/appsettings.json | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml create mode 100644 src/EventHub.DbMigrator/Dockerfile diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml new file mode 100644 index 0000000..a20b761 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: migrator +appVersion: "1.0" +description: EventHub Migrator Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml new file mode 100644 index 0000000..18f6233 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -0,0 +1,14 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: migrator +spec: + activeDeadlineSeconds: 100 + template: + spec: + containers: + - name: migrator + image: eventhubmigrator + imagePullPolicy: Never + restartPolicy: Never + backoffLimit: 4 \ No newline at end of file diff --git a/src/EventHub.DbMigrator/Dockerfile b/src/EventHub.DbMigrator/Dockerfile new file mode 100644 index 0000000..1c97a60 --- /dev/null +++ b/src/EventHub.DbMigrator/Dockerfile @@ -0,0 +1,4 @@ + FROM mcr.microsoft.com/dotnet/runtime:5.0 + COPY bin/Release/net5.0/ app/ + WORKDIR /app + ENTRYPOINT ["dotnet", "EventHub.DbMigrator.dll"] \ No newline at end of file diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 828fd62..c4413fb 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root;Port=5432" }, "IdentityServer": { "Clients": { From 6d115573a4610d3d5ba7b0240a3d7201002c0dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 13:26:58 +0300 Subject: [PATCH 12/70] Added redis chart --- .../eventhub/charts/redis/Chart.yaml | 6 +++++ .../charts/redis/templates/redis-service.yaml | 15 +++++++++++ .../charts/redis/templates/redis.yaml | 25 +++++++++++++++++++ .../eventhub/charts/redis/values.yaml | 0 src/EventHub.DbMigrator/Dockerfile | 2 +- src/EventHub.DbMigrator/appsettings.json | 2 +- 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/redis/values.yaml diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml new file mode 100644 index 0000000..11ec26c --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: redis +appVersion: "1.0" +description: Runs Redis instance +version: 1.0.0 +type: application diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml new file mode 100644 index 0000000..5c2d9ef --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: redis + name: redis +spec: + type: ClusterIP + ports: + - name: redis + port: 6379 + targetPort: 6379 + selector: + app: redis + diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml new file mode 100644 index 0000000..22e1f51 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - image: redis:6.0.10-alpine + name: redis + ports: + - name: redis + containerPort: 6379 + env: + - name: POSTGRES_USER + value: "root" + - name: POSTGRES_PASSWORD + value: "root" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/values.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/src/EventHub.DbMigrator/Dockerfile b/src/EventHub.DbMigrator/Dockerfile index 1c97a60..175494f 100644 --- a/src/EventHub.DbMigrator/Dockerfile +++ b/src/EventHub.DbMigrator/Dockerfile @@ -1,4 +1,4 @@ - FROM mcr.microsoft.com/dotnet/runtime:5.0 + FROM mcr.microsoft.com/dotnet/aspnet:5.0 COPY bin/Release/net5.0/ app/ WORKDIR /app ENTRYPOINT ["dotnet", "EventHub.DbMigrator.dll"] \ No newline at end of file diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index c4413fb..9073010 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root;Port=5432" + "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "IdentityServer": { "Clients": { From 0c1b6a5aada417ff6bca2be141f6b30d53c9daf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 13:54:50 +0300 Subject: [PATCH 13/70] Added account chart. --- .../eventhub/charts/account/Chart.yaml | 6 ++ .../account/templates/account-ingress.yaml | 18 +++++ .../account/templates/account-service.yaml | 14 ++++ .../charts/account/templates/account.yaml | 22 ++++++ src/EventHub.DbMigrator/appsettings.json | 6 +- src/EventHub.IdentityServer/Dockerfile | 4 ++ .../EventHubIdentityServerModule.cs | 4 ++ src/EventHub.IdentityServer/Program.cs | 2 - ...eSiteCookiesServiceCollectionExtensions.cs | 70 +++++++++++++++++++ src/EventHub.IdentityServer/appsettings.json | 10 +-- 10 files changed, 146 insertions(+), 10 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml create mode 100644 src/EventHub.IdentityServer/Dockerfile create mode 100644 src/EventHub.IdentityServer/SameSiteCookiesServiceCollectionExtensions.cs diff --git a/etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml new file mode 100644 index 0000000..ad4fd58 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: account +appVersion: "1.0" +description: EventHub Account Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml new file mode 100644 index 0000000..19ef867 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: account-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - host: "account.openeventhub.com" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: account + port: + number: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml new file mode 100644 index 0000000..8d843f1 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: account + name: account +spec: + ports: + - name: "80" + port: 80 + - name: "433" + port: 433 + selector: + app: account diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml new file mode 100644 index 0000000..a4455c9 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: account +spec: + selector: + matchLabels: + app: account + template: + metadata: + labels: + app: account + spec: + containers: + - image: eventhub.account + imagePullPolicy: Never + name: account + ports: + - name: accounthttp + containerPort: 80 + - name: accounthttps + containerPort: 433 \ No newline at end of file diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 9073010..07155fd 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -7,16 +7,16 @@ "EventHub_Web": { "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*", - "RootUrl": "https://localhost:44308" + "RootUrl": "https://openeventhub.com" }, "EventHub_Blazor": { "ClientId": "EventHub_Blazor", - "RootUrl": "https://localhost:44307" + "RootUrl": "https://admin.openeventhub.com" }, "EventHub_Swagger": { "ClientId": "EventHub_Swagger", "ClientSecret": "1q2w3e*", - "RootUrl": "https://localhost:44362" + "RootUrl": "https://api.openeventhub.com" } } } diff --git a/src/EventHub.IdentityServer/Dockerfile b/src/EventHub.IdentityServer/Dockerfile new file mode 100644 index 0000000..20a0003 --- /dev/null +++ b/src/EventHub.IdentityServer/Dockerfile @@ -0,0 +1,4 @@ + FROM mcr.microsoft.com/dotnet/aspnet:5.0 + COPY bin/Release/net5.0/publish/ app/ + WORKDIR /app + ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"] \ No newline at end of file diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index 08898db..f10a1ee 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -139,6 +139,8 @@ namespace EventHub .AllowCredentials(); }); }); + + context.Services.AddSameSiteCookiePolicy(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -157,6 +159,8 @@ namespace EventHub { app.UseErrorPage(); } + + app.UseCookiePolicy(); app.UseCorrelationId(); app.UseVirtualFiles(); diff --git a/src/EventHub.IdentityServer/Program.cs b/src/EventHub.IdentityServer/Program.cs index ef4acd5..c65563b 100644 --- a/src/EventHub.IdentityServer/Program.cs +++ b/src/EventHub.IdentityServer/Program.cs @@ -20,9 +20,7 @@ namespace EventHub .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) -#if DEBUG .WriteTo.Async(c => c.Console()) -#endif .CreateLogger(); try diff --git a/src/EventHub.IdentityServer/SameSiteCookiesServiceCollectionExtensions.cs b/src/EventHub.IdentityServer/SameSiteCookiesServiceCollectionExtensions.cs new file mode 100644 index 0000000..3b0c754 --- /dev/null +++ b/src/EventHub.IdentityServer/SameSiteCookiesServiceCollectionExtensions.cs @@ -0,0 +1,70 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class SameSiteCookiesServiceCollectionExtensions + { + public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services) + { + services.Configure(options => + { + options.MinimumSameSitePolicy = SameSiteMode.Unspecified; + options.OnAppendCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + options.OnDeleteCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + }); + + return services; + } + + private static void CheckSameSite(HttpContext httpContext, CookieOptions options) + { + if (options.SameSite == SameSiteMode.None) + { + var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); + if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent)) + { + // For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1) + options.SameSite = SameSiteMode.Unspecified; + } + } + } + + private static bool DisallowsSameSiteNone(string userAgent) + { + // Cover all iOS based browsers here. This includes: + // - Safari on iOS 12 for iPhone, iPod Touch, iPad + // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad + // - Chrome on iOS 12 for iPhone, iPod Touch, iPad + // All of which are broken by SameSite=None, because they use the iOS networking stack + if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12")) + { + return true; + } + + // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes: + // - Safari on Mac OS X. + // This does not include: + // - Chrome on Mac OS X + // Because they do not use the Mac OS networking stack. + if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") && + userAgent.Contains("Version/") && userAgent.Contains("Safari")) + { + return true; + } + + // Cover Chrome 50-69, because some versions are broken by SameSite=None, + // and none in this range require it. + // Note: this covers some pre-Chromium Edge versions, + // but pre-Chromium Edge does not require SameSite=None. + if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6")) + { + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index c9e8b26..d4b0c6a 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -1,14 +1,14 @@ { "App": { - "SelfUrl": "https://localhost:44313", - "CorsOrigins": "https://*.EventHub.com,http://localhost:4200,https://localhost:44307,https://localhost:44362", - "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" + "SelfUrl": "https://account.openeventhub.com", + "CorsOrigins": "https://*.openeventhub.com,http://localhost:4200,https://localhost:44307,https://localhost:44362", + "RedirectAllowedUrls": "https://openeventhub.com,https://admin.openeventhub.com" }, "ConnectionStrings": { - "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "redis" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" From 72d7a4888a062273a79082e3648342ea10a3482f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Aug 2021 17:30:35 +0300 Subject: [PATCH 14/70] Added account & api services --- .../account/templates/account-ingress.yaml | 3 +- .../account/templates/account-service.yaml | 4 +- .../charts/account/templates/account.yaml | 2 +- .../helm-chart/eventhub/charts/api/Chart.yaml | 6 ++ .../charts/api/templates/api-ingress.yaml | 18 +++++ .../charts/api/templates/api-service.yaml | 14 ++++ .../eventhub/charts/api/templates/api.yaml | 22 ++++++ .../EventHubAdminHttpApiHostModule.cs | 1 + src/EventHub.Admin.HttpApi.Host/Program.cs | 2 - .../EventHub.DbMigrator.csproj | 4 ++ .../appsettings.Development.json | 5 ++ .../Web/EventHubExternalUrls.cs | 8 +-- src/EventHub.HttpApi.Host/Dockerfile | 4 ++ .../EventHubHttpApiHostModule.cs | 10 +++ src/EventHub.HttpApi.Host/Program.cs | 2 - ...eSiteCookiesServiceCollectionExtensions.cs | 70 +++++++++++++++++++ .../appsettings.Development.json | 12 ++++ src/EventHub.HttpApi.Host/appsettings.json | 6 +- .../EventHub.IdentityServer.csproj | 4 ++ .../EventHubIdentityServerModule.cs | 16 +++++ .../appsettings.Development.json | 8 ++- .../wwwroot/themes/eventhub/owl-edit.css | 6 +- .../wwwroot/themes/eventhub/style.css | 6 +- src/EventHub.Web/Program.cs | 2 - 24 files changed, 211 insertions(+), 24 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml create mode 100644 src/EventHub.DbMigrator/appsettings.Development.json create mode 100644 src/EventHub.HttpApi.Host/Dockerfile create mode 100644 src/EventHub.HttpApi.Host/SameSiteCookiesServiceCollectionExtensions.cs diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index 19ef867..2138aa0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -4,6 +4,7 @@ metadata: name: account-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: rules: - host: "account.openeventhub.com" @@ -15,4 +16,4 @@ spec: service: name: account port: - number: 443 \ No newline at end of file + number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml index 8d843f1..075e7d7 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml @@ -8,7 +8,7 @@ spec: ports: - name: "80" port: 80 - - name: "433" - port: 433 + - name: "443" + port: 443 selector: app: account diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml index a4455c9..e67dbcb 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -19,4 +19,4 @@ spec: - name: accounthttp containerPort: 80 - name: accounthttps - containerPort: 433 \ No newline at end of file + containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml new file mode 100644 index 0000000..fa75f5b --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: api +appVersion: "1.0" +description: EventHub API Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml new file mode 100644 index 0000000..efc2deb --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: api-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - host: "api.openeventhub.com" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: api + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml new file mode 100644 index 0000000..e4b7ee7 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: api + name: api +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + selector: + app: api diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml new file mode 100644 index 0000000..b5ad403 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: api +spec: + selector: + matchLabels: + app: api + template: + metadata: + labels: + app: api + spec: + containers: + - image: eventhub.api + imagePullPolicy: Never + name: api + ports: + - name: apihttp + containerPort: 80 + - name: apihttps + containerPort: 443 \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs b/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs index 38ff481..81a76bc 100644 --- a/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs +++ b/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs @@ -15,6 +15,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using StackExchange.Redis; using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; diff --git a/src/EventHub.Admin.HttpApi.Host/Program.cs b/src/EventHub.Admin.HttpApi.Host/Program.cs index fdb4ed3..076a07e 100644 --- a/src/EventHub.Admin.HttpApi.Host/Program.cs +++ b/src/EventHub.Admin.HttpApi.Host/Program.cs @@ -20,9 +20,7 @@ namespace EventHub.Admin .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) -#if DEBUG .WriteTo.Async(c => c.Console()) -#endif .CreateLogger(); try diff --git a/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj b/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj index 69154bc..ed41ba6 100644 --- a/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj +++ b/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj @@ -12,6 +12,10 @@ + + PreserveNewest + Always + PreserveNewest Always diff --git a/src/EventHub.DbMigrator/appsettings.Development.json b/src/EventHub.DbMigrator/appsettings.Development.json new file mode 100644 index 0000000..4ba93e6 --- /dev/null +++ b/src/EventHub.DbMigrator/appsettings.Development.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + } +} diff --git a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs b/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs index e6d8c7a..60ff0bd 100644 --- a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs +++ b/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs @@ -9,10 +9,10 @@ namespace EventHub.Web public const string EhWww = "https://localhost:44308"; #else // TODO: Change these production links - public const string EhAccount = "https://localhost:44313"; - public const string EhApi = "https://localhost:44362"; - public const string EhAdmin = "https://localhost:44307"; - public const string EhWww = "https://localhost:44308"; + public const string EhAccount = "https://account.openeventhub.com"; + public const string EhApi = "https://api.openeventhub.com"; + public const string EhAdmin = "https://admin.openeventhub.com"; + public const string EhWww = "https://openeventhub.com"; #endif } } \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Dockerfile b/src/EventHub.HttpApi.Host/Dockerfile new file mode 100644 index 0000000..b5bd5d9 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Dockerfile @@ -0,0 +1,4 @@ + FROM mcr.microsoft.com/dotnet/aspnet:5.0 + COPY bin/Release/net5.0/publish/ app/ + WORKDIR /app + ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"] \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs index 65b752f..5814887 100644 --- a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs +++ b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs @@ -170,6 +170,8 @@ namespace EventHub .AllowCredentials(); }); }); + + context.Services.AddSameSiteCookiePolicy(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -181,6 +183,12 @@ namespace EventHub { app.UseDeveloperExceptionPage(); } + + app.Use((context, next) => + { + context.Request.Scheme = "https"; + return next(); + }); var supportedCultures = new[] { @@ -204,6 +212,8 @@ namespace EventHub app.UseErrorPage(); } + app.UseCookiePolicy(); + app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); diff --git a/src/EventHub.HttpApi.Host/Program.cs b/src/EventHub.HttpApi.Host/Program.cs index 08c00d8..1bf31ea 100644 --- a/src/EventHub.HttpApi.Host/Program.cs +++ b/src/EventHub.HttpApi.Host/Program.cs @@ -20,9 +20,7 @@ namespace EventHub .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) -#if DEBUG .WriteTo.Async(c => c.Console()) -#endif .CreateLogger(); try diff --git a/src/EventHub.HttpApi.Host/SameSiteCookiesServiceCollectionExtensions.cs b/src/EventHub.HttpApi.Host/SameSiteCookiesServiceCollectionExtensions.cs new file mode 100644 index 0000000..3b0c754 --- /dev/null +++ b/src/EventHub.HttpApi.Host/SameSiteCookiesServiceCollectionExtensions.cs @@ -0,0 +1,70 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class SameSiteCookiesServiceCollectionExtensions + { + public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services) + { + services.Configure(options => + { + options.MinimumSameSitePolicy = SameSiteMode.Unspecified; + options.OnAppendCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + options.OnDeleteCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + }); + + return services; + } + + private static void CheckSameSite(HttpContext httpContext, CookieOptions options) + { + if (options.SameSite == SameSiteMode.None) + { + var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); + if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent)) + { + // For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1) + options.SameSite = SameSiteMode.Unspecified; + } + } + } + + private static bool DisallowsSameSiteNone(string userAgent) + { + // Cover all iOS based browsers here. This includes: + // - Safari on iOS 12 for iPhone, iPod Touch, iPad + // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad + // - Chrome on iOS 12 for iPhone, iPod Touch, iPad + // All of which are broken by SameSite=None, because they use the iOS networking stack + if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12")) + { + return true; + } + + // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes: + // - Safari on Mac OS X. + // This does not include: + // - Chrome on Mac OS X + // Because they do not use the Mac OS networking stack. + if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") && + userAgent.Contains("Version/") && userAgent.Contains("Safari")) + { + return true; + } + + // Cover Chrome 50-69, because some versions are broken by SameSite=None, + // and none in this range require it. + // Note: this covers some pre-Chromium Edge versions, + // but pre-Chromium Edge does not require SameSite=None. + if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6")) + { + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/appsettings.Development.json b/src/EventHub.HttpApi.Host/appsettings.Development.json index 2c63c08..1455394 100644 --- a/src/EventHub.HttpApi.Host/appsettings.Development.json +++ b/src/EventHub.HttpApi.Host/appsettings.Development.json @@ -1,2 +1,14 @@ { + "ConnectionStrings": { + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + }, + "Redis": { + "Configuration": "127.0.0.1" + }, + "AuthServer": { + "Authority": "https://localhost:44313", + "RequireHttpsMetadata": "true", + "SwaggerClientId": "EventHub_Swagger", + "SwaggerClientSecret": "1q2w3e*" + } } diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 7c2ab2d..e379370 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -3,13 +3,13 @@ "CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308" }, "ConnectionStrings": { - "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "redis" }, "AuthServer": { - "Authority": "https://localhost:44313", + "Authority": "https://account.openeventhub.com", "RequireHttpsMetadata": "true", "SwaggerClientId": "EventHub_Swagger", "SwaggerClientSecret": "1q2w3e*" diff --git a/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj b/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj index 8d54cd5..69b7785 100644 --- a/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj +++ b/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj @@ -20,6 +20,10 @@ + + + Always + diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index f10a1ee..44632cc 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using System.Security.Cryptography.X509Certificates; using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors; @@ -13,6 +14,7 @@ using EventHub.Web; using EventHub.Web.Theme; using EventHub.Web.Theme.Bundling; using IdentityServer4.Configuration; +using Microsoft.IdentityModel.Tokens; using StackExchange.Redis; using Volo.Abp; using Volo.Abp.Account; @@ -46,6 +48,14 @@ namespace EventHub { private const string DefaultCorsPolicyName = "Default"; + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(builder => + { + builder.AddSigningCredential(new X509Certificate2("localhost.pfx", "e8202f07-66e5-4619-be07-72ba76fde97f")); + }); + } + public override void ConfigureServices(ServiceConfigurationContext context) { var hostingEnvironment = context.Services.GetHostingEnvironment(); @@ -148,6 +158,12 @@ namespace EventHub var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + app.Use((context, next) => + { + context.Request.Scheme = "https"; + return next(); + }); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/src/EventHub.IdentityServer/appsettings.Development.json b/src/EventHub.IdentityServer/appsettings.Development.json index 2c63c08..de1a3cb 100644 --- a/src/EventHub.IdentityServer/appsettings.Development.json +++ b/src/EventHub.IdentityServer/appsettings.Development.json @@ -1,2 +1,8 @@ { -} + "ConnectionStrings": { + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + }, + "Redis": { + "Configuration": "localhost" + } +} \ No newline at end of file diff --git a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/owl-edit.css b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/owl-edit.css index 00d706f..8462a79 100644 --- a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/owl-edit.css +++ b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/owl-edit.css @@ -10,7 +10,7 @@ .main-slider .owl-carousel .owl-nav button.owl-next { width: 40px; height: 40px; - background: rgb(0 4 74 / 20%); + background: rgba(0, 4, 74, 0.2); transition: background-color .3s ease; position: absolute; display: inline-block; @@ -24,7 +24,7 @@ } .main-slider .owl-carousel .owl-nav button.owl-prev:hover, .main-slider .owl-carousel .owl-nav button.owl-next:hover { - background: rgb(255 255 255 / 35%); + background: rgba(255, 255, 255, 0.35); } .main-slider .owl-carousel .owl-nav button span { font-size: 40px; @@ -65,7 +65,7 @@ .card-slider .owl-carousel .owl-nav button.owl-next { width: 9px; height: 15px; - background: rgb(255 255 255 / 22%); + background: rgba(255, 255, 255, 0.22); transition: background-color .3s ease; display: inline-block; overflow: hidden; diff --git a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css index 6572a86..d65228b 100644 --- a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css +++ b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css @@ -754,7 +754,7 @@ div.checkbox.switcher label, div.radio.switcher label { margin-right: 10px; width: 56px; height: 30px; - background: rgb(107 126 146 / 20%); + background: rgba(107, 126, 146, 0.20); border: 3px solid #e1e5e9; border-radius: 50px; transition: all 0.3s ease-in-out; @@ -791,7 +791,7 @@ div.checkbox.switcher label, div.radio.switcher label { .image-area { - border: 2px dashed rgb(218 224 229); + border: 2px dashed rgb(218, 224, 229); padding: 1em; position: relative; border-radius: 10px; @@ -802,7 +802,7 @@ div.checkbox.switcher label, div.radio.switcher label { .image-area::before { content: 'Uploaded image result'; - color: rgb(218 224 229); + color: rgb(218, 224, 229); font-weight: bold; text-transform: uppercase; position: absolute; diff --git a/src/EventHub.Web/Program.cs b/src/EventHub.Web/Program.cs index 73d69bd..010a36d 100644 --- a/src/EventHub.Web/Program.cs +++ b/src/EventHub.Web/Program.cs @@ -20,9 +20,7 @@ namespace EventHub.Web .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) -#if DEBUG .WriteTo.Async(c => c.Console()) -#endif .CreateLogger(); try From 048c2cb1a8eac65d344edd7d5f18397afbb219bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Aug 2021 12:10:26 +0300 Subject: [PATCH 15/70] Added host names and updated the certificate code --- .../eventhub/charts/api/templates/api.yaml | 8 ++++- .../EventHubIdentityServerModule.cs | 35 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml index b5ad403..8a40a70 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -19,4 +19,10 @@ spec: - name: apihttp containerPort: 80 - name: apihttps - containerPort: 443 \ No newline at end of file + containerPort: 443 + hostAliases: + - ip: 10.105.172.183 + hostnames: + - "account.openeventhub.com" + - "openeventhub.com" + - "api.openeventhub.com" \ No newline at end of file diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index 44632cc..deac090 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -14,6 +14,8 @@ using EventHub.Web; using EventHub.Web.Theme; using EventHub.Web.Theme.Bundling; using IdentityServer4.Configuration; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; using Microsoft.IdentityModel.Tokens; using StackExchange.Redis; using Volo.Abp; @@ -28,6 +30,7 @@ using Volo.Abp.Autofac; using Volo.Abp.BackgroundJobs; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.IdentityServer; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation.Urls; @@ -50,10 +53,36 @@ namespace EventHub public override void PreConfigureServices(ServiceConfigurationContext context) { - PreConfigure(builder => + var hostingEnvironment = context.Services.GetHostingEnvironment(); + + if (!hostingEnvironment.IsDevelopment()) { - builder.AddSigningCredential(new X509Certificate2("localhost.pfx", "e8202f07-66e5-4619-be07-72ba76fde97f")); - }); + var configuration = context.Services.GetConfiguration(); + + PreConfigure(options => + { + options.AddDeveloperSigningCredential = false; + }); + + PreConfigure(builder => + { + builder.AddSigningCredential(GetSigningCertificate(hostingEnvironment, configuration)); + }); + } + } + + private X509Certificate2 GetSigningCertificate(IWebHostEnvironment hostingEnv, IConfiguration configuration) + { + var fileName = "localhost.pfx"; + var passPhrase = "e8202f07-66e5-4619-be07-72ba76fde97f"; + var file = Path.Combine(hostingEnv.ContentRootPath, fileName); + + if (!File.Exists(file)) + { + throw new FileNotFoundException($"Signing Certificate couldn't found: {file}"); + } + + return new X509Certificate2(file, passPhrase); } public override void ConfigureServices(ServiceConfigurationContext context) From c9a7dcf637f8be58c77bea9eed61772fcc614a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Aug 2021 16:15:18 +0300 Subject: [PATCH 16/70] Added tls files --- etc/k8s/cert/mycert | 20 +++++++++++++ etc/k8s/cert/mykey | 28 +++++++++++++++++++ .../account/templates/account-ingress.yaml | 4 +++ .../account/templates/account-tls-secret.yaml | 8 ++++++ .../EventHub.IdentityServer.csproj | 4 +-- .../EventHubIdentityServerModule.cs | 2 +- 6 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 etc/k8s/cert/mycert create mode 100644 etc/k8s/cert/mykey create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml diff --git a/etc/k8s/cert/mycert b/etc/k8s/cert/mycert new file mode 100644 index 0000000..ea1c9f2 --- /dev/null +++ b/etc/k8s/cert/mycert @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDTTCCAjWgAwIBAgIUe5LC99EQTptIB+sLthn/JsTcGVswDQYJKoZIhvcNAQEL +BQAwNjEhMB8GA1UEAwwYYWNjb3VudC5vcGVuZXZlbnRodWIuY29tMREwDwYDVQQK +DAhWb2xvc29mdDAeFw0yMTA4MDMxMjI5NTVaFw0yMjA4MDMxMjI5NTVaMDYxITAf +BgNVBAMMGGFjY291bnQub3BlbmV2ZW50aHViLmNvbTERMA8GA1UECgwIVm9sb3Nv +ZnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCn9FsH+Bzslj/5/JuY +n+ZPb8k8CtuvOL/qV6mmayefKUPQu1Vol6zr8nFINe7r4GGtE3CvTEmauZxnjRD0 +eGoJRjpO31Ha0y2KROZx9U4LaeLQ3voQOR3wKo/fsftWs1ovs8gsMy/Xzl1LpvX1 +IaaIYvlErjHdyPTm7hMLFKOGDjYXsiW8HOZztEuqL0U65nYEXQb/MzWDPuR25QdO +4dX1yF+UplBawIw5/qTvKbsXNbFvytd9iC8ldKjY1jjluNxuN26UHYegg6pQ7Azw +c4TnHhY9UXOgBQ21/r/UPCwJ710Vp3WrtreoV51bEYZYgB/EC5pdM9I7CEgyxbIw +0Q/TAgMBAAGjUzBRMB0GA1UdDgQWBBRfUCG2rNJCI+DjQfghPqaJUrMCnTAfBgNV +HSMEGDAWgBRfUCG2rNJCI+DjQfghPqaJUrMCnTAPBgNVHRMBAf8EBTADAQH/MA0G +CSqGSIb3DQEBCwUAA4IBAQBbggVKGY/S2p3cE8mDhHwAr4MK9pjsTwygYYJwgXEf +olr7SP8ZcaMLlsauysYr1yuxTGr6ttTkj0hrTcQhoDDAC+debeJ6eFiBhMZH+lQC +gRTi46gmdmPYuhhXHpeSmGVxjAPQP2wVisFIe9Tdq9xdtD+1demmjkSotK7gn3vD +EJaUUBn60uxqJshXj9aXZ49b9hgGpywg+e30kwtNUowDsLLLE72CGHyaDYdes0rn +URaZ+4DezoBbefopzM+zImBwnDPntcRlP7Zw292iPdQO8FR2OtPZvqj3zewGP6Mh +X92/fmLNQw/u3CsZ/zkhu5eQGaboZsuERkeJv1L+o7bD +-----END CERTIFICATE----- diff --git a/etc/k8s/cert/mykey b/etc/k8s/cert/mykey new file mode 100644 index 0000000..5a6fac1 --- /dev/null +++ b/etc/k8s/cert/mykey @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCn9FsH+Bzslj/5 +/JuYn+ZPb8k8CtuvOL/qV6mmayefKUPQu1Vol6zr8nFINe7r4GGtE3CvTEmauZxn +jRD0eGoJRjpO31Ha0y2KROZx9U4LaeLQ3voQOR3wKo/fsftWs1ovs8gsMy/Xzl1L +pvX1IaaIYvlErjHdyPTm7hMLFKOGDjYXsiW8HOZztEuqL0U65nYEXQb/MzWDPuR2 +5QdO4dX1yF+UplBawIw5/qTvKbsXNbFvytd9iC8ldKjY1jjluNxuN26UHYegg6pQ +7Azwc4TnHhY9UXOgBQ21/r/UPCwJ710Vp3WrtreoV51bEYZYgB/EC5pdM9I7CEgy +xbIw0Q/TAgMBAAECggEAV04TH9JenrD/sqAX9b9wxewy6+4tAil6wYMuId7jqr2V +jeRDYmotrjzJnCLE/oIV5BUN52G9hRtk7QMMRDhvzkBeQO+fKiPKMWzdaXF9TzuM +dszhqhs2r8hAH6TyJMB4agGHVUqKXSDdqFyyz+jdG1pvfr8aFtLGU2CAL6tb0Wur +3qpnlfGjy63dToHGs7vdSYE+EKTcl0JndzPfspzisCCd+tAqCFo9vjxYKH+UDS6I +3+GIAVpEUEf6zNtGtPTpOvKSAthm2z5lXiIpWNoHSfPhzU2W3Dz2i2PVdifjZghg +bvAvS06opR+Y7jViayFBDGU4Yc0w+kjd3xZ230uqSQKBgQDabAuBBMdchyGTpS4r +i86c9rIkUNXKyPCIVjbKyc0Ia7D/cDAkPfZhylr1FtLuvO5xYzVAN3swuAED2oR/ +bId3ENMIqI5oBbPyMzVVWHntdY26iDYKACjIt6xayBK++e4RJb6jP1gTJvHbv+k2 +aslFwU0IYsnmPIYn1SmQQoZG1wKBgQDE2ZIU4k73J2wrRKraiO/wCaxcj7LH8gyp +aSn3EPQmUR0A0QLHewNlcdcsiyiWOg0hv0VjbmbyOD8C+Oh8WvrHRg2mXL2tvRVn +sNh/zDDtlWovlnts6so0voUgfepOhCj0iE0MzPKe2ypFMDE2Wj4c9gFRDUVnDLwQ +FuFCencrZQKBgQDH9+MQW6+ppo22/qMmevjN+41cciVJYm3UZBoFzntIGlARjESG +6bOIFBryB9NVfuNOK+W0xRajo9JKFOT5RANBnsWWR7sYwR/dvcQ2PqpiHB2FiO7w +ePTdzkqdUk7XSToLuOKv0m5wGleTOD/q8hkTI8XCx67QetjX3vAOgtksQQKBgFEB +W4z+iBJLBcdUbZ6ahWpZALXiaGbBY5Z/cUZ7ko0GChJg8GzYYVBopWxuI5iWcPr3 +M/2z2+dHYB7AASPTaKmCWXGhbmjFi75s1trYUzYhq13D5iyu/eDwmeYCCt6eoh/m +yxY+bIUUmXN5XncIcdEHJwmMlYfPhMB2OeJadRnFAoGAFCvb0dkqbqnSVLQhcOCq +9DJyi6/EEyW8fqYWsikaoZOMhRpvoQzUjjU1jikxVEEvsEG60aNzYWKOHJDQlisK +CoeBW5fKKdYxOz/TylTsrw2qvXVrTNouXTRx0raWM1bvjQPYJcaEwhNScWqV4vVR +x8RUguBiUhxPoCr8x4J+FCs= +-----END PRIVATE KEY----- diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index 2138aa0..e97bb76 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -6,6 +6,10 @@ metadata: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: + tls: + - hosts: + - account.openeventhub.com + secretName: account-tls rules: - host: "account.openeventhub.com" http: diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml new file mode 100644 index 0000000..312e1ee --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +type: kubernetes.io/tls +kind: Secret +metadata: + name: account-tls +data: + tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUVENDQWpXZ0F3SUJBZ0lVZTVMQzk5RVFUcHRJQitzTHRobi9Kc1RjR1Zzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd05qRWhNQjhHQTFVRUF3d1lZV05qYjNWdWRDNXZjR1Z1WlhabGJuUm9kV0l1WTI5dE1SRXdEd1lEVlFRSwpEQWhXYjJ4dmMyOW1kREFlRncweU1UQTRNRE14TWpJNU5UVmFGdzB5TWpBNE1ETXhNakk1TlRWYU1EWXhJVEFmCkJnTlZCQU1NR0dGalkyOTFiblF1YjNCbGJtVjJaVzUwYUhWaUxtTnZiVEVSTUE4R0ExVUVDZ3dJVm05c2IzTnYKWm5Rd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUNuOUZzSCtCenNsai81L0p1WQpuK1pQYjhrOEN0dXZPTC9xVjZtbWF5ZWZLVVBRdTFWb2w2enI4bkZJTmU3cjRHR3RFM0N2VEVtYXVaeG5qUkQwCmVHb0pSanBPMzFIYTB5MktST1p4OVU0TGFlTFEzdm9RT1Izd0tvL2ZzZnRXczFvdnM4Z3NNeS9YemwxTHB2WDEKSWFhSVl2bEVyakhkeVBUbTdoTUxGS09HRGpZWHNpVzhIT1p6dEV1cUwwVTY1bllFWFFiL016V0RQdVIyNVFkTwo0ZFgxeUYrVXBsQmF3SXc1L3FUdktic1hOYkZ2eXRkOWlDOGxkS2pZMWpqbHVOeHVOMjZVSFllZ2c2cFE3QXp3CmM0VG5IaFk5VVhPZ0JRMjEvci9VUEN3SjcxMFZwM1dydHJlb1Y1MWJFWVpZZ0IvRUM1cGRNOUk3Q0VneXhiSXcKMFEvVEFnTUJBQUdqVXpCUk1CMEdBMVVkRGdRV0JCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFmQmdOVgpIU01FR0RBV2dCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQTBHCkNTcUdTSWIzRFFFQkN3VUFBNElCQVFCYmdnVktHWS9TMnAzY0U4bURoSHdBcjRNSzlwanNUd3lnWVlKd2dYRWYKb2xyN1NQOFpjYU1MbHNhdXlzWXIxeXV4VEdyNnR0VGtqMGhyVGNRaG9EREFDK2RlYmVKNmVGaUJoTVpIK2xRQwpnUlRpNDZnbWRtUFl1aGhYSHBlU21HVnhqQVBRUDJ3VmlzRkllOVRkcTl4ZHREKzFkZW1tamtTb3RLN2duM3ZECkVKYVVVQm42MHV4cUpzaFhqOWFYWjQ5YjloZ0dweXdnK2UzMGt3dE5Vb3dEc0xMTEU3MkNHSHlhRFlkZXMwcm4KVVJhWis0RGV6b0JiZWZvcHpNK3pJbUJ3bkRQbnRjUmxQN1p3MjkyaVBkUU84RlIyT3RQWnZxajN6ZXdHUDZNaApYOTIvZm1MTlF3L3UzQ3NaL3praHU1ZVFHYWJvWnN1RVJrZUp2MUwrbzdiRAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== + tls.key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQ245RnNIK0J6c2xqLzUKL0p1WW4rWlBiOGs4Q3R1dk9ML3FWNm1tYXllZktVUFF1MVZvbDZ6cjhuRklOZTdyNEdHdEUzQ3ZURW1hdVp4bgpqUkQwZUdvSlJqcE8zMUhhMHkyS1JPWng5VTRMYWVMUTN2b1FPUjN3S28vZnNmdFdzMW92czhnc015L1h6bDFMCnB2WDFJYWFJWXZsRXJqSGR5UFRtN2hNTEZLT0dEallYc2lXOEhPWnp0RXVxTDBVNjVuWUVYUWIvTXpXRFB1UjIKNVFkTzRkWDF5RitVcGxCYXdJdzUvcVR2S2JzWE5iRnZ5dGQ5aUM4bGRLalkxampsdU54dU4yNlVIWWVnZzZwUQo3QXp3YzRUbkhoWTlVWE9nQlEyMS9yL1VQQ3dKNzEwVnAzV3J0cmVvVjUxYkVZWllnQi9FQzVwZE05STdDRWd5CnhiSXcwUS9UQWdNQkFBRUNnZ0VBVjA0VEg5SmVuckQvc3FBWDliOXd4ZXd5Nis0dEFpbDZ3WU11SWQ3anFyMlYKamVSRFltb3RyanpKbkNMRS9vSVY1QlVONTJHOWhSdGs3UU1NUkRodnprQmVRTytmS2lQS01XemRhWEY5VHp1TQpkc3pocWhzMnI4aEFINlR5Sk1CNGFnR0hWVXFLWFNEZHFGeXl6K2pkRzFwdmZyOGFGdExHVTJDQUw2dGIwV3VyCjNxcG5sZkdqeTYzZFRvSEdzN3ZkU1lFK0VLVGNsMEpuZHpQZnNwemlzQ0NkK3RBcUNGbzl2anhZS0grVURTNkkKMytHSUFWcEVVRWY2ek50R3RQVHBPdktTQXRobTJ6NWxYaUlwV05vSFNmUGh6VTJXM0R6MmkyUFZkaWZqWmdoZwpidkF2UzA2b3BSK1k3alZpYXlGQkRHVTRZYzB3K2tqZDN4WjIzMHVxU1FLQmdRRGFiQXVCQk1kY2h5R1RwUzRyCmk4NmM5cklrVU5YS3lQQ0lWamJLeWMwSWE3RC9jREFrUGZaaHlscjFGdEx1dk81eFl6VkFOM3N3dUFFRDJvUi8KYklkM0VOTUlxSTVvQmJQeU16VlZXSG50ZFkyNmlEWUtBQ2pJdDZ4YXlCSysrZTRSSmI2alAxZ1RKdkhiditrMgphc2xGd1UwSVlzbm1QSVluMVNtUVFvWkcxd0tCZ1FERTJaSVU0azczSjJ3clJLcmFpTy93Q2F4Y2o3TEg4Z3lwCmFTbjNFUFFtVVIwQTBRTEhld05sY2Rjc2l5aVdPZzBodjBWamJtYnlPRDhDK09oOFd2ckhSZzJtWEwydHZSVm4Kc05oL3pERHRsV292bG50czZzbzB2b1VnZmVwT2hDajBpRTBNelBLZTJ5cEZNREUyV2o0YzlnRlJEVVZuREx3UQpGdUZDZW5jclpRS0JnUURIOStNUVc2K3BwbzIyL3FNbWV2ak4rNDFjY2lWSlltM1VaQm9Gem50SUdsQVJqRVNHCjZiT0lGQnJ5QjlOVmZ1Tk9LK1cweFJham85SktGT1Q1UkFOQm5zV1dSN3NZd1IvZHZjUTJQcXBpSEIyRmlPN3cKZVBUZHprcWRVazdYU1RvTHVPS3YwbTV3R2xlVE9EL3E4aGtUSThYQ3g2N1FldGpYM3ZBT2d0a3NRUUtCZ0ZFQgpXNHoraUJKTEJjZFViWjZhaFdwWkFMWGlhR2JCWTVaL2NVWjdrbzBHQ2hKZzhHellZVkJvcFd4dUk1aVdjUHIzCk0vMnoyK2RIWUI3QUFTUFRhS21DV1hHaGJtakZpNzVzMXRyWVV6WWhxMTNENWl5dS9lRHdtZVlDQ3Q2ZW9oL20KeXhZK2JJVVVtWE41WG5jSWNkRUhKd21NbFlmUGhNQjJPZUphZFJuRkFvR0FGQ3ZiMGRrcWJxblNWTFFoY09DcQo5REp5aTYvRUV5VzhmcVlXc2lrYW9aT01oUnB2b1F6VWpqVTFqaWt4VkVFdnNFRzYwYU56WVdLT0hKRFFsaXNLCkNvZUJXNWZLS2RZeE96L1R5bFRzcncycXZYVnJUTm91WFRSeDByYVdNMWJ2alFQWUpjYUV3aE5TY1dxVjR2VlIKeDhSVWd1QmlVaHhQb0NyOHg0SitGQ3M9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K diff --git a/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj b/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj index 69b7785..7875836 100644 --- a/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj +++ b/src/EventHub.IdentityServer/EventHub.IdentityServer.csproj @@ -20,8 +20,8 @@ - - + + Always diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index deac090..f35016c 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -73,7 +73,7 @@ namespace EventHub private X509Certificate2 GetSigningCertificate(IWebHostEnvironment hostingEnv, IConfiguration configuration) { - var fileName = "localhost.pfx"; + var fileName = "EventHub.IdentityServer.pfx"; var passPhrase = "e8202f07-66e5-4619-be07-72ba76fde97f"; var file = Path.Combine(hostingEnv.ContentRootPath, fileName); From 03fca4517e15f24897e58f5ae29db8a3c59cad90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Aug 2021 16:26:53 +0300 Subject: [PATCH 17/70] Create cert-key.txt --- etc/k8s/cert/cert-key.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 etc/k8s/cert/cert-key.txt diff --git a/etc/k8s/cert/cert-key.txt b/etc/k8s/cert/cert-key.txt new file mode 100644 index 0000000..30ed096 --- /dev/null +++ b/etc/k8s/cert/cert-key.txt @@ -0,0 +1 @@ +a8202f07-66e5-4619-be07-72ba76fde97f \ No newline at end of file From d87fa068bd0be0c482e356022ef735e508127518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 4 Aug 2021 13:40:26 +0300 Subject: [PATCH 18/70] Used release name in helm templates --- .../account/templates/account-ingress.yaml | 10 ++++---- .../account/templates/account-service.yaml | 6 ++--- .../account/templates/account-tls-secret.yaml | 2 +- .../charts/account/templates/account.yaml | 12 +++++----- .../eventhub/charts/account/values.yaml | 3 +++ .../charts/api/templates/api-ingress.yaml | 6 ++--- .../charts/api/templates/api-service.yaml | 6 ++--- .../eventhub/charts/api/templates/api.yaml | 20 ++++++---------- .../eventhub/charts/api/values.yaml | 3 +++ .../charts/dbmigrator/templates/migrator.yaml | 4 ++-- .../eventhub/charts/dbmigrator/values.yaml | 3 +++ .../eventhub/charts/postgresql/Chart.yaml | 2 +- .../templates/postgresql-service.yaml | 6 ++--- .../postgresql/templates/postgresql.yaml | 8 +++---- .../charts/redis/templates/redis-service.yaml | 6 ++--- .../charts/redis/templates/redis.yaml | 15 ++++-------- .../helm-chart/eventhub/charts/www/Chart.yaml | 6 +++++ .../charts/www/templates/www-ingress.yaml | 23 +++++++++++++++++++ .../charts/www/templates/www-service.yaml | 14 +++++++++++ .../eventhub/charts/www/templates/www.yaml | 22 ++++++++++++++++++ .../eventhub/charts/www/values.yaml | 3 +++ etc/k8s/helm-chart/eventhub/values.yaml | 3 +++ src/EventHub.DbMigrator/appsettings.json | 8 +++---- src/EventHub.HttpApi.Host/appsettings.json | 10 ++++---- .../EventHubIdentityServerModule.cs | 2 ++ src/EventHub.IdentityServer/appsettings.json | 10 ++++---- src/EventHub.Web/Dockerfile | 4 ++++ src/EventHub.Web/EventHubWebModule.cs | 13 +++++++++++ src/EventHub.Web/Program.cs | 1 + src/EventHub.Web/appsettings.json | 10 ++++---- 30 files changed, 165 insertions(+), 76 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/values.yaml create mode 100644 src/EventHub.Web/Dockerfile diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index e97bb76..a678100 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -1,23 +1,23 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: account-ingress + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: tls: - hosts: - - account.openeventhub.com - secretName: account-tls + - {{ .Values.accountUrl }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - - host: "account.openeventhub.com" + - host: "{{ .Values.accountUrl }}" http: paths: - path: / pathType: Prefix backend: service: - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} port: number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml index 075e7d7..ee157c0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: account - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: ports: - name: "80" @@ -11,4 +11,4 @@ spec: - name: "443" port: 443 selector: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml index 312e1ee..b03c72e 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 type: kubernetes.io/tls kind: Secret metadata: - name: account-tls + name: {{ .Release.Name }}-{{ .Chart.Name }}-tls data: tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUVENDQWpXZ0F3SUJBZ0lVZTVMQzk5RVFUcHRJQitzTHRobi9Kc1RjR1Zzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd05qRWhNQjhHQTFVRUF3d1lZV05qYjNWdWRDNXZjR1Z1WlhabGJuUm9kV0l1WTI5dE1SRXdEd1lEVlFRSwpEQWhXYjJ4dmMyOW1kREFlRncweU1UQTRNRE14TWpJNU5UVmFGdzB5TWpBNE1ETXhNakk1TlRWYU1EWXhJVEFmCkJnTlZCQU1NR0dGalkyOTFiblF1YjNCbGJtVjJaVzUwYUhWaUxtTnZiVEVSTUE4R0ExVUVDZ3dJVm05c2IzTnYKWm5Rd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUNuOUZzSCtCenNsai81L0p1WQpuK1pQYjhrOEN0dXZPTC9xVjZtbWF5ZWZLVVBRdTFWb2w2enI4bkZJTmU3cjRHR3RFM0N2VEVtYXVaeG5qUkQwCmVHb0pSanBPMzFIYTB5MktST1p4OVU0TGFlTFEzdm9RT1Izd0tvL2ZzZnRXczFvdnM4Z3NNeS9YemwxTHB2WDEKSWFhSVl2bEVyakhkeVBUbTdoTUxGS09HRGpZWHNpVzhIT1p6dEV1cUwwVTY1bllFWFFiL016V0RQdVIyNVFkTwo0ZFgxeUYrVXBsQmF3SXc1L3FUdktic1hOYkZ2eXRkOWlDOGxkS2pZMWpqbHVOeHVOMjZVSFllZ2c2cFE3QXp3CmM0VG5IaFk5VVhPZ0JRMjEvci9VUEN3SjcxMFZwM1dydHJlb1Y1MWJFWVpZZ0IvRUM1cGRNOUk3Q0VneXhiSXcKMFEvVEFnTUJBQUdqVXpCUk1CMEdBMVVkRGdRV0JCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFmQmdOVgpIU01FR0RBV2dCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQTBHCkNTcUdTSWIzRFFFQkN3VUFBNElCQVFCYmdnVktHWS9TMnAzY0U4bURoSHdBcjRNSzlwanNUd3lnWVlKd2dYRWYKb2xyN1NQOFpjYU1MbHNhdXlzWXIxeXV4VEdyNnR0VGtqMGhyVGNRaG9EREFDK2RlYmVKNmVGaUJoTVpIK2xRQwpnUlRpNDZnbWRtUFl1aGhYSHBlU21HVnhqQVBRUDJ3VmlzRkllOVRkcTl4ZHREKzFkZW1tamtTb3RLN2duM3ZECkVKYVVVQm42MHV4cUpzaFhqOWFYWjQ5YjloZ0dweXdnK2UzMGt3dE5Vb3dEc0xMTEU3MkNHSHlhRFlkZXMwcm4KVVJhWis0RGV6b0JiZWZvcHpNK3pJbUJ3bkRQbnRjUmxQN1p3MjkyaVBkUU84RlIyT3RQWnZxajN6ZXdHUDZNaApYOTIvZm1MTlF3L3UzQ3NaL3praHU1ZVFHYWJvWnN1RVJrZUp2MUwrbzdiRAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== tls.key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQ245RnNIK0J6c2xqLzUKL0p1WW4rWlBiOGs4Q3R1dk9ML3FWNm1tYXllZktVUFF1MVZvbDZ6cjhuRklOZTdyNEdHdEUzQ3ZURW1hdVp4bgpqUkQwZUdvSlJqcE8zMUhhMHkyS1JPWng5VTRMYWVMUTN2b1FPUjN3S28vZnNmdFdzMW92czhnc015L1h6bDFMCnB2WDFJYWFJWXZsRXJqSGR5UFRtN2hNTEZLT0dEallYc2lXOEhPWnp0RXVxTDBVNjVuWUVYUWIvTXpXRFB1UjIKNVFkTzRkWDF5RitVcGxCYXdJdzUvcVR2S2JzWE5iRnZ5dGQ5aUM4bGRLalkxampsdU54dU4yNlVIWWVnZzZwUQo3QXp3YzRUbkhoWTlVWE9nQlEyMS9yL1VQQ3dKNzEwVnAzV3J0cmVvVjUxYkVZWllnQi9FQzVwZE05STdDRWd5CnhiSXcwUS9UQWdNQkFBRUNnZ0VBVjA0VEg5SmVuckQvc3FBWDliOXd4ZXd5Nis0dEFpbDZ3WU11SWQ3anFyMlYKamVSRFltb3RyanpKbkNMRS9vSVY1QlVONTJHOWhSdGs3UU1NUkRodnprQmVRTytmS2lQS01XemRhWEY5VHp1TQpkc3pocWhzMnI4aEFINlR5Sk1CNGFnR0hWVXFLWFNEZHFGeXl6K2pkRzFwdmZyOGFGdExHVTJDQUw2dGIwV3VyCjNxcG5sZkdqeTYzZFRvSEdzN3ZkU1lFK0VLVGNsMEpuZHpQZnNwemlzQ0NkK3RBcUNGbzl2anhZS0grVURTNkkKMytHSUFWcEVVRWY2ek50R3RQVHBPdktTQXRobTJ6NWxYaUlwV05vSFNmUGh6VTJXM0R6MmkyUFZkaWZqWmdoZwpidkF2UzA2b3BSK1k3alZpYXlGQkRHVTRZYzB3K2tqZDN4WjIzMHVxU1FLQmdRRGFiQXVCQk1kY2h5R1RwUzRyCmk4NmM5cklrVU5YS3lQQ0lWamJLeWMwSWE3RC9jREFrUGZaaHlscjFGdEx1dk81eFl6VkFOM3N3dUFFRDJvUi8KYklkM0VOTUlxSTVvQmJQeU16VlZXSG50ZFkyNmlEWUtBQ2pJdDZ4YXlCSysrZTRSSmI2alAxZ1RKdkhiditrMgphc2xGd1UwSVlzbm1QSVluMVNtUVFvWkcxd0tCZ1FERTJaSVU0azczSjJ3clJLcmFpTy93Q2F4Y2o3TEg4Z3lwCmFTbjNFUFFtVVIwQTBRTEhld05sY2Rjc2l5aVdPZzBodjBWamJtYnlPRDhDK09oOFd2ckhSZzJtWEwydHZSVm4Kc05oL3pERHRsV292bG50czZzbzB2b1VnZmVwT2hDajBpRTBNelBLZTJ5cEZNREUyV2o0YzlnRlJEVVZuREx3UQpGdUZDZW5jclpRS0JnUURIOStNUVc2K3BwbzIyL3FNbWV2ak4rNDFjY2lWSlltM1VaQm9Gem50SUdsQVJqRVNHCjZiT0lGQnJ5QjlOVmZ1Tk9LK1cweFJham85SktGT1Q1UkFOQm5zV1dSN3NZd1IvZHZjUTJQcXBpSEIyRmlPN3cKZVBUZHprcWRVazdYU1RvTHVPS3YwbTV3R2xlVE9EL3E4aGtUSThYQ3g2N1FldGpYM3ZBT2d0a3NRUUtCZ0ZFQgpXNHoraUJKTEJjZFViWjZhaFdwWkFMWGlhR2JCWTVaL2NVWjdrbzBHQ2hKZzhHellZVkJvcFd4dUk1aVdjUHIzCk0vMnoyK2RIWUI3QUFTUFRhS21DV1hHaGJtakZpNzVzMXRyWVV6WWhxMTNENWl5dS9lRHdtZVlDQ3Q2ZW9oL20KeXhZK2JJVVVtWE41WG5jSWNkRUhKd21NbFlmUGhNQjJPZUphZFJuRkFvR0FGQ3ZiMGRrcWJxblNWTFFoY09DcQo5REp5aTYvRUV5VzhmcVlXc2lrYW9aT01oUnB2b1F6VWpqVTFqaWt4VkVFdnNFRzYwYU56WVdLT0hKRFFsaXNLCkNvZUJXNWZLS2RZeE96L1R5bFRzcncycXZYVnJUTm91WFRSeDByYVdNMWJ2alFQWUpjYUV3aE5TY1dxVjR2VlIKeDhSVWd1QmlVaHhQb0NyOHg0SitGQ3M9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml index e67dbcb..171f8de 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -1,22 +1,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: selector: matchLabels: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: eventhub.account imagePullPolicy: Never - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - - name: accounthttp + - name: http containerPort: 80 - - name: accounthttps + - name: https containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml index efc2deb..18cbfe3 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -1,18 +1,18 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: api-ingress + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: - - host: "api.openeventhub.com" + - host: "{{ .Values.apiUrl }}" http: paths: - path: / pathType: Prefix backend: service: - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} port: number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml index e4b7ee7..ee157c0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: api - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: ports: - name: "80" @@ -11,4 +11,4 @@ spec: - name: "443" port: 443 selector: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml index 8a40a70..8602009 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -1,28 +1,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: selector: matchLabels: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: eventhub.api imagePullPolicy: Never - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - - name: apihttp + - name: http containerPort: 80 - - name: apihttps - containerPort: 443 - hostAliases: - - ip: 10.105.172.183 - hostnames: - - "account.openeventhub.com" - - "openeventhub.com" - - "api.openeventhub.com" \ No newline at end of file + - name: https + containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml index 18f6233..e77b1c5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -1,13 +1,13 @@ apiVersion: batch/v1 kind: Job metadata: - name: migrator + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: activeDeadlineSeconds: 100 template: spec: containers: - - name: migrator + - name: {{ .Release.Name }}-{{ .Chart.Name }} image: eventhubmigrator imagePullPolicy: Never restartPolicy: Never diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml index 49bbcd8..ce984f6 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: database +name: postgresql appVersion: "1.0" description: Runs PostgreSQL Instance version: 1.0.0 diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml index c4fa04a..2b0ce51 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: postgresql - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: type: LoadBalancer ports: @@ -11,5 +11,5 @@ spec: port: 5435 targetPort: 5432 selector: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml index fd6e1e0..b967635 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml @@ -1,20 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: replicas: 1 selector: matchLabels: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: postgres - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - name: postgresql containerPort: 5432 diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml index 5c2d9ef..de91146 100644 --- a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: redis - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: type: ClusterIP ports: @@ -11,5 +11,5 @@ spec: port: 6379 targetPort: 6379 selector: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml index 22e1f51..2ba176d 100644 --- a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml @@ -1,25 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: replicas: 1 selector: matchLabels: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: redis:6.0.10-alpine - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - name: redis - containerPort: 6379 - env: - - name: POSTGRES_USER - value: "root" - - name: POSTGRES_PASSWORD - value: "root" \ No newline at end of file + containerPort: 6379 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml new file mode 100644 index 0000000..319d808 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: www +appVersion: "1.0" +description: EventHub WWW Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml new file mode 100644 index 0000000..3b237eb --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" +spec: + tls: + - hosts: + - {{ .Values.wwwUrl }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls + rules: + - host: "{{ .Values.wwwUrl }}" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml new file mode 100644 index 0000000..ee157c0 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml new file mode 100644 index 0000000..08ad03b --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: eventhub.www + imagePullPolicy: Never + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index e69de29..d44ed88 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 07155fd..c8f7067 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,22 +1,22 @@ { "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "IdentityServer": { "Clients": { "EventHub_Web": { "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*", - "RootUrl": "https://openeventhub.com" + "RootUrl": "https://eh-st-www" }, "EventHub_Blazor": { "ClientId": "EventHub_Blazor", - "RootUrl": "https://admin.openeventhub.com" + "RootUrl": "https://eh-st-admin" }, "EventHub_Swagger": { "ClientId": "EventHub_Swagger", "ClientSecret": "1q2w3e*", - "RootUrl": "https://api.openeventhub.com" + "RootUrl": "https://eh-st-api" } } } diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index e379370..0548fb9 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -1,16 +1,16 @@ { "App": { - "CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308" + "CorsOrigins": "https://eh-st-www,eh-st-admin" }, "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "redis" + "Configuration": "eh-st-redis" }, "AuthServer": { - "Authority": "https://account.openeventhub.com", - "RequireHttpsMetadata": "true", + "Authority": "http://eh-st-account", + "RequireHttpsMetadata": "false", "SwaggerClientId": "EventHub_Swagger", "SwaggerClientSecret": "1q2w3e*" }, diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index f35016c..15b82d9 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -187,11 +187,13 @@ namespace EventHub var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + /* app.Use((context, next) => { context.Request.Scheme = "https"; return next(); }); + */ if (env.IsDevelopment()) { diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index d4b0c6a..f361f09 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -1,14 +1,14 @@ { "App": { - "SelfUrl": "https://account.openeventhub.com", - "CorsOrigins": "https://*.openeventhub.com,http://localhost:4200,https://localhost:44307,https://localhost:44362", - "RedirectAllowedUrls": "https://openeventhub.com,https://admin.openeventhub.com" + "SelfUrl": "https://eh-st-account", + "CorsOrigins": "https://eh-st-www,https://eh-st-api,https://localhost:44307,https://localhost:44362", + "RedirectAllowedUrls": "https://eh-st-api,https://eh-st-www,http://eh-st-api,http://eh-st-www" }, "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "redis" + "Configuration": "eh-st-redis" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.Web/Dockerfile b/src/EventHub.Web/Dockerfile new file mode 100644 index 0000000..ab31322 --- /dev/null +++ b/src/EventHub.Web/Dockerfile @@ -0,0 +1,4 @@ + FROM mcr.microsoft.com/dotnet/aspnet:5.0 + COPY bin/Release/net5.0/publish/ app/ + WORKDIR /app + ENTRYPOINT ["dotnet", "EventHub.Web.dll"] \ No newline at end of file diff --git a/src/EventHub.Web/EventHubWebModule.cs b/src/EventHub.Web/EventHubWebModule.cs index 473c746..3f5a04e 100644 --- a/src/EventHub.Web/EventHubWebModule.cs +++ b/src/EventHub.Web/EventHubWebModule.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; @@ -150,6 +151,12 @@ namespace EventHub.Web options.Scope.Add("email"); options.Scope.Add("phone"); options.Scope.Add("EventHub"); + + options.Events.OnRedirectToIdentityProvider = redirectContext => + { + redirectContext.ProtocolMessage.RedirectUri = $"{configuration["App:SelfUrl"]}/signin-oidc"; + return Task.CompletedTask; + }; }); } @@ -214,6 +221,12 @@ namespace EventHub.Web { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + + app.Use((context, next) => + { + context.Request.Scheme = "https"; + return next(); + }); if (env.IsDevelopment()) { diff --git a/src/EventHub.Web/Program.cs b/src/EventHub.Web/Program.cs index 010a36d..bb1f758 100644 --- a/src/EventHub.Web/Program.cs +++ b/src/EventHub.Web/Program.cs @@ -45,6 +45,7 @@ namespace EventHub.Web .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); + //webBuilder.UseUrls("http://localhost:80", "https://localhost:443"); }) .UseAutofac() .UseSerilog(); diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json index 2d20ae9..830df47 100644 --- a/src/EventHub.Web/appsettings.json +++ b/src/EventHub.Web/appsettings.json @@ -1,18 +1,18 @@ { "App": { - "SelfUrl": "https://localhost:44308" + "SelfUrl": "https://eh-st-www" }, "RemoteServices": { "Default": { - "BaseUrl": "https://localhost:44362/" + "BaseUrl": "http://eh-st-api/" } }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "eh-st-redis" }, "AuthServer": { - "Authority": "https://localhost:44313", - "RequireHttpsMetadata": "true", + "Authority": "http://eh-st-account", + "RequireHttpsMetadata": "false", "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*" }, From 5ba880494b9c3715d2042343aca42238747f46eb Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Wed, 4 Aug 2021 13:41:23 +0300 Subject: [PATCH 19/70] refactor(Admin.Application): reduce code duplication --- .../Organizations/OrganizationAppService.cs | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs index 9551782..df3794c 100644 --- a/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs +++ b/src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs @@ -75,15 +75,7 @@ namespace EventHub.Admin.Organizations { var organization = await _organizationRepository.GetAsync(id); - var dto = ObjectMapper.Map(organization); - - var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); - dto.OwnerUserName = user.UserName; - dto.OwnerEmail = user.Email; - - dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); - - return dto; + return await CreateOrganizationProfileDto(organization); } public async Task GetByNameAsync(string name) @@ -95,15 +87,7 @@ namespace EventHub.Admin.Organizations .WithData("OrganizationName", name); } - var dto = ObjectMapper.Map(organization); - - var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); - dto.OwnerUserName = user.UserName; - dto.OwnerEmail = user.Email; - - dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); - - return dto; + return await CreateOrganizationProfileDto(organization); } [Authorize(EventHubPermissions.Organizations.Update)] @@ -140,6 +124,18 @@ namespace EventHub.Admin.Organizations { await _organizationRepository.DeleteAsync(id); } + + private async Task CreateOrganizationProfileDto(Organization organization) + { + var dto = ObjectMapper.Map(organization); + + var user = await _identityUserRepository.GetAsync(organization.OwnerUserId); + dto.OwnerUserName = user.UserName; + dto.OwnerEmail = user.Email; + + dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id); + return dto; + } private async Task GetCoverImageAsync(Guid id) { From f362813af947135dd10c18662673f8d49e0b3e78 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Wed, 4 Aug 2021 13:42:39 +0300 Subject: [PATCH 20/70] chore(Admin.HttpApi.Host): add remote service name and change base route for controllers --- .../EventHubAdminRemoteServiceConsts.cs | 7 +++++++ .../Memberships/OrganizationMembershipController.cs | 4 +++- .../Controllers/Organizations/OrganizationController.cs | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs diff --git a/src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs b/src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs new file mode 100644 index 0000000..8a9b68b --- /dev/null +++ b/src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs @@ -0,0 +1,7 @@ +namespace EventHub.Admin +{ + public static class EventHubAdminRemoteServiceConsts + { + public const string RemoteServiceName = "EventHubAdmin"; + } +} \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs index 0dbc4cb..f10d811 100644 --- a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs @@ -1,15 +1,17 @@ using System.Threading.Tasks; using EventHub.Admin.Organizations.Memberships; using Microsoft.AspNetCore.Mvc; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc; namespace EventHub.Admin.Controllers.Organizations.Memberships { + [RemoteService(Name = EventHubAdminRemoteServiceConsts.RemoteServiceName)] [Controller] [Area("eventhub-admin")] [ControllerName("OrganizationMembership")] - [Route("/api/eventhub/organization-memberships")] + [Route("/api/eventhub/admin/organization-membership")] public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService { private readonly IOrganizationMembershipAppService _organizationMembershipAppService; diff --git a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs index 50a6c07..82fd290 100644 --- a/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs +++ b/src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs @@ -2,15 +2,17 @@ using System; using System.Threading.Tasks; using EventHub.Admin.Organizations; using Microsoft.AspNetCore.Mvc; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc; namespace EventHub.Admin.Controllers.Organizations { + [RemoteService(Name = EventHubAdminRemoteServiceConsts.RemoteServiceName)] [Controller] [Area("eventhub-admin")] [ControllerName("Organization")] - [Route("/api/eventhub/organizations")] + [Route("/api/eventhub/admin/organization")] public class OrganizationController : AbpController, IOrganizationAppService { private readonly IOrganizationAppService _organizationAppService; From e8f8e3cdeab5ad0ccae60eaf078c75dcd9b30385 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Wed, 4 Aug 2021 13:44:40 +0300 Subject: [PATCH 21/70] =?UTF-8?q?chore(HttpApi.Host):=20=C4=B0mplement=20c?= =?UTF-8?q?ontrollers=20manually?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and discard conventional auto controllers --- .../EventHubRemoteServiceConsts.cs | 7 ++ .../Controllers/Events/EventController.cs | 79 +++++++++++++++++++ .../EventRegistrationController.cs | 58 ++++++++++++++ .../OrganizationMembershipController.cs | 52 ++++++++++++ .../Organizations/OrganizationController.cs | 64 +++++++++++++++ .../Controllers/Users/UserController.cs | 30 +++++++ .../EventHubHttpApiHostModule.cs | 9 --- 7 files changed, 290 insertions(+), 9 deletions(-) create mode 100644 src/EventHub.Application.Contracts/EventHubRemoteServiceConsts.cs create mode 100644 src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs create mode 100644 src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs create mode 100644 src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs create mode 100644 src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs create mode 100644 src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs diff --git a/src/EventHub.Application.Contracts/EventHubRemoteServiceConsts.cs b/src/EventHub.Application.Contracts/EventHubRemoteServiceConsts.cs new file mode 100644 index 0000000..b46795f --- /dev/null +++ b/src/EventHub.Application.Contracts/EventHubRemoteServiceConsts.cs @@ -0,0 +1,7 @@ +namespace EventHub +{ + public static class EventHubRemoteServiceConsts + { + public const string RemoteServiceName = "EventHub"; + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs b/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs new file mode 100644 index 0000000..b1f6e34 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Controllers/Events/EventController.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using EventHub.Events; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Controllers.Events +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhub")] + [ControllerName("Event")] + [Route("api/eventhub/event")] + public class EventController : AbpController, IEventAppService + { + private readonly IEventAppService _eventAppService; + + public EventController(IEventAppService eventAppService) + { + _eventAppService = eventAppService; + } + + [HttpPost] + public async Task CreateAsync(CreateEventDto input) + { + return await _eventAppService.CreateAsync(input); + } + + [HttpGet] + public async Task> GetListAsync(EventListFilterDto input) + { + return await _eventAppService.GetListAsync(input); + } + + [HttpGet] + [Route("by-url-code/{urlCode}")] + public async Task GetByUrlCodeAsync(string urlCode) + { + return await _eventAppService.GetByUrlCodeAsync(urlCode); + } + + [HttpGet] + [Route("location/{id}")] + public async Task GetLocationAsync(Guid id) + { + return await _eventAppService.GetLocationAsync(id); + } + + [HttpGet] + [Route("lookup/countries")] + public async Task> GetCountriesLookupAsync() + { + return await _eventAppService.GetCountriesLookupAsync(); + } + + [HttpGet] + [Route("is-event-owner/{id}")] + public async Task IsEventOwnerAsync(Guid id) + { + return await _eventAppService.IsEventOwnerAsync(id); + } + + [HttpPut] + [Route("{id}")] + public async Task UpdateAsync(Guid id, UpdateEventDto input) + { + await _eventAppService.UpdateAsync(id, input); + } + + [HttpGet] + [Route("cover-image/{id}")] + public async Task GetCoverImageAsync(Guid id) + { + return await _eventAppService.GetCoverImageAsync(id); + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs b/src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs new file mode 100644 index 0000000..8eb8341 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Controllers/Events/Registrations/EventRegistrationController.cs @@ -0,0 +1,58 @@ +using System; +using System.Threading.Tasks; +using EventHub.Events.Registrations; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Controllers.Events.Registrations +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhub")] + [ControllerName("EventRegistration")] + [Route("api/eventhub/event-registration")] + public class EventRegistrationController : AbpController, IEventRegistrationAppService + { + private readonly IEventRegistrationAppService _eventRegistrationAppService; + + public EventRegistrationController(IEventRegistrationAppService eventRegistrationAppService) + { + _eventRegistrationAppService = eventRegistrationAppService; + } + + [HttpGet] + [Route("register/{eventId}")] + public async Task RegisterAsync(Guid eventId) + { + await _eventRegistrationAppService.RegisterAsync(eventId); + } + + [HttpGet] + [Route("un-register/{eventId}")] + public async Task UnregisterAsync(Guid eventId) + { + await _eventRegistrationAppService.UnregisterAsync(eventId); + } + + [HttpGet] + [Route("is-registered/{eventId}")] + public async Task IsRegisteredAsync(Guid eventId) + { + return await _eventRegistrationAppService.IsRegisteredAsync(eventId); + } + + [HttpGet] + public async Task> GetAttendeesAsync(Guid eventId) + { + return await _eventRegistrationAppService.GetAttendeesAsync(eventId); + } + + [HttpGet] + [Route("is-past-event/{eventId}")] + public async Task IsPastEventAsync(Guid eventId) + { + return await _eventRegistrationAppService.IsPastEventAsync(eventId); + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs b/src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs new file mode 100644 index 0000000..ac1d710 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs @@ -0,0 +1,52 @@ +using System; +using System.Threading.Tasks; +using EventHub.Organizations.Memberships; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Controllers.Organizations.Memberships +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhub")] + [ControllerName("OrganizationMembership")] + [Route("api/eventhub/organization-membership")] + public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService + { + private readonly IOrganizationMembershipAppService _organizationMembershipAppService; + + public OrganizationMembershipController(IOrganizationMembershipAppService organizationMembershipAppService) + { + _organizationMembershipAppService = organizationMembershipAppService; + } + + [HttpPut] + [Route("join/{organizationId}")] + public async Task JoinAsync(Guid organizationId) + { + await _organizationMembershipAppService.JoinAsync(organizationId); + } + + [HttpPut] + [Route("leave/{organizationId}")] + public async Task LeaveAsync(Guid organizationId) + { + await _organizationMembershipAppService.LeaveAsync(organizationId); + + } + + [HttpGet] + [Route("is-joined/{organizationId}")] + public async Task IsJoinedAsync(Guid organizationId) + { + return await _organizationMembershipAppService.IsJoinedAsync(organizationId); + } + + [HttpGet] + public async Task> GetMembersAsync(OrganizationMemberListFilterDto input) + { + return await _organizationMembershipAppService.GetMembersAsync(input); + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs b/src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs new file mode 100644 index 0000000..3f090b5 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Controllers/Organizations/OrganizationController.cs @@ -0,0 +1,64 @@ +using System; +using System.Threading.Tasks; +using EventHub.Organizations; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Controllers.Organizations +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhub")] + [ControllerName("Organization")] + [Route("api/eventhub/organization")] + public class OrganizationController : AbpController, IOrganizationAppService + { + private readonly IOrganizationAppService _organizationAppService; + + public OrganizationController(IOrganizationAppService organizationAppService) + { + _organizationAppService = organizationAppService; + } + + [HttpPost] + public async Task CreateAsync(CreateOrganizationDto input) + { + await _organizationAppService.CreateAsync(input); + } + + [HttpGet] + public async Task> GetListAsync(OrganizationListFilterDto input) + { + return await _organizationAppService.GetListAsync(input); + } + + [HttpGet] + [Route("{name}")] + public async Task GetProfileAsync(string name) + { + return await _organizationAppService.GetProfileAsync(name); + } + + [HttpGet] + [Route("by-user-id/{userId}")] + public async Task> GetOrganizationsByUserIdAsync(Guid userId) + { + return await _organizationAppService.GetOrganizationsByUserIdAsync(userId); + } + + [HttpGet] + [Route("is-organization-owner/{organizationId}")] + public async Task IsOrganizationOwnerAsync(Guid organizationId) + { + return await _organizationAppService.IsOrganizationOwnerAsync(organizationId); + } + + [HttpPut] + [Route("{id}")] + public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) + { + await _organizationAppService.UpdateAsync(id, input); + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs b/src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs new file mode 100644 index 0000000..5364c88 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Controllers/Users/UserController.cs @@ -0,0 +1,30 @@ +using System.Threading.Tasks; +using EventHub.Members; +using EventHub.Users; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace EventHub.Controllers.Users +{ + [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] + [Area("eventhub")] + [ControllerName("User")] + [Route("/api/eventhub/user")] + public class UserController : AbpController, IUserAppService + { + private readonly IUserAppService _userAppService; + + public UserController(IUserAppService userAppService) + { + _userAppService = userAppService; + } + + [HttpGet] + [Route("{username}")] + public async Task FindByUserNameAsync(string username) + { + return await _userAppService.FindByUserNameAsync(username); + } + } +} \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs index 65b752f..9b886ba 100644 --- a/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs +++ b/src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs @@ -49,7 +49,6 @@ namespace EventHub var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - ConfigureConventionalControllers(); ConfigureAuthentication(context, configuration); ConfigureLocalization(); ConfigureCache(configuration); @@ -97,14 +96,6 @@ namespace EventHub } } - private void ConfigureConventionalControllers() - { - Configure(options => - { - options.ConventionalControllers.Create(typeof(EventHubApplicationModule).Assembly); - }); - } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) From f56fe32e75eebdcd4c1a9df12c3a566aac2d5382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 4 Aug 2021 14:43:13 +0300 Subject: [PATCH 22/70] install curl to web image --- .../charts/account/templates/account-ingress.yaml | 13 +++++++++++++ .../EventHubIdentityServerModule.cs | 12 ++++++++++++ src/EventHub.Web/Dockerfile | 1 + src/EventHub.Web/EventHubWebModule.cs | 3 ++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index a678100..fbdfd6f 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -5,13 +5,26 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_input_headers "fromingress: true"; spec: tls: - hosts: - {{ .Values.accountUrl }} + - accounttemp secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - host: "{{ .Values.accountUrl }}" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 + - host: "accounttemp" http: paths: - path: / diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index 15b82d9..a626db5 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -14,6 +14,7 @@ using EventHub.Web; using EventHub.Web.Theme; using EventHub.Web.Theme.Bundling; using IdentityServer4.Configuration; +using IdentityServer4.Extensions; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.IdentityModel.Tokens; @@ -186,6 +187,7 @@ namespace EventHub { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + var conf = context.ServiceProvider.GetRequiredService(); /* app.Use((context, next) => @@ -195,6 +197,16 @@ namespace EventHub }); */ + app.Use(async (ctx, next) => + { + if (ctx.Request.Headers.ContainsKey("fromingress")) + { + ctx.SetIdentityServerOrigin(conf["App:SelfUrl"]); + } + + await next(); + }); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/src/EventHub.Web/Dockerfile b/src/EventHub.Web/Dockerfile index ab31322..e65d369 100644 --- a/src/EventHub.Web/Dockerfile +++ b/src/EventHub.Web/Dockerfile @@ -1,4 +1,5 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 COPY bin/Release/net5.0/publish/ app/ + RUN apt-get update && apt-get install -y curl WORKDIR /app ENTRYPOINT ["dotnet", "EventHub.Web.dll"] \ No newline at end of file diff --git a/src/EventHub.Web/EventHubWebModule.cs b/src/EventHub.Web/EventHubWebModule.cs index 3f5a04e..3e394ff 100644 --- a/src/EventHub.Web/EventHubWebModule.cs +++ b/src/EventHub.Web/EventHubWebModule.cs @@ -151,12 +151,13 @@ namespace EventHub.Web options.Scope.Add("email"); options.Scope.Add("phone"); options.Scope.Add("EventHub"); - + /* options.Events.OnRedirectToIdentityProvider = redirectContext => { redirectContext.ProtocolMessage.RedirectUri = $"{configuration["App:SelfUrl"]}/signin-oidc"; return Task.CompletedTask; }; + */ }); } From 1422137bfef1378661058e5e883d9546722eb159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 4 Aug 2021 15:00:20 +0300 Subject: [PATCH 23/70] Increased nginx buffer sizes --- .../eventhub/charts/account/templates/account-ingress.yaml | 2 ++ .../helm-chart/eventhub/charts/www/templates/www-ingress.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index fbdfd6f..ed019f5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -5,6 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" + nginx.ingress.kubernetes.io/proxy-buffers-number: "16" nginx.ingress.kubernetes.io/configuration-snippet: | more_set_input_headers "fromingress: true"; spec: diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml index 3b237eb..869d442 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -5,6 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" + nginx.ingress.kubernetes.io/proxy-buffers-number: "16" spec: tls: - hosts: From 10a2e5bdadc182005eb72e6c4eade9bdc6092047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 4 Aug 2021 16:04:18 +0300 Subject: [PATCH 24/70] Update EventHubExternalUrls.cs --- src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs b/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs index 60ff0bd..6c6a75a 100644 --- a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs +++ b/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs @@ -9,10 +9,10 @@ namespace EventHub.Web public const string EhWww = "https://localhost:44308"; #else // TODO: Change these production links - public const string EhAccount = "https://account.openeventhub.com"; - public const string EhApi = "https://api.openeventhub.com"; - public const string EhAdmin = "https://admin.openeventhub.com"; - public const string EhWww = "https://openeventhub.com"; + public const string EhAccount = "https://eh-st-account"; + public const string EhApi = "https://eh-st-api"; + public const string EhAdmin = "https://eh-st-admin"; + public const string EhWww = "https://eh-st-www"; #endif } } \ No newline at end of file From c94bf7a42af5668b8344641c15d6ea99b659613c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 09:02:22 +0300 Subject: [PATCH 25/70] Refactored helm configs --- .../charts/account/templates/account-ingress.yaml | 15 ++------------- .../eventhub/charts/account/values.yaml | 3 --- .../charts/api/templates/api-ingress.yaml | 2 +- .../helm-chart/eventhub/charts/api/values.yaml | 3 --- .../eventhub/charts/dbmigrator/values.yaml | 3 --- .../charts/www/templates/www-ingress.yaml | 4 ++-- .../helm-chart/eventhub/charts/www/values.yaml | 3 --- etc/k8s/helm-chart/eventhub/values.yaml | 7 ++++--- 8 files changed, 9 insertions(+), 31 deletions(-) diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index ed019f5..f6301c5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -12,21 +12,10 @@ metadata: spec: tls: - hosts: - - {{ .Values.accountUrl }} - - accounttemp + - {{ .Values.global.accountUrl }} secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - - host: "{{ .Values.accountUrl }}" - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: {{ .Release.Name }}-{{ .Chart.Name }} - port: - number: 80 - - host: "accounttemp" + - host: "{{ .Values.global.accountUrl }}" http: paths: - path: / diff --git a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml index d44ed88..e69de29 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml @@ -1,3 +0,0 @@ -accountUrl: eh-st-account -apiUrl: eh-st-api -wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml index 18cbfe3..2278bf4 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -6,7 +6,7 @@ metadata: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: - - host: "{{ .Values.apiUrl }}" + - host: "{{ .Values.global.apiUrl }}" http: paths: - path: / diff --git a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml index d44ed88..e69de29 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml @@ -1,3 +0,0 @@ -accountUrl: eh-st-account -apiUrl: eh-st-api -wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml index d44ed88..e69de29 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml @@ -1,3 +0,0 @@ -accountUrl: eh-st-account -apiUrl: eh-st-api -wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml index 869d442..28f0185 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -10,10 +10,10 @@ metadata: spec: tls: - hosts: - - {{ .Values.wwwUrl }} + - {{ .Values.global.wwwUrl }} secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - - host: "{{ .Values.wwwUrl }}" + - host: "{{ .Values.global.wwwUrl }}" http: paths: - path: / diff --git a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml index d44ed88..e69de29 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml @@ -1,3 +0,0 @@ -accountUrl: eh-st-account -apiUrl: eh-st-api -wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index d44ed88..2c9b527 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -1,3 +1,4 @@ -accountUrl: eh-st-account -apiUrl: eh-st-api -wwwUrl: eh-st-www \ No newline at end of file +global: + accountUrl: eh-st-account + apiUrl: eh-st-api + wwwUrl: eh-st-www \ No newline at end of file From 3f3e64c4f9fba0fbd8a178e05d44b0903a0c3c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 09:14:24 +0300 Subject: [PATCH 26/70] refactor deploy --- .../eventhub/charts/account/templates/account-ingress.yaml | 4 ++-- .../helm-chart/eventhub/charts/api/templates/api-ingress.yaml | 3 +++ .../helm-chart/eventhub/charts/www/templates/www-ingress.yaml | 4 ++-- etc/k8s/helm-chart/eventhub/values.yaml | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index f6301c5..98369b5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -5,8 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" - nginx.ingress.kubernetes.io/proxy-buffers-number: "16" + nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} + nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} nginx.ingress.kubernetes.io/configuration-snippet: | more_set_input_headers "fromingress: true"; spec: diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml index 2278bf4..17f8825 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -4,6 +4,9 @@ metadata: name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} + nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} spec: rules: - host: "{{ .Values.global.apiUrl }}" diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml index 28f0185..128dde6 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -5,8 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" - nginx.ingress.kubernetes.io/proxy-buffers-number: "16" + nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} + nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} spec: tls: - hosts: diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index 2c9b527..5c3f70b 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -1,4 +1,6 @@ global: accountUrl: eh-st-account apiUrl: eh-st-api - wwwUrl: eh-st-www \ No newline at end of file + wwwUrl: eh-st-www + nginx-proxy-buffer-size: "32k" + nginx-proxy-buffers-number: 8 \ No newline at end of file From f44527a5d2834011cb88a46515be099b60203bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 09:19:44 +0300 Subject: [PATCH 27/70] fixed naming --- .../eventhub/charts/account/templates/account-ingress.yaml | 4 ++-- .../helm-chart/eventhub/charts/api/templates/api-ingress.yaml | 4 ++-- .../helm-chart/eventhub/charts/www/templates/www-ingress.yaml | 4 ++-- etc/k8s/helm-chart/eventhub/values.yaml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index 98369b5..2e206c2 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -5,8 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} - nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" nginx.ingress.kubernetes.io/configuration-snippet: | more_set_input_headers "fromingress: true"; spec: diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml index 17f8825..e2165ba 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -5,8 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} - nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" spec: rules: - host: "{{ .Values.global.apiUrl }}" diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml index 128dde6..01633be 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -5,8 +5,8 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - nginx.ingress.kubernetes.io/proxy-buffer-size: {{ .Values.global.nginx-proxy-buffer-size }} - nginx.ingress.kubernetes.io/proxy-buffers-number: {{ .Values.global.nginx-proxy-buffers-number }} + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" spec: tls: - hosts: diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index 5c3f70b..27e5bd5 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -2,5 +2,5 @@ global: accountUrl: eh-st-account apiUrl: eh-st-api wwwUrl: eh-st-www - nginx-proxy-buffer-size: "32k" - nginx-proxy-buffers-number: 8 \ No newline at end of file + nginxProxyBufferSize: "32k" + nginxProxyBuffersNumber: "8" \ No newline at end of file From 7d2f763c24b2e1cdaa827881e43315124954c522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 09:40:34 +0300 Subject: [PATCH 28/70] refactor --- .../charts/account/templates/account-tls-secret.yaml | 8 -------- .../eventhub/charts/account/templates/account.yaml | 2 +- etc/k8s/helm-chart/eventhub/charts/account/values.yaml | 1 + etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml | 2 +- etc/k8s/helm-chart/eventhub/charts/api/values.yaml | 1 + .../eventhub/charts/dbmigrator/templates/migrator.yaml | 2 +- etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml | 1 + etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml | 2 +- etc/k8s/helm-chart/eventhub/charts/www/values.yaml | 1 + 9 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml deleted file mode 100644 index b03c72e..0000000 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -type: kubernetes.io/tls -kind: Secret -metadata: - name: {{ .Release.Name }}-{{ .Chart.Name }}-tls -data: - tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUVENDQWpXZ0F3SUJBZ0lVZTVMQzk5RVFUcHRJQitzTHRobi9Kc1RjR1Zzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd05qRWhNQjhHQTFVRUF3d1lZV05qYjNWdWRDNXZjR1Z1WlhabGJuUm9kV0l1WTI5dE1SRXdEd1lEVlFRSwpEQWhXYjJ4dmMyOW1kREFlRncweU1UQTRNRE14TWpJNU5UVmFGdzB5TWpBNE1ETXhNakk1TlRWYU1EWXhJVEFmCkJnTlZCQU1NR0dGalkyOTFiblF1YjNCbGJtVjJaVzUwYUhWaUxtTnZiVEVSTUE4R0ExVUVDZ3dJVm05c2IzTnYKWm5Rd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUNuOUZzSCtCenNsai81L0p1WQpuK1pQYjhrOEN0dXZPTC9xVjZtbWF5ZWZLVVBRdTFWb2w2enI4bkZJTmU3cjRHR3RFM0N2VEVtYXVaeG5qUkQwCmVHb0pSanBPMzFIYTB5MktST1p4OVU0TGFlTFEzdm9RT1Izd0tvL2ZzZnRXczFvdnM4Z3NNeS9YemwxTHB2WDEKSWFhSVl2bEVyakhkeVBUbTdoTUxGS09HRGpZWHNpVzhIT1p6dEV1cUwwVTY1bllFWFFiL016V0RQdVIyNVFkTwo0ZFgxeUYrVXBsQmF3SXc1L3FUdktic1hOYkZ2eXRkOWlDOGxkS2pZMWpqbHVOeHVOMjZVSFllZ2c2cFE3QXp3CmM0VG5IaFk5VVhPZ0JRMjEvci9VUEN3SjcxMFZwM1dydHJlb1Y1MWJFWVpZZ0IvRUM1cGRNOUk3Q0VneXhiSXcKMFEvVEFnTUJBQUdqVXpCUk1CMEdBMVVkRGdRV0JCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFmQmdOVgpIU01FR0RBV2dCUmZVQ0cyck5KQ0krRGpRZmdoUHFhSlVyTUNuVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQTBHCkNTcUdTSWIzRFFFQkN3VUFBNElCQVFCYmdnVktHWS9TMnAzY0U4bURoSHdBcjRNSzlwanNUd3lnWVlKd2dYRWYKb2xyN1NQOFpjYU1MbHNhdXlzWXIxeXV4VEdyNnR0VGtqMGhyVGNRaG9EREFDK2RlYmVKNmVGaUJoTVpIK2xRQwpnUlRpNDZnbWRtUFl1aGhYSHBlU21HVnhqQVBRUDJ3VmlzRkllOVRkcTl4ZHREKzFkZW1tamtTb3RLN2duM3ZECkVKYVVVQm42MHV4cUpzaFhqOWFYWjQ5YjloZ0dweXdnK2UzMGt3dE5Vb3dEc0xMTEU3MkNHSHlhRFlkZXMwcm4KVVJhWis0RGV6b0JiZWZvcHpNK3pJbUJ3bkRQbnRjUmxQN1p3MjkyaVBkUU84RlIyT3RQWnZxajN6ZXdHUDZNaApYOTIvZm1MTlF3L3UzQ3NaL3praHU1ZVFHYWJvWnN1RVJrZUp2MUwrbzdiRAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== - tls.key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQ245RnNIK0J6c2xqLzUKL0p1WW4rWlBiOGs4Q3R1dk9ML3FWNm1tYXllZktVUFF1MVZvbDZ6cjhuRklOZTdyNEdHdEUzQ3ZURW1hdVp4bgpqUkQwZUdvSlJqcE8zMUhhMHkyS1JPWng5VTRMYWVMUTN2b1FPUjN3S28vZnNmdFdzMW92czhnc015L1h6bDFMCnB2WDFJYWFJWXZsRXJqSGR5UFRtN2hNTEZLT0dEallYc2lXOEhPWnp0RXVxTDBVNjVuWUVYUWIvTXpXRFB1UjIKNVFkTzRkWDF5RitVcGxCYXdJdzUvcVR2S2JzWE5iRnZ5dGQ5aUM4bGRLalkxampsdU54dU4yNlVIWWVnZzZwUQo3QXp3YzRUbkhoWTlVWE9nQlEyMS9yL1VQQ3dKNzEwVnAzV3J0cmVvVjUxYkVZWllnQi9FQzVwZE05STdDRWd5CnhiSXcwUS9UQWdNQkFBRUNnZ0VBVjA0VEg5SmVuckQvc3FBWDliOXd4ZXd5Nis0dEFpbDZ3WU11SWQ3anFyMlYKamVSRFltb3RyanpKbkNMRS9vSVY1QlVONTJHOWhSdGs3UU1NUkRodnprQmVRTytmS2lQS01XemRhWEY5VHp1TQpkc3pocWhzMnI4aEFINlR5Sk1CNGFnR0hWVXFLWFNEZHFGeXl6K2pkRzFwdmZyOGFGdExHVTJDQUw2dGIwV3VyCjNxcG5sZkdqeTYzZFRvSEdzN3ZkU1lFK0VLVGNsMEpuZHpQZnNwemlzQ0NkK3RBcUNGbzl2anhZS0grVURTNkkKMytHSUFWcEVVRWY2ek50R3RQVHBPdktTQXRobTJ6NWxYaUlwV05vSFNmUGh6VTJXM0R6MmkyUFZkaWZqWmdoZwpidkF2UzA2b3BSK1k3alZpYXlGQkRHVTRZYzB3K2tqZDN4WjIzMHVxU1FLQmdRRGFiQXVCQk1kY2h5R1RwUzRyCmk4NmM5cklrVU5YS3lQQ0lWamJLeWMwSWE3RC9jREFrUGZaaHlscjFGdEx1dk81eFl6VkFOM3N3dUFFRDJvUi8KYklkM0VOTUlxSTVvQmJQeU16VlZXSG50ZFkyNmlEWUtBQ2pJdDZ4YXlCSysrZTRSSmI2alAxZ1RKdkhiditrMgphc2xGd1UwSVlzbm1QSVluMVNtUVFvWkcxd0tCZ1FERTJaSVU0azczSjJ3clJLcmFpTy93Q2F4Y2o3TEg4Z3lwCmFTbjNFUFFtVVIwQTBRTEhld05sY2Rjc2l5aVdPZzBodjBWamJtYnlPRDhDK09oOFd2ckhSZzJtWEwydHZSVm4Kc05oL3pERHRsV292bG50czZzbzB2b1VnZmVwT2hDajBpRTBNelBLZTJ5cEZNREUyV2o0YzlnRlJEVVZuREx3UQpGdUZDZW5jclpRS0JnUURIOStNUVc2K3BwbzIyL3FNbWV2ak4rNDFjY2lWSlltM1VaQm9Gem50SUdsQVJqRVNHCjZiT0lGQnJ5QjlOVmZ1Tk9LK1cweFJham85SktGT1Q1UkFOQm5zV1dSN3NZd1IvZHZjUTJQcXBpSEIyRmlPN3cKZVBUZHprcWRVazdYU1RvTHVPS3YwbTV3R2xlVE9EL3E4aGtUSThYQ3g2N1FldGpYM3ZBT2d0a3NRUUtCZ0ZFQgpXNHoraUJKTEJjZFViWjZhaFdwWkFMWGlhR2JCWTVaL2NVWjdrbzBHQ2hKZzhHellZVkJvcFd4dUk1aVdjUHIzCk0vMnoyK2RIWUI3QUFTUFRhS21DV1hHaGJtakZpNzVzMXRyWVV6WWhxMTNENWl5dS9lRHdtZVlDQ3Q2ZW9oL20KeXhZK2JJVVVtWE41WG5jSWNkRUhKd21NbFlmUGhNQjJPZUphZFJuRkFvR0FGQ3ZiMGRrcWJxblNWTFFoY09DcQo5REp5aTYvRUV5VzhmcVlXc2lrYW9aT01oUnB2b1F6VWpqVTFqaWt4VkVFdnNFRzYwYU56WVdLT0hKRFFsaXNLCkNvZUJXNWZLS2RZeE96L1R5bFRzcncycXZYVnJUTm91WFRSeDByYVdNMWJ2alFQWUpjYUV3aE5TY1dxVjR2VlIKeDhSVWd1QmlVaHhQb0NyOHg0SitGQ3M9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml index 171f8de..15bb749 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -12,7 +12,7 @@ spec: app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - - image: eventhub.account + - image: {{ .Values.containerImage }} imagePullPolicy: Never name: {{ .Release.Name }}-{{ .Chart.Name }} ports: diff --git a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml index e69de29..7309132 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml @@ -0,0 +1 @@ +containerImage: "eventhub.api" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml index 8602009..15bb749 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -12,7 +12,7 @@ spec: app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - - image: eventhub.api + - image: {{ .Values.containerImage }} imagePullPolicy: Never name: {{ .Release.Name }}-{{ .Chart.Name }} ports: diff --git a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml index e69de29..00bc93b 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml @@ -0,0 +1 @@ +containerImage: "eventhub.account" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml index e77b1c5..ec3de59 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -8,7 +8,7 @@ spec: spec: containers: - name: {{ .Release.Name }}-{{ .Chart.Name }} - image: eventhubmigrator + image: {{ .Values.containerImage }} imagePullPolicy: Never restartPolicy: Never backoffLimit: 4 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml index e69de29..b4904a5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml @@ -0,0 +1 @@ +containerImage: eventhubmigrator \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml index 08ad03b..15bb749 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml @@ -12,7 +12,7 @@ spec: app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - - image: eventhub.www + - image: {{ .Values.containerImage }} imagePullPolicy: Never name: {{ .Release.Name }}-{{ .Chart.Name }} ports: diff --git a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml index e69de29..7d204b0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml @@ -0,0 +1 @@ +containerImage: eventhub.www \ No newline at end of file From 955e70d262b4db9af705fee800c9354ea5852a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 10:04:18 +0300 Subject: [PATCH 29/70] Added powershell script to build images --- .../eventhub/charts/dbmigrator/values.yaml | 2 +- etc/k8s/scripts/build-images.ps1 | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 etc/k8s/scripts/build-images.ps1 diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml index b4904a5..92cb5f6 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml @@ -1 +1 @@ -containerImage: eventhubmigrator \ No newline at end of file +containerImage: eventhub.dbmigrator \ No newline at end of file diff --git a/etc/k8s/scripts/build-images.ps1 b/etc/k8s/scripts/build-images.ps1 new file mode 100644 index 0000000..b7c7f9e --- /dev/null +++ b/etc/k8s/scripts/build-images.ps1 @@ -0,0 +1,37 @@ +$currentFolder = (Get-Item -Path "./" -Verbose).FullName +$slnFolder = Join-Path $currentFolder "../../../" +$dbmigratorFolder = Join-Path $slnFolder "src/EventHub.DbMigrator" +$webFolder = Join-Path $slnFolder "src/EventHub.Web" +$apiFolder = Join-Path $slnFolder "src/EventHub.HttpApi.Host" +$identityServerFolder = Join-Path $slnFolder "src/EventHub.IdentityServer" + +### DB MIGRATOR + +Write-Host "*** BUILDING DB MIGRATOR ****************" -ForegroundColor Green +Set-Location $dbmigratorFolder +dotnet publish -c Release +docker build -t eventhub.dbmigrator . + +### WEB (WWW) + +Write-Host "*** BUILDING WEB (WWW) ****************" -ForegroundColor Green +Set-Location $webFolder +dotnet publish -c Release +docker build -t eventhub.www . + +### API + +Write-Host "*** BUILDING API ****************" -ForegroundColor Green +Set-Location $apiFolder +dotnet publish -c Release +docker build -t eventhub.api . + +### IDENTITY SERVER (ACCOUNT) + +Write-Host "*** BUILDING IDENTITY SERVER (ACCOUNT) ****************" -ForegroundColor Green +Set-Location $identityServerFolder +dotnet publish -c Release +docker build -t eventhub.account . + +Write-Host "ALL COMPLETED" -ForegroundColor Green +Set-Location $currentFolder \ No newline at end of file From 1889f4ad37f03e00a0868a886f7035e30b8d6db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 10:36:44 +0300 Subject: [PATCH 30/70] refactored appsettings for dbmigrator --- .../eventhub/charts/dbmigrator/templates/migrator.yaml | 9 +++++++++ etc/k8s/helm-chart/eventhub/values.yaml | 5 +++++ .../EventHubAdminHttpApiHostModule.cs | 1 - src/EventHub.DbMigrator/EventHub.DbMigrator.csproj | 4 ---- src/EventHub.DbMigrator/appsettings.Development.json | 5 ----- src/EventHub.DbMigrator/appsettings.json | 8 ++++---- 6 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 src/EventHub.DbMigrator/appsettings.Development.json diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml index ec3de59..02df487 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -10,5 +10,14 @@ spec: - name: {{ .Release.Name }}-{{ .Chart.Name }} image: {{ .Values.containerImage }} imagePullPolicy: Never + env: + - name: "ConnectionStrings__Default" + value: "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + - name: "IdentityServer__Clients__EventHub_Web__RootUrl" + value: {{ .Values.global.wwwUrlFull }} + - name: "IdentityServer__Clients__EventHub_Blazor__RootUrl" + value: {{ .Values.global.adminUrlFull }} + - name: "IdentityServer__Clients__EventHub_Swagger__RootUrl" + value: {{ .Values.global.apiUrlFull }} restartPolicy: Never backoffLimit: 4 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index 27e5bd5..b70f1b5 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -1,6 +1,11 @@ global: accountUrl: eh-st-account + accountUrlFull: https://eh-st-account apiUrl: eh-st-api + apiUrlFull: https://eh-st-api wwwUrl: eh-st-www + wwwUrlFull: "https://eh-st-www" + adminUrl: eh-st-admin + adminUrlFull: https://eh-st-admin nginxProxyBufferSize: "32k" nginxProxyBuffersNumber: "8" \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs b/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs index 81a76bc..38ff481 100644 --- a/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs +++ b/src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs @@ -15,7 +15,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using StackExchange.Redis; using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; diff --git a/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj b/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj index ed41ba6..69154bc 100644 --- a/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj +++ b/src/EventHub.DbMigrator/EventHub.DbMigrator.csproj @@ -12,10 +12,6 @@ - - PreserveNewest - Always - PreserveNewest Always diff --git a/src/EventHub.DbMigrator/appsettings.Development.json b/src/EventHub.DbMigrator/appsettings.Development.json deleted file mode 100644 index 4ba93e6..0000000 --- a/src/EventHub.DbMigrator/appsettings.Development.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ConnectionStrings": { - "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" - } -} diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index c8f7067..26356c1 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,22 +1,22 @@ { "ConnectionStrings": { - "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" }, "IdentityServer": { "Clients": { "EventHub_Web": { "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*", - "RootUrl": "https://eh-st-www" + "RootUrl": "https://localhost:44308" }, "EventHub_Blazor": { "ClientId": "EventHub_Blazor", - "RootUrl": "https://eh-st-admin" + "RootUrl": "https://localhost:44307" }, "EventHub_Swagger": { "ClientId": "EventHub_Swagger", "ClientSecret": "1q2w3e*", - "RootUrl": "https://eh-st-api" + "RootUrl": "https://localhost:44362" } } } From f1d42d508c7ff93b067e5335acbe8ccf638682dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 5 Aug 2021 13:27:39 +0300 Subject: [PATCH 31/70] Remove EventHubExternalUrls --- .../charts/account/templates/account.yaml | 7 ++++++- .../eventhub/charts/account/values.yaml | 2 +- .../eventhub/charts/api/templates/api.yaml | 7 ++++++- .../eventhub/charts/api/values.yaml | 2 +- .../charts/dbmigrator/templates/migrator.yaml | 3 ++- .../eventhub/charts/www/templates/www.yaml | 4 +++- .../eventhub/templates/_helpers.tpl | 12 +++++++++++ etc/k8s/helm-chart/eventhub/values.yaml | 5 ++++- .../appsettings.json | 3 ++- src/EventHub.DbMigrator/appsettings.json | 2 +- .../EventHubDomainSharedModule.cs | 6 ++++++ .../Web/EventHubExternalUrls.cs | 18 ----------------- .../Web/EventHubUrlOptions.cs | 11 ++++++++++ .../EventHubEmailTemplateRenderingEngine.cs | 9 +++++++-- src/EventHub.Domain/EventHubDomainModule.cs | 3 ++- src/EventHub.HttpApi.Host/appsettings.json | 5 +++-- .../EventHubIdentityServerModule.cs | 5 ++--- src/EventHub.IdentityServer/appsettings.json | 5 +++-- .../EventHub/Components/Footer/Default.cshtml | 8 +++++--- .../Components/MainNavbar/Default.cshtml | 20 ++++++++++--------- .../EventHub/Layouts/Application.cshtml | 7 +++++-- src/EventHub.Web/Pages/Events/Detail.cshtml | 6 ++++-- src/EventHub.Web/Pages/Index.cshtml | 4 +++- 23 files changed, 100 insertions(+), 54 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/templates/_helpers.tpl delete mode 100644 src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs create mode 100644 src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml index 15bb749..2674576 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -19,4 +19,9 @@ spec: - name: http containerPort: 80 - name: https - containerPort: 443 \ No newline at end of file + containerPort: 443 + env: +{{ include "eventhub.global.env" . | indent 8 }} + - name: "ConnectionStrings__Default" + value: {{ .Values.global.defaultConnString }} + diff --git a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml index 7309132..00bc93b 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml @@ -1 +1 @@ -containerImage: "eventhub.api" \ No newline at end of file +containerImage: "eventhub.account" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml index 15bb749..2674576 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -19,4 +19,9 @@ spec: - name: http containerPort: 80 - name: https - containerPort: 443 \ No newline at end of file + containerPort: 443 + env: +{{ include "eventhub.global.env" . | indent 8 }} + - name: "ConnectionStrings__Default" + value: {{ .Values.global.defaultConnString }} + diff --git a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml index 00bc93b..7309132 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml @@ -1 +1 @@ -containerImage: "eventhub.account" \ No newline at end of file +containerImage: "eventhub.api" \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml index 02df487..38560d5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -11,8 +11,9 @@ spec: image: {{ .Values.containerImage }} imagePullPolicy: Never env: +{{ include "eventhub.global.env" . | indent 8 }} - name: "ConnectionStrings__Default" - value: "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + value: {{ .Values.global.defaultConnString }} - name: "IdentityServer__Clients__EventHub_Web__RootUrl" value: {{ .Values.global.wwwUrlFull }} - name: "IdentityServer__Clients__EventHub_Blazor__RootUrl" diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml index 15bb749..00a20ca 100644 --- a/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml @@ -19,4 +19,6 @@ spec: - name: http containerPort: 80 - name: https - containerPort: 443 \ No newline at end of file + containerPort: 443 + env: +{{ include "eventhub.global.env" . | indent 8 }} diff --git a/etc/k8s/helm-chart/eventhub/templates/_helpers.tpl b/etc/k8s/helm-chart/eventhub/templates/_helpers.tpl new file mode 100644 index 0000000..40ef14c --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/templates/_helpers.tpl @@ -0,0 +1,12 @@ +{{- define "eventhub.global.env" -}} +- name: "AppUrls__Account" + value: "{{ .Values.global.accountUrlFull }}" +- name: "AppUrls__Www" + value: "{{ .Values.global.wwwUrlFull }}" +- name: "AppUrls__Api" + value: "{{ .Values.global.apiUrlFull }}" +- name: "AppUrls__Admin" + value: "{{ .Values.global.adminUrlFull }}" +- name: "AppUrls__AdminApi" + value: "{{ .Values.global.adminApiUrlFull }}" +{{- end }} \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index b70f1b5..d55d3e8 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -7,5 +7,8 @@ global: wwwUrlFull: "https://eh-st-www" adminUrl: eh-st-admin adminUrlFull: https://eh-st-admin + adminApiApiUrl: eh-st-admin-api + adminApiUrlFull: https://eh-st-admin-api nginxProxyBufferSize: "32k" - nginxProxyBuffersNumber: "8" \ No newline at end of file + nginxProxyBuffersNumber: "8" + defaultConnString: "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" \ No newline at end of file diff --git a/src/EventHub.Admin.HttpApi.Host/appsettings.json b/src/EventHub.Admin.HttpApi.Host/appsettings.json index 7c2ab2d..61adbd3 100644 --- a/src/EventHub.Admin.HttpApi.Host/appsettings.json +++ b/src/EventHub.Admin.HttpApi.Host/appsettings.json @@ -1,6 +1,7 @@ { "App": { - "CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308" + "CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308", + "WebAppUrl": "https://eh-st-www" }, "ConnectionStrings": { "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 26356c1..828fd62 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" }, "IdentityServer": { "Clients": { diff --git a/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs b/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs index 8370a52..efa5dc2 100644 --- a/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs +++ b/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs @@ -1,4 +1,6 @@ using EventHub.Localization; +using EventHub.Web; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AuditLogging; using Volo.Abp.BackgroundJobs; using Volo.Abp.Identity; @@ -33,6 +35,8 @@ namespace EventHub public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + Configure(options => { options.FileSets.AddEmbedded(); @@ -52,6 +56,8 @@ namespace EventHub { options.MapCodeNamespace("EventHub", typeof(EventHubResource)); }); + + Configure(configuration.GetSection("AppUrls")); } } } diff --git a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs b/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs deleted file mode 100644 index 6c6a75a..0000000 --- a/src/EventHub.Domain.Shared/Web/EventHubExternalUrls.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace EventHub.Web -{ - public static class EventHubExternalUrls - { -#if DEBUG - public const string EhAccount = "https://localhost:44313"; - public const string EhApi = "https://localhost:44362"; - public const string EhAdmin = "https://localhost:44307"; - public const string EhWww = "https://localhost:44308"; -#else - // TODO: Change these production links - public const string EhAccount = "https://eh-st-account"; - public const string EhApi = "https://eh-st-api"; - public const string EhAdmin = "https://eh-st-admin"; - public const string EhWww = "https://eh-st-www"; -#endif - } -} \ No newline at end of file diff --git a/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs b/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs new file mode 100644 index 0000000..1e2873c --- /dev/null +++ b/src/EventHub.Domain.Shared/Web/EventHubUrlOptions.cs @@ -0,0 +1,11 @@ +namespace EventHub.Web +{ + public class EventHubUrlOptions + { + public string Account { get; set; } = "https://localhost:44313"; + public string Www { get; set; } = "https://localhost:44308"; + public string Api { get; set; } = "https://localhost:44362"; + public string Admin { get; set; } = "https://localhost:44307"; + public string AdminApi { get; set; } = "https://localhost:44305"; + } +} \ No newline at end of file diff --git a/src/EventHub.Domain/Emailing/EventHubEmailTemplateRenderingEngine.cs b/src/EventHub.Domain/Emailing/EventHubEmailTemplateRenderingEngine.cs index 623a3f5..9021183 100644 --- a/src/EventHub.Domain/Emailing/EventHubEmailTemplateRenderingEngine.cs +++ b/src/EventHub.Domain/Emailing/EventHubEmailTemplateRenderingEngine.cs @@ -5,6 +5,7 @@ using EventHub.Web; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating.Scriban; @@ -18,15 +19,19 @@ namespace EventHub.Emailing )] public class EventHubEmailTemplateRenderingEngine : ScribanTemplateRenderingEngine { + private readonly EventHubUrlOptions _options; + public EventHubEmailTemplateRenderingEngine( ITemplateDefinitionManager templateDefinitionManager, ITemplateContentProvider templateContentProvider, - IStringLocalizerFactory stringLocalizerFactory + IStringLocalizerFactory stringLocalizerFactory, + IOptions options ) : base( templateDefinitionManager, templateContentProvider, stringLocalizerFactory) { + _options = options.Value; } public override async Task RenderAsync( @@ -41,7 +46,7 @@ namespace EventHub.Emailing } globalContext["current_year"] = DateTime.Today.Year; - globalContext["app_url"] = EventHubExternalUrls.EhWww; + globalContext["app_url"] = _options.Www; return await base.RenderAsync(templateName, model, cultureName, globalContext); } diff --git a/src/EventHub.Domain/EventHubDomainModule.cs b/src/EventHub.Domain/EventHubDomainModule.cs index 000b842..cd34153 100644 --- a/src/EventHub.Domain/EventHubDomainModule.cs +++ b/src/EventHub.Domain/EventHubDomainModule.cs @@ -1,3 +1,5 @@ +using EventHub.Emailing; +using EventHub.Web; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Volo.Abp.AuditLogging; @@ -34,7 +36,6 @@ namespace EventHub { options.FileSets.AddEmbedded(); }); - #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); #endif diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 0548fb9..423ad5a 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -1,9 +1,10 @@ { "App": { - "CorsOrigins": "https://eh-st-www,eh-st-admin" + "CorsOrigins": "https://eh-st-www,eh-st-admin", + "WebAppUrl": "https://eh-st-www" }, "ConnectionStrings": { - "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" }, "Redis": { "Configuration": "eh-st-redis" diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index a626db5..99a3e37 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -121,15 +121,14 @@ namespace EventHub Configure(options => { - options.Applications["MVC"].RootUrl = EventHubExternalUrls.EhAccount; + options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; }); Configure(options => { - options.IssuerUri = EventHubExternalUrls.EhAccount; + options.IssuerUri = configuration["App:SelfUrl"]; }); - if (hostingEnvironment.IsDevelopment()) { Configure(options => diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index f361f09..7195084 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -2,10 +2,11 @@ "App": { "SelfUrl": "https://eh-st-account", "CorsOrigins": "https://eh-st-www,https://eh-st-api,https://localhost:44307,https://localhost:44362", - "RedirectAllowedUrls": "https://eh-st-api,https://eh-st-www,http://eh-st-api,http://eh-st-www" + "RedirectAllowedUrls": "https://eh-st-api,https://eh-st-www,http://eh-st-api,http://eh-st-www", + "WebAppUrl": "https://eh-st-www" }, "ConnectionStrings": { - "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432" }, "Redis": { "Configuration": "eh-st-redis" diff --git a/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml b/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml index 149877e..a528740 100644 --- a/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml +++ b/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml @@ -1,7 +1,9 @@ @using EventHub.Web @using Microsoft.AspNetCore.Http.Extensions +@using Microsoft.Extensions.Options @using Volo.Abp.Users @inject ICurrentUser CurrentUser +@inject IOptions UrlOptions