From 9651fc22d8aed7b38fb1efa4bacf3f459b767307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Thu, 4 May 2023 15:20:26 +0300 Subject: [PATCH 1/8] blogging module: member page has been edited and improvements have been made to the shipment detail page --- ...70814_Added_BlogUser_Optionals.Designer.cs | 1489 +++++++++++++++++ ...20230504070814_Added_BlogUser_Optionals.cs | 226 +++ .../BloggingTestAppDbContextModelSnapshot.cs | 162 +- .../CustomIdentityBlogUserUpdateDto.cs | 38 + .../Blogging/Members/IMemberAppService.cs | 2 + .../Volo/Blogging/Posts/BlogUserDto.cs | 18 + .../Volo/Blogging/Members/MemberAppService.cs | 17 + .../Blogging/Localization/Resources/en.json | 13 +- .../Volo/Blogging/Users/UserConsts.cs | 22 + .../Volo/Blogging/Users/BlogUser.cs | 22 + ...BloggingDbContextModelBuilderExtensions.cs | 10 +- .../MembersClientProxy.Generated.cs | 8 + .../Pages/Blogs/Posts/Detail.cshtml | 53 + .../Pages/Blogs/Posts/Detail.cshtml.cs | 3 + .../Pages/Members/Index.cshtml | 106 +- .../Pages/Members/Index.cshtml.cs | 11 + 16 files changed, 2192 insertions(+), 8 deletions(-) create mode 100644 modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs create mode 100644 modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs create mode 100644 modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs create mode 100644 modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs new file mode 100644 index 0000000000..6386b0eb88 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs @@ -0,0 +1,1489 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.BloggingTestApp.EntityFrameworkCore; + +#nullable disable + +namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(BloggingTestAppDbContext))] + [Migration("20230504070814_Added_BlogUser_Optionals")] + partial class AddedBlogUserOptionals + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("ProductVersion", "7.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LastPasswordChangeTime") + .HasColumnType("datetimeoffset"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("bit"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Name"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("ShortName"); + + b.HasKey("Id"); + + b.ToTable("BlgBlogs", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier") + .HasColumnName("PostId"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("RepliedCommentId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)") + .HasColumnName("Text"); + + b.HasKey("Id"); + + b.HasIndex("PostId"); + + b.HasIndex("RepliedCommentId"); + + b.ToTable("BlgComments", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("BlogId"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)") + .HasColumnName("Content"); + + b.Property("CoverImage") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("CoverImage"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ReadCount") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("Title"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Url"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.ToTable("BlgPosts", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b => + { + b.Property("PostId") + .HasColumnType("uniqueidentifier") + .HasColumnName("PostId"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TagId"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.HasKey("PostId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("BlgPostTags", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("UsageCount") + .HasColumnType("int") + .HasColumnName("UsageCount"); + + b.HasKey("Id"); + + b.ToTable("BlgTags", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Biography") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Biography"); + + b.Property("Company") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("Company"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Github") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Github"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("JobTitle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("JobTitle"); + + b.Property("Linkedin") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Linkedin"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Twitter") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Twitter"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.Property("WebSite") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("WebSite"); + + b.HasKey("Id"); + + b.ToTable("BlgUsers", (string)null); + }); + + 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.Blogging.Comments.Comment", b => + { + b.HasOne("Volo.Blogging.Posts.Post", null) + .WithMany() + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Blogging.Comments.Comment", null) + .WithMany() + .HasForeignKey("RepliedCommentId"); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.Post", b => + { + b.HasOne("Volo.Blogging.Blogs.Blog", null) + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b => + { + b.HasOne("Volo.Blogging.Posts.Post", null) + .WithMany("Tags") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Blogging.Tagging.Tag", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + 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.Blogging.Posts.Post", b => + { + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs new file mode 100644 index 0000000000..f84cefc9f8 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs @@ -0,0 +1,226 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations +{ + /// + public partial class AddedBlogUserOptionals : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Biography", + table: "BlgUsers", + type: "nvarchar(1000)", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "Company", + table: "BlgUsers", + type: "nvarchar(128)", + maxLength: 128, + nullable: true); + + migrationBuilder.AddColumn( + name: "Github", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "JobTitle", + table: "BlgUsers", + type: "nvarchar(32)", + maxLength: 32, + nullable: true); + + migrationBuilder.AddColumn( + name: "Linkedin", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "Twitter", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "WebSite", + table: "BlgUsers", + type: "nvarchar(256)", + maxLength: 256, + nullable: true); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpUsers", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "LastPasswordChangeTime", + table: "AbpUsers", + type: "datetimeoffset", + nullable: true); + + migrationBuilder.AddColumn( + name: "ShouldChangePasswordOnNextLogin", + table: "AbpUsers", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpRoles", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpOrganizationUnits", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "AbpPermissionGroups", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsEnabled = table.Column(type: "bit", nullable: false), + MultiTenancySide = table.Column(type: "tinyint", nullable: false), + Providers = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + StateCheckers = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUserDelegations", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + SourceUserId = table.Column(type: "uniqueidentifier", nullable: false), + TargetUserId = table.Column(type: "uniqueidentifier", nullable: false), + StartTime = table.Column(type: "datetime2", nullable: false), + EndTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserDelegations", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGroups_Name", + table: "AbpPermissionGroups", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissions_GroupName", + table: "AbpPermissions", + column: "GroupName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissions_Name", + table: "AbpPermissions", + column: "Name", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpPermissionGroups"); + + migrationBuilder.DropTable( + name: "AbpPermissions"); + + migrationBuilder.DropTable( + name: "AbpUserDelegations"); + + migrationBuilder.DropColumn( + name: "Biography", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Company", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Github", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "JobTitle", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Linkedin", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Twitter", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "WebSite", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "LastPasswordChangeTime", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "ShouldChangePasswordOnNextLogin", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpRoles"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpOrganizationUnits"); + } + } +} diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs index 882783d768..b6dc962eaf 100644 --- a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs @@ -19,10 +19,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "7.0.1") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => { @@ -183,6 +183,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -369,6 +372,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasDefaultValue(false) .HasColumnName("EmailConfirmed"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -397,6 +403,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); + b.Property("LastPasswordChangeTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -445,6 +454,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(256)") .HasColumnName("SecurityStamp"); + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("bit"); + b.Property("Surname") .HasMaxLength(64) .HasColumnType("nvarchar(64)") @@ -507,6 +519,33 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpUserClaims", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { b.Property("UserId") @@ -647,6 +686,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(128)") .HasColumnName("DisplayName"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -708,6 +750,59 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpOrganizationUnitRoles", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") @@ -742,6 +837,34 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpPermissionGrants", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1099,6 +1222,16 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("Biography") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Biography"); + + b.Property("Company") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("Company"); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasMaxLength(40) @@ -1121,10 +1254,25 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); + b.Property("Github") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Github"); + b.Property("IsActive") .HasColumnType("bit") .HasColumnName("IsActive"); + b.Property("JobTitle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("JobTitle"); + + b.Property("Linkedin") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Linkedin"); + b.Property("Name") .HasMaxLength(64) .HasColumnType("nvarchar(64)") @@ -1150,12 +1298,22 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); + b.Property("Twitter") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Twitter"); + b.Property("UserName") .IsRequired() .HasMaxLength(256) .HasColumnType("nvarchar(256)") .HasColumnName("UserName"); + b.Property("WebSite") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("WebSite"); + b.HasKey("Id"); b.ToTable("BlgUsers", (string)null); diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs new file mode 100644 index 0000000000..8cd675ec1f --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs @@ -0,0 +1,38 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Blogging.Users; + +namespace Volo.Blogging.Members; + +public class CustomIdentityBlogUserUpdateDto +{ + [StringLength(UserConsts.MaxNameLength)] + public string Name { get; set; } + + [StringLength(UserConsts.MaxSurnameLength)] + public string Surname { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "PersonalSiteUrlValidationMessage")] + [StringLength(UserConsts.MaxWebSiteLength)] + public string WebSite { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "TwitterUserNameValidationMessage")] + [StringLength(UserConsts.MaxTwitterLength)] + public string Twitter { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "GitHubUserNameValidationMessage")] + [StringLength(UserConsts.MaxGithubLength)] + public string Github { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "LinkedinUrlValidationMessage")] + [StringLength(UserConsts.MaxLinkedinLength)] + public string Linkedin { get; set; } + + [StringLength(UserConsts.MaxCompanyLength)] + public string Company { get; set; } + + [StringLength(UserConsts.MaxJobTitleLength)] + public string JobTitle { get; set; } + + [StringLength(UserConsts.MaxBiographyLength)] + public string Biography { get; set; } +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs index 5e06d20956..a085d039ac 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs @@ -7,4 +7,6 @@ namespace Volo.Blogging.Members; public interface IMemberAppService : IApplicationService { Task FindAsync(string username); + + Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input); } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs index eb4f707e34..23e65b9e95 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs @@ -8,6 +8,10 @@ namespace Volo.Blogging.Posts { public Guid? TenantId { get; set; } + public string Name { get; set; } + + public string Surname { get; set; } + public string UserName { get; set; } public string Email { get; set; } @@ -17,7 +21,21 @@ namespace Volo.Blogging.Posts public string PhoneNumber { get; set; } public bool PhoneNumberConfirmed { get; set; } + + public string WebSite { get; set; } + + public string Twitter { get; set; } + + public string Github { get; set; } + + public string Linkedin { get; set; } + + public string Company { get; set; } + public string JobTitle { get; set; } + + public string Biography { get; set; } + public Dictionary ExtraProperties { get; set; } } } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs index e27c0baefa..afc5eac0b6 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs @@ -26,4 +26,21 @@ public class MemberAppService : BloggingAppServiceBase, IMemberAppService return ObjectMapper.Map(user); } + + public async Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) + { + var user = await _userRepository.GetAsync(CurrentUser.Id.Value); + + user.Name = input.Name; + user.Surname = input.Surname; + user.WebSite = input.WebSite; + user.Twitter = input.Twitter; + user.Github = input.Github; + user.Linkedin = input.Linkedin; + user.Company = input.Company; + user.JobTitle = input.JobTitle; + user.Biography = input.Biography; + + await _userRepository.UpdateAsync(user); + } } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json index d4bfede795..d9c7595247 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json @@ -61,6 +61,17 @@ "FileUploadInfo": "Drag, drop, or paste a copied image.", "PostDescriptionHint": "* Will be rendered in the article link preview, supports HTML", "ReadMore": "Continue Reading", - "MemberNotPublishedPostYet": "No posts yet!" + "MemberNotPublishedPostYet": "No posts yet!", + "UpdateUserWebSiteInfo": "Example: https://johndoe.com", + "UpdateUserTwitterInfo": "Example: johndoe", + "UpdateUserGithubInfo": "Example: johndoe", + "UpdateUserLinkedinInfo": "Example: https://www.linkedin.com/...", + "UpdateUserCompanyInfo": "Example: Volosoft", + "UpdateUserJobTitleInfo": "Example: Software Developer", + "WebSite": "Web Site", + "UserName": "Username", + "FullURL": "Full URL", + "JobTitle": "Job Title", + "PersonalWebsite": "PERSONAL WEBSITE" } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs new file mode 100644 index 0000000000..3ad08da0d2 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs @@ -0,0 +1,22 @@ +namespace Volo.Blogging.Users; + +public class UserConsts +{ + public const int MaxNameLength = 64; + + public const int MaxSurnameLength = 64; + + public const int MaxBiographyLength = 1000; + + public const int MaxWebSiteLength = 256; + + public const int MaxTwitterLength = 64; + + public const int MaxGithubLength = 64; + + public const int MaxLinkedinLength = 64; + + public const int MaxCompanyLength = 128; + + public const int MaxJobTitleLength = 32; +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs index 4b7e5b63e8..c7dfa77650 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Users; @@ -23,6 +24,27 @@ namespace Volo.Blogging.Users public virtual string PhoneNumber { get; protected set; } public virtual bool PhoneNumberConfirmed { get; protected set; } + + [CanBeNull] + public string WebSite { get; set; } + + [CanBeNull] + public string Twitter { get; set; } + + [CanBeNull] + public string Github { get; set; } + + [CanBeNull] + public string Linkedin { get; set; } + + [CanBeNull] + public string Company { get; set; } + + [CanBeNull] + public string JobTitle { get; set; } + + [CanBeNull] + public string Biography { get; set; } protected BlogUser() { diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs index abf96ebcef..5388c4f313 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs @@ -26,8 +26,16 @@ namespace Volo.Blogging.EntityFrameworkCore builder.Entity(b => { b.ToTable(AbpBloggingDbProperties.DbTablePrefix + "Users", AbpBloggingDbProperties.DbSchema); - b.ConfigureByConvention(); + + b.Property(nameof(BlogUser.Biography)).HasMaxLength(UserConsts.MaxBiographyLength).HasColumnName(nameof(BlogUser.Biography)); + b.Property(nameof(BlogUser.WebSite)).HasMaxLength(UserConsts.MaxWebSiteLength).HasColumnName(nameof(BlogUser.WebSite)); + b.Property(nameof(BlogUser.Twitter)).HasMaxLength(UserConsts.MaxTwitterLength).HasColumnName(nameof(BlogUser.Twitter)); + b.Property(nameof(BlogUser.Github)).HasMaxLength(UserConsts.MaxGithubLength).HasColumnName(nameof(BlogUser.Github)); + b.Property(nameof(BlogUser.Linkedin)).HasMaxLength(UserConsts.MaxLinkedinLength).HasColumnName(nameof(BlogUser.Linkedin)); + b.Property(nameof(BlogUser.Company)).HasMaxLength(UserConsts.MaxCompanyLength).HasColumnName(nameof(BlogUser.Company)); + b.Property(nameof(BlogUser.JobTitle)).HasMaxLength(UserConsts.MaxJobTitleLength).HasColumnName(nameof(BlogUser.JobTitle)); + b.ConfigureAbpUser(); b.ApplyObjectExtensionMappings(); diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs index dfabaed346..4a563e79e3 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs @@ -25,4 +25,12 @@ public partial class MembersClientProxy : ClientProxyBase, IM { typeof(string), username } }); } + + public Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) + { + return RequestAsync(nameof(UpdateUserProfileAsync), new ClientProxyRequestTypeValue + { + { typeof(CustomIdentityBlogUserUpdateDto), input } + }); + } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index df6ab306e0..3b249ffff7 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -1,4 +1,5 @@ @page +@using System.Globalization @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Http.Extensions @using Microsoft.Extensions.Options @@ -11,6 +12,13 @@ @inject IAuthorizationService Authorization @inject IOptionsSnapshot twitterOptions @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Blockquote +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid +@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers @using Volo.Blogging.Localization @using Volo.Blogging.Pages.Blog @inject IHtmlLocalizer L @@ -355,6 +363,51 @@ { @L["LeaveComment"] } +
+
+

