Browse Source

Merge pull request #3432 from abpframework/akin/added-metaDescription-field-in-blog

added description field  in posts and updated create and edit page fo…
pull/3463/head
Alper Ebicoglu 6 years ago
committed by GitHub
parent
commit
8cd6d83f51
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 926
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200402110128_Added_Post_Description.Designer.cs
  2. 138
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200402110128_Added_Post_Description.cs
  3. 433
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs
  4. 5
      modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj
  5. 4
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs
  6. 2
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs
  7. 3
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/UpdatePostDto.cs
  8. 6
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs
  9. 3
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json
  10. 6
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs
  11. 7
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/Post.cs
  12. 1
      modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs
  13. 3
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml
  14. 14
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml
  15. 10
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs
  16. 14
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml
  17. 12
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs
  18. 36
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/edit.js
  19. 38
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.js

926
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200402110128_Added_Post_Description.Designer.cs

@ -0,0 +1,926 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.BloggingTestApp.EntityFrameworkCore;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
[DbContext(typeof(BloggingTestAppDbContext))]
[Migration("20200402110128_Added_Post_Description")]
partial class Added_Post_Description
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Description")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsStatic")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Regex")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<bool>("Required")
.HasColumnType("bit");
b.Property<int>("ValueType")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault")
.HasColumnType("bit");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic")
.HasColumnType("bit");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ClaimType")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<Guid>("RoleId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnName("AccessFailedCount")
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasColumnName("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.IsRequired()
.HasColumnName("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnName("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnName("PasswordHash")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnName("SecurityStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("TwoFactorEnabled")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("Email");
b.HasIndex("NormalizedEmail");
b.HasIndex("NormalizedUserName");
b.HasIndex("UserName");
b.ToTable("AbpUsers");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ClaimType")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(196)")
.HasMaxLength(196);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("UserId", "LoginProvider");
b.HasIndex("LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("RoleId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(2048)")
.HasMaxLength(2048);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Blogging.Blogs.Blog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ShortName")
.IsRequired()
.HasColumnName("ShortName")
.HasColumnType("nvarchar(32)")
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("BlgBlogs");
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("PostId")
.HasColumnName("PostId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("RepliedCommentId")
.HasColumnName("RepliedCommentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Text")
.IsRequired()
.HasColumnName("Text")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.HasKey("Id");
b.HasIndex("PostId");
b.HasIndex("RepliedCommentId");
b.ToTable("BlgComments");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BlogId")
.HasColumnName("BlogId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("Content")
.HasColumnName("Content")
.HasColumnType("nvarchar(max)")
.HasMaxLength(1048576);
b.Property<string>("CoverImage")
.IsRequired()
.HasColumnName("CoverImage")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(1000)")
.HasMaxLength(1000);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ReadCount")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("Url")
.IsRequired()
.HasColumnName("Url")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("BlogId");
b.ToTable("BlgPosts");
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.Property<Guid>("PostId")
.HasColumnName("PostId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("TagId")
.HasColumnName("TagId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.HasKey("PostId", "TagId");
b.HasIndex("TagId");
b.ToTable("BlgPostTags");
});
modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BlogId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<int>("UsageCount")
.HasColumnName("UsageCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("BlgTags");
});
modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnName("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("BlgUsers");
});
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.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.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();
});
#pragma warning restore 612, 618
}
}
}

138
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200402110128_Added_Post_Description.cs

@ -0,0 +1,138 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
public partial class Added_Post_Description : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "BlgUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 256,
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "BlgPosts",
maxLength: 1000,
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "NormalizedEmail",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 256,
oldNullable: true);
migrationBuilder.AlterColumn<bool>(
name: "IsDeleted",
table: "AbpUsers",
nullable: false,
defaultValue: false,
oldClrType: typeof(bool));
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 256,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ConcurrencyStamp",
table: "AbpUsers",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<string>(
name: "ConcurrencyStamp",
table: "AbpRoles",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "ConcurrencyStamp",
table: "AbpClaimTypes",
maxLength: 256,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "ExtraProperties",
table: "AbpClaimTypes",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Description",
table: "BlgPosts");
migrationBuilder.DropColumn(
name: "ConcurrencyStamp",
table: "AbpClaimTypes");
migrationBuilder.DropColumn(
name: "ExtraProperties",
table: "AbpClaimTypes");
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "BlgUsers",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<string>(
name: "NormalizedEmail",
table: "AbpUsers",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<bool>(
name: "IsDeleted",
table: "AbpUsers",
nullable: false,
oldClrType: typeof(bool),
oldDefaultValue: false);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "AbpUsers",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<string>(
name: "ConcurrencyStamp",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ConcurrencyStamp",
table: "AbpRoles",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
}
}
}