More from @CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Model.Post.Writer.UserName)

+ @for (var index = 1; index < Model.PostsList.Count && index < 5; index++) + { + var post = Model.PostsList[index]; +
+
+ + + + + + + @L["Blog"].Value.ToUpper() + +
+
+ +

+ + @post.Title + +

+

+ + @post.Description.TruncateWithPostfix(150) + + @L["ReadMore"] +

+
+
+
+ +
+
+
+ } +
+
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs index 0dd95c0769..f902d849f9 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs @@ -40,6 +40,8 @@ namespace Volo.Blogging.Pages.Blog.Posts public BlogDto Blog { get; set; } + public List PostsList { get; set; } + public DetailModel(IPostAppService postAppService, IBlogAppService blogAppService, ICommentAppService commentAppService) { _postAppService = postAppService; @@ -79,6 +81,7 @@ namespace Volo.Blogging.Pages.Blog.Posts { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); + PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id); CountComments(); } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml index 62841ae158..58ab94f310 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml @@ -1,7 +1,12 @@ @page +@using System.Globalization @using Microsoft.Extensions.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Utils @using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers @using Volo.Abp.Users +@using Volo.Blogging +@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers @using Volo.Blogging.Localization @model Volo.Blogging.Pages.Members.IndexModel @inject IStringLocalizer L @@ -23,12 +28,69 @@
- @if (Model.User.UserName != null) + @if (Model.User.Name != null && Model.User.Surname != null) { -

@Model.User.UserName

+

@Model.User.Name @Model.User.Surname

} - @L["UserName"].Value.ToUpper() + @if (Model.User.Company != null) + { +

@Model.User.Company

+ } + @if (Model.User.JobTitle != null) + { +

@Model.User.JobTitle

+ } + + @L["UserName"].Value.ToUpper()
@Model.User.UserName
+ + @if (Model.User.WebSite != null) + { + @L["PersonalWebsite"].Value.ToUpper() +
+ @Model.User.WebSite +
+ } + + + @if (Model.User.Twitter != null || Model.User.Github != null || Model.User.Linkedin != null) + { + @L["Social"].Value.ToUpper() +
    + @if (Model.User.Twitter != null) + { +
  • + +
    +
    +
  • + } + @if (Model.User.Github != null) + { +
  • + +
    +
    +
  • + } + @if (Model.User.Linkedin != null) + { +
  • + +
    +
    +
  • + } +
+ } + + @if (Model.User.Biography != null) + { +
+ @L["Biography"].Value.ToUpper() +

@Model.User.Biography

+
+ } @@ -36,7 +98,7 @@ {
- +
@foreach (var post in Model.Posts) { @@ -80,6 +142,42 @@ }
+ @if (CurrentUser.UserName == Model.User.UserName) + { + +
+
+ + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+ +
+
+
+
+ }
} diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs index 8018ea23e8..43cd31fd4a 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs @@ -23,6 +23,9 @@ public class IndexModel : AbpPageModel public Dictionary BlogShortNameMap { get; set; } + [BindProperty] + public CustomIdentityBlogUserUpdateDto CustomUserUpdate { get; set; } + public IndexModel(IPostAppService postAppService, IMemberAppService memberAppService, IBlogAppService blogAppService) { _postAppService = postAppService; @@ -51,6 +54,14 @@ public class IndexModel : AbpPageModel return Page(); } + + public async Task OnPostAsync() + { + await _memberAppService.UpdateUserProfileAsync(CustomUserUpdate); + + return Redirect($"/members/{CurrentUser.UserName}"); + } + public string GetBlogPostUrl(PostWithDetailsDto post) { var blogShortName = BlogShortNameMap[post.BlogId]; From d9c3818d6273c334a08c97e2282675aad3b5c353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Fri, 5 May 2023 16:10:35 +0300 Subject: [PATCH 2/8] blogging: changes applied to user-interface --- .../Pages/Blogs/Posts/Detail.cshtml | 701 ++++++++++-------- .../Pages/Blogs/Posts/Detail.cshtml.cs | 6 + .../Pages/Blogs/Posts/detail.js | 10 + .../Pages/Blogs/Shared/Styles/blog.css | 6 + .../Volo.Blogging.Web/Pages/Members/Index.css | 5 +- 5 files changed, 417 insertions(+), 311 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index 3b249ffff7..37780167bb 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -13,12 +13,6 @@ @inject IOptionsSnapshot twitterOptions @using Microsoft.AspNetCore.Mvc.Localization @using Microsoft.AspNetCore.Mvc.TagHelpers -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Blockquote -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid -@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers @using Volo.Blogging.Localization @using Volo.Blogging.Pages.Blog @inject IHtmlLocalizer L @@ -57,359 +51,446 @@ }
- -
-
-
-
-
-
-

@Model.Post.Title

+ +
+
+
+
+
+
+

@Model.Post.Title

+
+ +
+
+
+ Cover Image +
+
+
+
+
+
+
+ @if (Model.Post.Writer != null) + { + + User Avatar + + } +
+ +
+

Last Blog Posts

+ @for (var index = 0; index < Model.LatestPosts.Count && index < 4; index++) + { + if (Model.LatestPosts[index].Id != Model.Post.Id) + { + var post = Model.LatestPosts[index]; + +
+
-
- Cover Image -
-
-
-
+
+ } + }
+
+
+ +
+
+
+

+ @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+
+
+
+ +
+
+ +
+
+@if (Model.Post.Tags.Count > 0) +{ +
+
@L["TagsInThisArticle"]
+ @foreach (var tag in Model.Post.Tags) + { + @tag.Name + } +
+} + +@if (Model.CommentsWithReplies.Count > 0) +{ + + +

@L["CommentWithCount", @Model.CommentCount]

+ @if (hasCommentingPermission) + { + @L["LeaveComment"] + } + else + { + @L["LeaveComment"] + } +
+
-
-
-
-

- @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+ @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) + { +
+ User Avatar +
+
+ @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) + @BloggingPageHelper.ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) +
+

+ @commentWithRepliesDto.Comment.Text