433
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs

@ -15,33 +15,52 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("ProductVersion", "3.1.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Description")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("IsStatic");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsStatic")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Regex")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<bool>("Required")
.HasColumnType("bit");
b.Property<int>("ValueType");
b.Property<int>("ValueType")
.HasColumnType("int");
b.HasKey("Id");
@ -51,31 +70,45 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
.HasColumnName("IsDefault")
.HasColumnType("bit");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
.HasColumnName("IsPublic")
.HasColumnType("bit");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
.HasColumnName("IsStatic")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
@ -87,18 +120,23 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("uniqueidentifier");
b.Property<string>("ClaimType")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
b.Property<Guid>("RoleId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
@ -110,97 +148,133 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnName("AccessFailedCount")
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasColumnName("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("Name")
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.IsRequired()
.HasColumnName("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnName("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnName("PasswordHash")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnName("SecurityStamp")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("TwoFactorEnabled")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -219,18 +293,23 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("uniqueidentifier");
b.Property<string>("ClaimType")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("UserId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
@ -241,19 +320,25 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(196)")
.HasMaxLength(196);
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("UserId", "LoginProvider");
@ -264,11 +349,15 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("RoleId");
b.Property<Guid>("RoleId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("UserId", "RoleId");
@ -279,17 +368,23 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Value");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
@ -299,21 +394,27 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
@ -325,20 +426,25 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(2048)")
.HasMaxLength(2048);
b.HasKey("Id");
@ -351,48 +457,63 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Blogs.Blog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ShortName")
.IsRequired()
.HasColumnName("ShortName")
.HasColumnType("nvarchar(32)")
.HasMaxLength(32);
b.HasKey("Id");
@ -403,45 +524,60 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("PostId")
.HasColumnName("PostId");
.HasColumnName("PostId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("RepliedCommentId")
.HasColumnName("RepliedCommentId");
.HasColumnName("RepliedCommentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Text")
.IsRequired()
.HasColumnName("Text")
.HasColumnType("nvarchar(1024)")
.HasMaxLength(1024);
b.HasKey("Id");
@ -456,57 +592,80 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BlogId")
.HasColumnName("BlogId");
.HasColumnName("BlogId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("Content")
.HasColumnName("Content")
.HasColumnType("nvarchar(max)")
.HasMaxLength(1048576);
b.Property<string>("CoverImage")
.IsRequired()
.HasColumnName("CoverImage");
.HasColumnName("CoverImage")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(1000)")
.HasMaxLength(1000);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ReadCount");
b.Property<int>("ReadCount")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("Url")
.IsRequired()
.HasColumnName("Url")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.HasKey("Id");
@ -519,14 +678,20 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.Property<Guid>("PostId")
.HasColumnName("PostId");
.HasColumnName("PostId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("TagId")
.HasColumnName("TagId");
.HasColumnName("TagId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.HasKey("PostId", "TagId");
@ -538,49 +703,65 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BlogId");
b.Property<Guid>("BlogId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
.HasColumnName("CreationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
.HasColumnName("CreatorId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
.HasColumnName("DeleterId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
.HasColumnName("DeletionTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
.HasColumnName("LastModificationTime")
.HasColumnType("datetime2");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<int>("UsageCount")
.HasColumnName("UsageCount");
.HasColumnName("UsageCount")
.HasColumnType("int");
b.HasKey("Id");
@ -590,45 +771,59 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnName("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnName("Name")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -638,80 +833,90 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
b.HasOne("Volo.Abp.Identity.IdentityRole", null)
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
b.HasOne("Volo.Abp.Identity.IdentityUser", null)
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
b.HasOne("Volo.Abp.Identity.IdentityUser", null)
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
b.HasOne("Volo.Abp.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Volo.Abp.Identity.IdentityUser")
b.HasOne("Volo.Abp.Identity.IdentityUser", null)
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
b.HasOne("Volo.Abp.Identity.IdentityUser", null)
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
b.HasOne("Volo.Blogging.Posts.Post", null)
.WithMany()
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Volo.Blogging.Comments.Comment")
b.HasOne("Volo.Blogging.Comments.Comment", null)
.WithMany()
.HasForeignKey("RepliedCommentId");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.HasOne("Volo.Blogging.Blogs.Blog")
b.HasOne("Volo.Blogging.Blogs.Blog", null)
.WithMany()
.HasForeignKey("BlogId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
b.HasOne("Volo.Blogging.Posts.Post", null)
.WithMany("Tags")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Volo.Blogging.Tagging.Tag")
b.HasOne("Volo.Blogging.Tagging.Tag", null)
.WithMany()
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}

5
modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj

@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
@ -17,8 +18,8 @@
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2" />
</ItemGroup>
<ItemGroup>

4
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs

@ -22,5 +22,9 @@ namespace Volo.Blogging.Posts
public string Content { get; set; }
public string Tags { get; set; }
[StringLength(PostConsts.MaxDescriptionLength)]
public string Description { get; set; }
}
}

2
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs

@ -18,6 +18,8 @@ namespace Volo.Blogging.Posts
public string Content { get; set; }
public string Description { get; set; }
public int ReadCount { get; set; }
public int CommentCount { get; set; }

3
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/UpdatePostDto.cs

@ -1,4 +1,5 @@
using System;
using System.Reflection;
namespace Volo.Blogging.Posts
{
@ -14,6 +15,8 @@ namespace Volo.Blogging.Posts
public string Content { get; set; }
public string Description { get; set; }
public string Tags { get; set; }
}
}

6
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs

@ -149,6 +149,7 @@ namespace Volo.Blogging.Posts
post.SetTitle(input.Title);
post.SetUrl(input.Url);
post.Content = input.Content;
post.Description = input.Description;
post.CoverImage = input.CoverImage;
post = await _postRepository.UpdateAsync(post);
@ -171,7 +172,10 @@ namespace Volo.Blogging.Posts
coverImage: input.CoverImage,
url: input.Url
)
{ Content = input.Content };
{
Content = input.Content,
Description = input.Description
};
await _postRepository.InsertAsync(post);

3
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json

@ -43,6 +43,7 @@
"Description": "Description",
"Blogs": "Blogs",
"Tags": "Tags",
"ShareOn": "Share on"
"ShareOn": "Share on",
"TitleLengthWarning": "Keep your title size under 60 characters to be SEO friendly!"
}
}

6
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs

@ -7,5 +7,11 @@
public const int MaxUrlLength = 64;
public const int MaxContentLength = 1024 * 1024; //1MB
public const int MaxDescriptionLength = 1000;
public const int MaxTitleLengthToBeSeoFriendly = 60;
public const int MaxSeoFriendlyDescriptionLength = 200;
}
}

7
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/Post.cs

@ -23,13 +23,16 @@ namespace Volo.Blogging.Posts
[CanBeNull]
public virtual string Content { get; set; }
[CanBeNull]
public virtual string Description { get; set; }
public virtual int ReadCount { get; protected set; }
public virtual Collection<PostTag> Tags { get; protected set; }
protected Post()
{
}
public Post(Guid id, Guid blogId, [NotNull] string title, [NotNull] string coverImage, [NotNull] string url)
@ -63,7 +66,7 @@ namespace Volo.Blogging.Posts
public virtual void AddTag(Guid tagId)
{
Tags.Add(new PostTag(Id,tagId));
Tags.Add(new PostTag(Id, tagId));
}
public virtual void RemoveTag(Guid tagId)

1
modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs

@ -57,6 +57,7 @@ namespace Volo.Blogging.EntityFrameworkCore
b.Property(x => x.CoverImage).IsRequired().HasColumnName(nameof(Post.CoverImage));
b.Property(x => x.Url).IsRequired().HasMaxLength(PostConsts.MaxUrlLength).HasColumnName(nameof(Post.Url));
b.Property(x => x.Content).IsRequired(false).HasMaxLength(PostConsts.MaxContentLength).HasColumnName(nameof(Post.Content));
b.Property(x => x.Description).IsRequired(false).HasMaxLength(PostConsts.MaxDescriptionLength).HasColumnName(nameof(Post.Description));
b.HasMany(p => p.Tags).WithOne().HasForeignKey(qt => qt.PostId);

3
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml

@ -9,7 +9,8 @@
@inject IAuthorizationService Authorization
@model DetailModel
@{
ViewBag.PageTitle = Model.Post.Title;
ViewBag.Title = Model.Post.Title;
ViewBag.Description = Model.Post.Description;
var hasCommentingPermission = CurrentUser.IsAuthenticated; //TODO: Apply real policy!
}
@section scripts {

14
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml

@ -1,6 +1,7 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
@using Volo.Blogging.Pages.Blog.Posts
@using Volo.Blogging.Posts
@model EditModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@{
@ -26,9 +27,18 @@
<div class="card-body">
<form method="post" id="edit-post-form">
<abp-input asp-for="Post.Title" auto-focus="true" />
<abp-alert
dismissible="true"
style="display: none"
id="title-length-warning"
data-max-length="@PostConsts.MaxTitleLengthToBeSeoFriendly">
@L["TitleLengthWarning"]
</abp-alert>
<abp-input asp-for="Post.Url" />
<abp-input asp-for="Post.CoverImage" />
<abp-row>
<abp-column size-sm="_9">
<div class="form-group">
@ -41,7 +51,9 @@
</abp-column>
</abp-row>
<abp-input asp-for="Post.Tags" />
<abp-input asp-for="Post.Description" />
<abp-input asp-for="Post.BlogId" />
<abp-input asp-for="Post.Id" />
<abp-input asp-for="Post.Content" />

10
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs

@ -42,7 +42,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
var postDto = await _postAppService.GetAsync(new Guid(PostId));
Post = ObjectMapper.Map<PostWithDetailsDto, EditPostViewModel>(postDto);
Post.Tags = String.Join(", ", postDto.Tags.Select(p=>p.Name).ToArray());
Post.Tags = String.Join(", ", postDto.Tags.Select(p => p.Name).ToArray());
return Page();
}
@ -56,7 +56,10 @@ namespace Volo.Blogging.Pages.Blog.Posts
Url = Post.Url,
CoverImage = Post.CoverImage,
Content = Post.Content,
Tags = Post.Tags
Tags = Post.Tags,
Description = Post.Description.IsNullOrEmpty() ?
Post.Content.Truncate(PostConsts.MaxSeoFriendlyDescriptionLength) :
Post.Description
};
var editedPost = await _postAppService.UpdateAsync(Post.Id, post);
@ -92,6 +95,9 @@ namespace Volo.Blogging.Pages.Blog.Posts
[StringLength(PostConsts.MaxContentLength)]
public string Content { get; set; }
[StringLength(PostConsts.MaxDescriptionLength)]
public string Description { get; set; }
public string Tags { get; set; }
}
}

14
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml

@ -1,6 +1,7 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
@using Volo.Blogging.Pages.Blog.Posts
@using Volo.Blogging.Posts
@model NewModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@{
@ -27,6 +28,14 @@
<form method="post" id="new-post-form">
<abp-input asp-for="Post.BlogId" />
<abp-input asp-for="Post.Title" auto-focus="true" />
<abp-alert dismissible="true"
style="display: none"
id="title-length-warning"
data-max-length="@PostConsts.MaxTitleLengthToBeSeoFriendly">
@L["TitleLengthWarning"]
</abp-alert>
<abp-input asp-for="Post.Url" />
<abp-input asp-for="Post.CoverImage" />
@ -44,6 +53,7 @@
<abp-input asp-for="Post.Content" />
<abp-input asp-for="Post.Tags" />
<abp-input asp-for="Post.Description" />
<div class="form-group">
@ -69,10 +79,10 @@
<a asp-page="./Index" class="btn btn-default mr-2"><span>@L["Cancel"]</span></a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>

12
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs

@ -54,7 +54,13 @@ namespace Volo.Blogging.Pages.Blog.Posts
public async Task<ActionResult> OnPost()
{
var blog = await _blogAppService.GetAsync(Post.BlogId);
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel,CreatePostDto>(Post));
if (string.IsNullOrEmpty(Post.Description))
{
Post.Description = Post.Content.Truncate(PostConsts.MaxSeoFriendlyDescriptionLength);
}
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel, CreatePostDto>(Post));
//TODO: Try Url.Page(...)
var urlPrefix = _blogOptions.RoutePrefix;
@ -84,6 +90,10 @@ namespace Volo.Blogging.Pages.Blog.Posts
public string Content { get; set; }
public string Tags { get; set; }
[StringLength(PostConsts.MaxDescriptionLength)]
public string Description { get; set; }
}
}
}

36
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/edit.js

@ -5,10 +5,18 @@
var $submitButton = $container.find("button[type=submit]");
var $form = $container.find("form#edit-post-form");
var editorDataKey = "tuiEditor";
var $titleLengthWarning = $("#title-length-warning");
var maxTitleLength = parseInt($titleLengthWarning.data("max-length"));
var $title = $('#Post_Title');
var $coverImage = $("#CoverImage");
var $postCoverImage = $('#Post_CoverImage');
var $coverImageFile = $('#CoverImageFile');
var setCoverImage = function (file) {
$('#Post_CoverImage').val(file.fileUrl);
$("#CoverImage").attr("src", file.fileUrl);
$postCoverImage.val(file.fileUrl);
$coverImage.attr("src", file.fileUrl);
};
var uploadCoverImage = function (file) {
@ -27,11 +35,28 @@
});
};
$('#CoverImageFile').change(function () {
if (!$('#CoverImageFile').prop('files').length) {
var checkTitleLength = function () {
var title = $title.val();
if (title.length > maxTitleLength) {
$titleLengthWarning.show();
} else {
$titleLengthWarning.hide();
}
};
checkTitleLength();
$title.on("change paste keyup", function () {
checkTitleLength();
});
$coverImageFile.change(function () {
if (!$coverImageFile.prop('files').length) {
return;
}
var file = $('#CoverImageFile').prop('files')[0];
var file = $coverImageFile.prop('files')[0];
uploadCoverImage(file);
});
@ -93,6 +118,7 @@
$submitButton.buttonBusy();
$(this).off('submit').submit();
return true;
});
});