-
-
-
+
-
-
-
-
- @(L["ShareOn"].Value + " :") - - Twitter - - - Linkedin - - - E-mail - -
- @if (Model.Post.Tags.Count > 0) - { -
-
@L["TagsInThisArticle"]
- @foreach (var tag in Model.Post.Tags) + @if (hasCommentingPermission) { - @tag.Name + + @L["Reply"] + } -
- } - @if (Model.CommentsWithReplies.Count > 0) - { - - -

@L["CommentWithCount", @Model.CommentCount]

- @if (hasCommentingPermission) - { - @L["LeaveComment"] - } - else - { - @L["LeaveComment"] - } -
-
+ @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { + | + + @L["Delete"] + + } -
- @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
- User Avatar -
-
- @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) - @BloggingPageHelper.ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) -
-

- @commentWithRepliesDto.Comment.Text -

-
+ | + + @L["Edit"] + + } +
- @if (hasCommentingPermission) - { - - @L["Reply"] - - } + @if (hasCommentingPermission) + { +
+
+

+ @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Delete"] - - } +

+
+
+ + - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
+
+ +
+ + + +
+
+
+ } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
+
+
+
+ + +
+ +
+ + + +
+
+
+ } + + @foreach (var reply in commentWithRepliesDto.Replies) + { +
+ User Avatar +
+
+ @(reply.Writer == null ? "" : reply.Writer.UserName) + @BloggingPageHelper.ConvertDatetimeToTimeAgo(reply.CreationTime) +
+

+ @reply.Text +

+
@if (hasCommentingPermission) { -
-
-

- @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] - -

-
-
- - - -
- -
- - - -
-
-
+ + @L["Reply"] + } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
-
-
-
- - -
- -
- - - -
-
-
+ | + + @L["Delete"] + } - @foreach (var reply in commentWithRepliesDto.Replies) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
- User Avatar -
-
- @(reply.Writer == null ? "" : reply.Writer.UserName) - @BloggingPageHelper.ConvertDatetimeToTimeAgo(reply.CreationTime) -
-

- @reply.Text -

-
- - @if (hasCommentingPermission) - { - - @L["Reply"] - - } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Delete"] - - } - - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
+ | + + @L["Edit"] + + } +
- @if (hasCommentingPermission) - { -
-
-

- @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] -

-
-
- - -
- -
- - - -
-
+ @if (hasCommentingPermission) + { +
+
+

+ @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] +

+
+
+ + +
+
- } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { -
-
-
- - -
- -
- - - -
-
+ + + +
+
+
+ } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
+
+
+
+ +
+
- } + + +
- } -
-
- } -
- } - - @if (hasCommentingPermission) - { -
-
-

@L["LeaveComment"]

-
-
-
-
- - -
-
- - -
-
-
- } - else - { - @L["LeaveComment"] - } -
-
-

More from @CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Model.Post.Writer.UserName)

- @for (var index = 1; index < Model.PostsList.Count && index < 5; index++) - { - var post = Model.PostsList[index]; -
-
- - - - - - - @L["Blog"].Value.ToUpper() - -
-
- -

- - @post.Title - -

-

- - @post.Description.TruncateWithPostfix(150) - - @L["ReadMore"] -

-
-
-
- -
+ }
}
+ } +
+} + +@if (hasCommentingPermission) +{ +
+
+

@L["LeaveComment"]

+
+
+
+
+ + +
+ +
+ +
+} +else +{ + @L["LeaveComment"] +} +
+
+

More from @CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Model.Post.Writer.UserName)