38
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.js

@ -5,11 +5,18 @@
var $submitButton = $container.find("button[type=submit]");
var $form = $container.find("form#new-post-form");
var editorDataKey = "tuiEditor";
var $titleLengthWarning = $("#title-length-warning");
var maxTitleLength = parseInt($titleLengthWarning.data("max-length"));
var $title = $('#Post_Title');
var $url = $('#Post_Url');
var $coverImage = $("#CoverImage");
var $postCoverImage = $('#Post_CoverImage');
var $coverImageFile = $('#CoverImageFile');
var setCoverImage = function (file) {
$('#Post_CoverImage').val(file.fileUrl);
$("#CoverImage").attr("src", file.fileUrl);
$("#CoverImage").show();
$postCoverImage.val(file.fileUrl);
$coverImage.attr("src", file.fileUrl);
$coverImage.show();
};
var uploadCoverImage = function (file) {
@ -28,11 +35,11 @@
});
};
$('#CoverImageFile').change(function () {
if (!$('#CoverImageFile').prop('files').length) {
$coverImageFile.change(function () {
if (!$coverImageFile.prop('files').length) {
return;
}
var file = $('#CoverImageFile').prop('files')[0];
var file = $coverImageFile.prop('files')[0];
uploadCoverImage(file);
});
@ -40,7 +47,7 @@
var formData = new FormData();
formData.append('file', file);
$.ajax({
$.ajax({
type: "POST",
url: "/api/blogging/files/images/upload",
data: formData,
@ -92,33 +99,36 @@
$submitButton.buttonBusy();
$(this).off('submit').submit();
return true;
});
var urlEdited = false;
var reflectedChange = false;
$('#Post_Title').on("change paste keyup", function () {
$title.on("change paste keyup", function () {
if (urlEdited) {
return;
}
var title = $('#Post_Title').val();
var title = $title.val();
if (title.length > 64) {
title = title.substring(0, 64);
if (title.length > maxTitleLength) {
$titleLengthWarning.show();
} else {
$titleLengthWarning.hide();
}
title = title.replace(' ', '-');
title = title.replace(new RegExp(' ', 'g'), '-');
reflectedChange = true;
$('#Post_Url').val(title);
$url.val(title);
reflectedChange = false;
});
$('#Post_Url').change(function () {
$url.change(function () {
if (!reflectedChange) {
urlEdited = true;
}
});
});
});
Loading…
Cancel
Save