+ @for (var index = 0; index < Model.PostsList.Count && index <= 5; index++) + { + if (Model.PostsList[index].Id != Model.Post.Id) + { + var post = Model.PostsList[index]; +
+
+ + + + + + + @L["Blog"].Value.ToUpper() + +
+
+ +

+ + @post.Title + +

+

+ + @post.Description.TruncateWithPostfix(150) + + @L["ReadMore"] +

+
+
+
+ +
+
+
+ } + + } +
+
+
+
+ +
+
+
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs index f902d849f9..49bef9c549 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs @@ -41,6 +41,11 @@ namespace Volo.Blogging.Pages.Blog.Posts public BlogDto Blog { get; set; } public List PostsList { get; set; } + + public IReadOnlyList LatestPosts { get; set; } + + [BindProperty(SupportsGet = true)] + public string TagName { get; set; } public DetailModel(IPostAppService postAppService, IBlogAppService blogAppService, ICommentAppService commentAppService) { @@ -82,6 +87,7 @@ namespace Volo.Blogging.Pages.Blog.Posts Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); + LatestPosts = (await _postAppService.GetListByBlogIdAndTagNameAsync(Blog.Id, TagName)).Items; CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id); CountComments(); } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js index 7a0d0da168..b6d1a2d975 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js @@ -15,6 +15,12 @@ pageHeader + ' | ' + blogName + ' | ' + window.location.href ) ); + + $('#FacebookShareLink').attr( + 'href', + 'https://www.facebook.com/sharer/sharer.php?u=' + + encodeURI(window.location.href) + ); $('#LinkedinShareLink').attr( 'href', @@ -43,6 +49,10 @@ encodeURI(pageHeader + ' | ' + blogName) + '&' ); + + $(".copy-link").click(function() { + var copiedLink = $(this); + }); }; $('div .replyForm').hide(); diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css index 6aac0e363b..66328cb885 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css @@ -320,3 +320,9 @@ div.vs-blog { text-decoration: none; } div.vs-blog > .form-group { margin: 0 !important; } +.last-post-title{ + font-size: 0.9rem; + font-weight: 550; + text-decoration: none; + color: black; +} diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css index 4c5167a694..668e566cba 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css @@ -1,3 +1,6 @@ .post-desc { overflow-wrap: break-word; -} \ No newline at end of file +} +a:not(#all-posts-tab,#edit-profile-tab) { + color: unset!important; +} From 7d61b8e9434e9cf45d7704b0fd5d5c538c82f791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Mon, 8 May 2023 11:23:25 +0300 Subject: [PATCH 3/8] cms-kit: detail page edited and member page deficiencies completed --- .../Blogging/Localization/Resources/en.json | 3 ++- .../Pages/Blogs/Posts/Detail.cshtml | 24 ++++++++++------- .../Pages/Blogs/Posts/detail.js | 15 +++++++---- .../Pages/Blogs/Shared/Styles/blog.css | 26 +++++++++++++++++-- .../Pages/Members/Index.cshtml | 6 ++++- .../Volo.Blogging.Web/Pages/Members/Index.js | 12 +++++++++ 6 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json index d9c7595247..989926f760 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json @@ -72,6 +72,7 @@ "UserName": "Username", "FullURL": "Full URL", "JobTitle": "Job Title", - "PersonalWebsite": "PERSONAL WEBSITE" + "PersonalWebsite": "PERSONAL WEBSITE", + "EditProfile": "Edit Profile" } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index 37780167bb..790b04ccdf 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -52,7 +52,7 @@
-
+
@@ -114,9 +114,9 @@ - +
@@ -130,8 +130,8 @@
-
-
+
+
@if (Model.Post.Writer != null) { @@ -159,10 +159,14 @@

@Model.Post.Writer.JobTitle

}
+ @if (CurrentUser.UserName == Model.Post.Writer.UserName) + { + @L["EditProfile"] + }

Last Blog Posts

- @for (var index = 0; index < Model.LatestPosts.Count && index < 4; index++) + @for (var index = 0; index < Model.LatestPosts.Count && index < 5; index++) { if (Model.LatestPosts[index].Id != Model.Post.Id) { @@ -178,12 +182,12 @@ @if (post.Writer != null) { - User Avatar + User Avatar }
-
+
@(post.Writer.UserName) @@ -214,7 +218,7 @@

-
+
@@ -487,7 +491,7 @@ else
-
+
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js index b6d1a2d975..59a148ef91 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js @@ -49,12 +49,17 @@ encodeURI(pageHeader + ' | ' + blogName) + '&' ); - - $(".copy-link").click(function() { - var copiedLink = $(this); - }); }; - + + $('#CopyLink').click(function (event) { + event.preventDefault(); + var $temp = $(''); + $('body').append($temp); + $temp.val(window.location.href).select(); + document.execCommand('copy'); + $temp.remove(); + }); + $('div .replyForm').hide(); $('div .editForm').hide(); diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css index 66328cb885..b24425f547 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css @@ -321,8 +321,30 @@ div.vs-blog { div.vs-blog > .form-group { margin: 0 !important; } .last-post-title{ - font-size: 0.9rem; - font-weight: 550; + font-size: 15px; + line-height: 20px; + font-weight: 700; + letter-spacing: 0px; text-decoration: none; color: black; } +.last-post-image{ + width: 30px; + height: 30px; + border-top-left-radius: 50%; + border-top-right-radius: 50%; + border-bottom-right-radius: 50%; + border-bottom-left-radius: 50%; +} +.last-post-name{ + padding-right: 2px; + max-height: 16px; + padding-top: 0.5em; + padding-right: 0.5em; +} +#CopyLink{ + padding: 0; + border: none; + background: none; +} + diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml index 58ab94f310..d8fba6b491 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml @@ -15,6 +15,10 @@ ViewBag.Title = @Model.User.UserName.ToUpper() + " - " + L["Blogs"].Value; } +@section scripts { + +} + @section styles { } @@ -146,7 +150,7 @@ {
-
+ diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js new file mode 100644 index 0000000000..c20251820f --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js @@ -0,0 +1,12 @@ +$(function () { + debugger + var hash = window.location.hash; + if(hash === '#edit-profile'){ + console.log("asdasdsa") + $('#all-posts-tab').removeClass('active'); + $('#all-posts').removeClass('show').removeClass('active'); + $('#edit-profile-tab').addClass('active'); + $('#edit-profile').addClass('show').addClass('active'); + window.location.hash = ''; + } +}); \ No newline at end of file From eaec068e1b60aa5cb25e71e6f8eb6c73fc6f6086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Tue, 9 May 2023 13:47:08 +0300 Subject: [PATCH 4/8] refactoring --- .../Pages/Blogs/Posts/Detail.cshtml | 4 +- .../Pages/Members/Index.cshtml | 112 +++++++++--------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index 790b04ccdf..a03bd22af3 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -131,7 +131,7 @@
-
+
@if (Model.Post.Writer != null) { @@ -165,7 +165,7 @@ }

-

Last Blog Posts

+

More from Blog

@for (var index = 0; index < Model.LatestPosts.Count && index < 5; index++) { if (Model.LatestPosts[index].Id != Model.Post.Id) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml index d8fba6b491..12ed3cc854 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml @@ -98,54 +98,63 @@
- @if (Model.Posts is not null && Model.Posts.Any()) - { -
+
- -
- @foreach (var post in Model.Posts) - { -
-
- - - - - - - @L["Blog"].Value.ToUpper() - -
-
- -

- - @post.Title - -

-

- - @post.Description.TruncateWithPostfix(150) - - @L["ReadMore"] -

-
-
-
- -
-
-
- } -
-
+ @if (Model.Posts is not null && Model.Posts.Any()) + { + +
+ @foreach (var post in Model.Posts) + { +
+
+ + + + + + + @L["Blog"].Value.ToUpper() + +
+
+ +

+ + @post.Title + +

+

+ + @post.Description.TruncateWithPostfix(150) + + @L["ReadMore"] +

+
+
+
+ +
+
+
+ } +
+
+ } + else + { +
+
+

@L["MemberNotPublishedPostYet"]

+
+
+ } @if (CurrentUser.UserName == Model.User.UserName) { @@ -184,15 +193,6 @@ }
- } - else - { -
-
-

@L["MemberNotPublishedPostYet"]

-
-
- }
\ No newline at end of file From 01a00589e8eb7323dc806d0c41bf25744930e444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Fri, 12 May 2023 08:50:08 +0300 Subject: [PATCH 5/8] a new method has been written for recent posts --- .../Volo/Blogging/Posts/IPostAppService.cs | 2 ++ .../Volo/Blogging/Posts/PostAppService.cs | 29 +++++++++++++++++++ .../Volo/Blogging/Posts/IPostRepository.cs | 2 ++ .../Volo/Blogging/Users/BlogUser.cs | 14 ++++----- .../Blogging/Posts/EfCorePostRepository.cs | 9 ++++++ .../PostsClientProxy.Generated.cs | 9 ++++++ .../Volo/Blogging/PostsController.cs | 7 +++++ .../Blogging/Posts/MongoPostRepository.cs | 10 +++++++ .../Pages/Blogs/Posts/Detail.cshtml | 4 +-- .../Pages/Blogs/Posts/Detail.cshtml.cs | 2 +- .../Volo.Blogging.Web/Pages/Members/Index.js | 2 -- 11 files changed, 78 insertions(+), 12 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index e4af45a345..2fbb5bd845 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -23,5 +23,7 @@ namespace Volo.Blogging.Posts Task UpdateAsync(Guid id, UpdatePostDto input); Task> GetListByUserIdAsync(Guid userId); + + Task> GetLatestBlogPostsAsync(Guid blogId, int count); } } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 0158dc0e5a..939dc29640 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -195,6 +195,35 @@ namespace Volo.Blogging.Posts return ObjectMapper.Map, List>(posts); } + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + var posts = await PostRepository.GetLatestBlogPostsAsync(blogId, count); + var userDictionary = new Dictionary(); + var postDtos = new List(ObjectMapper.Map, List>(posts)); + + foreach (var postDto in postDtos) + { + if (postDto.CreatorId.HasValue) + { + if (!userDictionary.ContainsKey(postDto.CreatorId.Value)) + { + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + userDictionary[creatorUser.Id] = ObjectMapper.Map(creatorUser); + } + } + + if (userDictionary.ContainsKey(postDto.CreatorId.Value)) + { + postDto.Writer = userDictionary[(Guid)postDto.CreatorId]; + } + } + } + + return new List(postDtos); + } + [Authorize(BloggingPermissions.Posts.Create)] public async Task CreateAsync(CreatePostDto input) { diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs index 33a6377264..d29d72fc8b 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs @@ -17,5 +17,7 @@ namespace Volo.Blogging.Posts Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default); Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default); + + Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default); } } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs index c7dfa77650..cbe530f11f 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs @@ -26,25 +26,25 @@ namespace Volo.Blogging.Users public virtual bool PhoneNumberConfirmed { get; protected set; } [CanBeNull] - public string WebSite { get; set; } + public virtual string WebSite { get; set; } [CanBeNull] - public string Twitter { get; set; } + public virtual string Twitter { get; set; } [CanBeNull] - public string Github { get; set; } + public virtual string Github { get; set; } [CanBeNull] - public string Linkedin { get; set; } + public virtual string Linkedin { get; set; } [CanBeNull] - public string Company { get; set; } + public virtual string Company { get; set; } [CanBeNull] - public string JobTitle { get; set; } + public virtual string JobTitle { get; set; } [CanBeNull] - public string Biography { get; set; } + public virtual string Biography { get; set; } protected BlogUser() { diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index 48dfabb77e..98d2d76685 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -70,6 +70,15 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + { + var query = (await GetDbSetAsync()).Where(p => p.BlogId == blogId) + .OrderByDescending(p => p.CreationTime) + .Take(count); + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } + public override async Task> WithDetailsAsync() { return (await GetQueryableAsync()).IncludeDetails(); diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs index 697606f05c..7f730ee3f2 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs @@ -74,6 +74,15 @@ public partial class PostsClientProxy : ClientProxyBase, IPostA }); } + public Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + return RequestAsync>(nameof(GetLatestBlogPostsAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid), blogId }, + { typeof(int), count } + }); + } + public virtual async Task DeleteAsync(Guid id) { await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index f2f31261a6..52d7a6426a 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -69,6 +69,13 @@ namespace Volo.Blogging return _postAppService.GetListByUserIdAsync(userId); } + [HttpGet] + [Route("{blogId}/latest/{count}")] + public Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + return _postAppService.GetLatestBlogPostsAsync(blogId, count); + } + [HttpDelete] [Route("{id}")] public Task DeleteAsync(Guid id) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index be6942eac2..eea6e82015 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; +using Nito.AsyncEx; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; @@ -66,5 +67,14 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + { + var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.BlogId == blogId) + .OrderByDescending(x => x.CreationTime) + .Take(count); + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index a03bd22af3..43ad9abc2f 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -439,12 +439,12 @@ } else { - @L["LeaveComment"] + @L["LeaveComment"] }

More from @CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Model.Post.Writer.UserName)

- @for (var index = 0; index < Model.PostsList.Count && index <= 5; index++) + @for (var index = 0; index < Model.PostsList.Count; index++) { if (Model.PostsList[index].Id != Model.Post.Id) { diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs index 49bef9c549..54d1a4e71d 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs @@ -87,7 +87,7 @@ namespace Volo.Blogging.Pages.Blog.Posts Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); - LatestPosts = (await _postAppService.GetListByBlogIdAndTagNameAsync(Blog.Id, TagName)).Items; + LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5); CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id); CountComments(); } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js index c20251820f..75f59564d2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js @@ -1,8 +1,6 @@ $(function () { - debugger var hash = window.location.hash; if(hash === '#edit-profile'){ - console.log("asdasdsa") $('#all-posts-tab').removeClass('active'); $('#all-posts').removeClass('show').removeClass('active'); $('#edit-profile-tab').addClass('active'); From 3a8834931bf7191d5100b46ec33b395904b9e62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= <98148844+onurpicakci@users.noreply.github.com> Date: Fri, 12 May 2023 14:19:07 +0300 Subject: [PATCH 6/8] refactoring --- .../Volo/Blogging/Posts/PostAppService.cs | 27 ++++++++++--------- .../Pages/Blogs/Posts/Detail.cshtml | 18 ++++--------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 939dc29640..1983bd3cbf 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -203,21 +203,22 @@ namespace Volo.Blogging.Posts foreach (var postDto in postDtos) { - if (postDto.CreatorId.HasValue) + if (!postDto.CreatorId.HasValue) { - if (!userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); - if (creatorUser != null) - { - userDictionary[creatorUser.Id] = ObjectMapper.Map(creatorUser); - } - } + continue; + } - if (userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - postDto.Writer = userDictionary[(Guid)postDto.CreatorId]; - } + if (userDictionary.TryGetValue(postDto.CreatorId.Value, out var creatorUserDto)) + { + postDto.Writer = creatorUserDto; + continue; + } + + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + postDto.Writer = ObjectMapper.Map(creatorUser); + userDictionary[creatorUser.Id] = postDto.Writer; } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index 43ad9abc2f..9c44b0feb2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -129,6 +129,11 @@
+
+

+ @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+
@@ -210,19 +215,6 @@
-
-
-
-

- @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) -

-
-
-
- -
-
-
@if (Model.Post.Tags.Count > 0) From 2c3653aff354c8ad85c56dc7f06824361bf5b8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alper=20Ebi=C3=A7o=C4=9Flu?= <9526587+ebicoglu@users.noreply.github.com> Date: Mon, 15 May 2023 14:09:55 +0300 Subject: [PATCH 7/8] Update UserConsts.cs --- .../Volo/Blogging/Users/UserConsts.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs index 3ad08da0d2..3cd7dd2252 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs @@ -10,13 +10,13 @@ public class UserConsts public const int MaxWebSiteLength = 256; - public const int MaxTwitterLength = 64; + public const int MaxTwitterLength = 128; - public const int MaxGithubLength = 64; + public const int MaxGithubLength = 256; - public const int MaxLinkedinLength = 64; + public const int MaxLinkedinLength = 256; - public const int MaxCompanyLength = 128; + public const int MaxCompanyLength = 256; - public const int MaxJobTitleLength = 32; -} \ No newline at end of file + public const int MaxJobTitleLength = 128; +} From 083ee84e4028ac2f4e4b7db3cf7194a58d307e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alper=20Ebi=C3=A7o=C4=9Flu?= <9526587+ebicoglu@users.noreply.github.com> Date: Mon, 15 May 2023 14:11:32 +0300 Subject: [PATCH 8/8] Update Index.js --- .../blogging/src/Volo.Blogging.Web/Pages/Members/Index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js index 75f59564d2..6cafed0455 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js @@ -1,10 +1,9 @@ $(function () { - var hash = window.location.hash; - if(hash === '#edit-profile'){ + if (window.location.hash === '#edit-profile'){ $('#all-posts-tab').removeClass('active'); $('#all-posts').removeClass('show').removeClass('active'); $('#edit-profile-tab').addClass('active'); $('#edit-profile').addClass('show').addClass('active'); window.location.hash = ''; } -}); \ No newline at end of file +});