Browse Source

resolved #584

pull/594/head
Yunus Emre Kalkan 7 years ago
parent
commit
f23c99d2e3
  1. 769
      abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/20181108115654_Module_Changes.Designer.cs
  2. 129
      abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/20181108115654_Module_Changes.cs
  3. 32
      abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/AbpWebSiteDbContextModelSnapshot.cs
  4. 1
      abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Volo.AbpWebSite.EntityFrameworkCore.csproj
  5. 696
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108114856_Added_BlogId_To_Tags.Designer.cs
  6. 24
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108114856_Added_BlogId_To_Tags.cs
  7. 2
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs
  8. 6
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs
  9. 10
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/ITagAppService.cs
  10. 6
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs
  11. 51
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs
  12. 6
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs
  13. 5
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs
  14. 14
      modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs
  15. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs
  16. 54
      modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/TagAppService_Tests.cs
  17. 2
      modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs

769
abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/20181108115654_Module_Changes.Designer.cs

@ -0,0 +1,769 @@
// <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.AbpWebSite.EntityFrameworkCore;
namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
{
[DbContext(typeof(AbpWebSiteDbContext))]
[Migration("20181108115654_Module_Changes")]
partial class Module_Changes
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<bool>("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnName("AccessFailedCount")
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnName("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnName("PasswordHash")
.HasMaxLength(256);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("TwoFactorEnabled")
.HasDefaultValue(false);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.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")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid?>("TenantId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(196);
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "LoginProvider");
b.HasIndex("LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(64);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.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();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(1024);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(256);
b.Property<string>("ShortName")
.IsRequired()
.HasColumnName("ShortName")
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("BlgBlogs");
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid?>("RepliedCommentId")
.HasColumnName("RepliedCommentId");
b.Property<string>("Text")
.IsRequired()
.HasColumnName("Text")
.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();
b.Property<Guid>("BlogId")
.HasColumnName("BlogId");
b.Property<string>("Content")
.HasColumnName("Content")
.HasMaxLength(1048576);
b.Property<string>("CoverImage")
.IsRequired()
.HasColumnName("CoverImage");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<int>("ReadCount");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasMaxLength(512);
b.Property<string>("Url")
.IsRequired()
.HasColumnName("Url")
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("BlogId");
b.ToTable("BlgPosts");
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid>("TagId")
.HasColumnName("TagId");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.HasKey("PostId", "TagId");
b.HasIndex("TagId");
b.ToTable("BlgPostTags");
});
modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("BlogId");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(512);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<int>("UsageCount")
.HasColumnName("UsageCount");
b.HasKey("Id");
b.ToTable("BlgTags");
});
modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("BlgUsers");
});
modelBuilder.Entity("Volo.Docs.Projects.Project", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DefaultDocumentName")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("DocumentStoreType");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Format");
b.Property<string>("GoogleCustomSearchId");
b.Property<string>("LatestVersionBranchName")
.HasMaxLength(128);
b.Property<string>("MainWebsiteUrl");
b.Property<string>("MinimumVersion");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("NavigationDocumentName")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("DocsProjects");
});
modelBuilder.Entity("Volo.Utils.SolutionTemplating.DownloadInfo", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CreationDuration");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<byte>("DatabaseProvider");
b.Property<string>("ProjectName")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("TemplateName")
.IsRequired()
.HasMaxLength(42);
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(20);
b.HasKey("Id");
b.ToTable("Downloads");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany()
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Comments.Comment")
.WithMany()
.HasForeignKey("RepliedCommentId");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.HasOne("Volo.Blogging.Blogs.Blog")
.WithMany()
.HasForeignKey("BlogId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany("Tags")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Tagging.Tag")
.WithMany()
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

129
abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/20181108115654_Module_Changes.cs

@ -0,0 +1,129 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
{
public partial class Module_Changes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "BlgUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Surname",
table: "BlgUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "BlogId",
table: "BlgTags",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "AbpUsers",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatorId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "AbpUsers",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastModificationTime",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "LastModifierId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "AbpUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Surname",
table: "AbpUsers",
maxLength: 64,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name",
table: "BlgUsers");
migrationBuilder.DropColumn(
name: "Surname",
table: "BlgUsers");
migrationBuilder.DropColumn(
name: "BlogId",
table: "BlgTags");
migrationBuilder.DropColumn(
name: "CreationTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "CreatorId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "LastModificationTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "LastModifierId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "Name",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "Surname",
table: "AbpUsers");
}
}
}

32
abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Migrations/AbpWebSiteDbContextModelSnapshot.cs

@ -119,6 +119,14 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
@ -131,6 +139,12 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
@ -138,6 +152,10 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
@ -165,6 +183,10 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
@ -500,6 +522,8 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("BlogId");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
@ -557,6 +581,10 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
@ -566,6 +594,10 @@ namespace Volo.AbpWebSite.EntityFrameworkCore.Migrations
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");

1
abp_io/src/Volo.AbpWebSite.EntityFrameworkCore/Volo.AbpWebSite.EntityFrameworkCore.csproj

@ -7,6 +7,7 @@
<ItemGroup>
<Compile Remove="Migrations\20181107140744_Updated_Identity_20181107.cs" />
<Compile Remove="Migrations\20181108115619_Blogging_Changes.cs" />
</ItemGroup>
<ItemGroup>

696
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108114856_Added_BlogId_To_Tags.Designer.cs

@ -0,0 +1,696 @@
// <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("20181108114856_Added_BlogId_To_Tags")]
partial class Added_BlogId_To_Tags
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<bool>("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnName("AccessFailedCount")
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnName("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnName("PasswordHash")
.HasMaxLength(256);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("TwoFactorEnabled")
.HasDefaultValue(false);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.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")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid?>("TenantId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(196);
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "LoginProvider");
b.HasIndex("LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(64);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.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();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(1024);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(256);
b.Property<string>("ShortName")
.IsRequired()
.HasColumnName("ShortName")
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("BlgBlogs");
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid?>("RepliedCommentId")
.HasColumnName("RepliedCommentId");
b.Property<string>("Text")
.IsRequired()
.HasColumnName("Text")
.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();
b.Property<Guid>("BlogId")
.HasColumnName("BlogId");
b.Property<string>("Content")
.HasColumnName("Content")
.HasMaxLength(1048576);
b.Property<string>("CoverImage")
.IsRequired()
.HasColumnName("CoverImage");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<int>("ReadCount");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasMaxLength(512);
b.Property<string>("Url")
.IsRequired()
.HasColumnName("Url")
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("BlogId");
b.ToTable("BlgPosts");
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid>("TagId")
.HasColumnName("TagId");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.HasKey("PostId", "TagId");
b.HasIndex("TagId");
b.ToTable("BlgPostTags");
});
modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("BlogId");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(512);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<int>("UsageCount")
.HasColumnName("UsageCount");
b.HasKey("Id");
b.ToTable("BlgTags");
});
modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("BlgUsers");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany()
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Comments.Comment")
.WithMany()
.HasForeignKey("RepliedCommentId");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.HasOne("Volo.Blogging.Blogs.Blog")
.WithMany()
.HasForeignKey("BlogId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany("Tags")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Tagging.Tag")
.WithMany()
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

24
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108114856_Added_BlogId_To_Tags.cs

@ -0,0 +1,24 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
public partial class Added_BlogId_To_Tags : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "BlogId",
table: "BlgTags",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BlogId",
table: "BlgTags");
}
}
}

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

@ -522,6 +522,8 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("BlogId");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");

6
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/Dtos/GetPopularTagsInput.cs

@ -1,9 +1,13 @@
namespace Volo.Blogging.Tagging.Dtos
using System;
namespace Volo.Blogging.Tagging.Dtos
{
public class GetPopularTagsInput
{
public int ResultCount { get; set; } = 10;
public int? MinimumPostCount { get; set; }
public Guid BlogId { get; set; }
}
}

10
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/ITagAppService.cs

@ -8,16 +8,6 @@ namespace Volo.Blogging.Tagging
{
public interface ITagAppService : IApplicationService
{
Task<List<TagDto>> GetListAsync();
Task<List<TagDto>> GetListAsync(GetTagListInput input);
Task<TagDto> CreateAsync(CreateTagDto input);
Task<TagDto> UpdateAsync(Guid id, UpdateTagDto input);
Task DeleteAsync(Guid id);
Task<List<TagDto>> GetPopularTags(GetPopularTagsInput input);
}

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

@ -39,7 +39,7 @@ namespace Volo.Blogging.Posts
public async Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid id, string tagName)
{
var posts = _postRepository.GetPostsByBlogId(id);
var tag = tagName.IsNullOrWhiteSpace() ? null : await _tagRepository.FindByNameAsync(tagName);
var tag = tagName.IsNullOrWhiteSpace() ? null : await _tagRepository.FindByNameAsync(id, tagName);
var userDictionary = new Dictionary<Guid, BlogUserDto>();
var postDtos = new List<PostWithDetailsDto>(ObjectMapper.Map<List<Post>, List<PostWithDetailsDto>>(posts));
@ -242,7 +242,7 @@ namespace Volo.Blogging.Posts
private async Task AddNewTags(List<string> newTags, Post post)
{
var tags = await _tagRepository.GetListAsync();
var tags = await _tagRepository.GetListAsync(post.BlogId);
foreach (var newTag in newTags)
{
@ -250,7 +250,7 @@ namespace Volo.Blogging.Posts
if (tag == null)
{
tag = await _tagRepository.InsertAsync(new Tag(newTag, 1));
tag = await _tagRepository.InsertAsync(new Tag(post.BlogId, newTag, 1));
}
else
{

51
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs

@ -22,58 +22,9 @@ namespace Volo.Blogging.Tagging
_tagRepository = tagRepository;
}
public async Task<List<TagDto>> GetListAsync()
{
var tags = await _tagRepository.GetListAsync();
return new List<TagDto>(
ObjectMapper.Map<List<Tag>, List<TagDto>>(tags));
}
public async Task<List<TagDto>> GetListAsync(GetTagListInput input)
{
var tags = await _tagRepository.GetListAsync(input.Ids);
return new List<TagDto>(
ObjectMapper.Map<List<Tag>, List<TagDto>>(tags));
}
[Authorize(BloggingPermissions.Tags.Create)]
public async Task<TagDto> CreateAsync(CreateTagDto input)
{
var newTag = await _tagRepository.InsertAsync(
new Tag(
input.Name,
0,
input.Description
)
);
return ObjectMapper.Map<Tag, TagDto>(newTag);
}
[Authorize(BloggingPermissions.Tags.Update)]
public async Task<TagDto> UpdateAsync(Guid id, UpdateTagDto input)
{
var tag = await _tagRepository.GetAsync(id);
tag.SetName(input.Name);
tag.SetDescription(input.Description);
tag = await _tagRepository.UpdateAsync(tag);
return ObjectMapper.Map<Tag, TagDto>(tag);
}
[Authorize(BloggingPermissions.Tags.Delete)]
public async Task DeleteAsync(Guid id)
{
await _tagRepository.DeleteAsync(id);
}
public async Task<List<TagDto>> GetPopularTags(GetPopularTagsInput input)
{
var postTags = (await _tagRepository.GetListAsync()).OrderByDescending(t=>t.UsageCount)
var postTags = (await _tagRepository.GetListAsync(input.BlogId)).OrderByDescending(t=>t.UsageCount)
.WhereIf(input.MinimumPostCount != null, t=>t.UsageCount >= input.MinimumPostCount)
.Take(input.ResultCount).ToList();

6
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs

@ -7,11 +7,11 @@ namespace Volo.Blogging.Tagging
{
public interface ITagRepository : IBasicRepository<Tag, Guid>
{
Task<List<Tag>> GetListAsync();
Task<List<Tag>> GetListAsync(Guid blogId);
Task<Tag> GetByNameAsync(string name);
Task<Tag> GetByNameAsync(Guid blogId, string name);
Task<Tag> FindByNameAsync(string name);
Task<Tag> FindByNameAsync(Guid blogId, string name);
Task<List<Tag>> GetListAsync(IEnumerable<Guid> ids);

5
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs

@ -7,6 +7,8 @@ namespace Volo.Blogging.Tagging
{
public class Tag : FullAuditedAggregateRoot<Guid>
{
public virtual Guid BlogId { get; protected set; }
public virtual string Name { get; protected set; }
public virtual string Description { get; protected set; }
@ -18,9 +20,10 @@ namespace Volo.Blogging.Tagging
}
public Tag([NotNull] string name, int usageCount = 0, string description = null)
public Tag(Guid blogId, [NotNull] string name, int usageCount = 0, string description = null)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
BlogId = blogId;
Description = description;
UsageCount = usageCount;
}

14
modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs

@ -16,24 +16,24 @@ namespace Volo.Blogging.Tagging
{
}
public async Task<List<Tag>> GetListAsync()
public async Task<List<Tag>> GetListAsync(Guid blogId)
{
return await DbSet.ToListAsync();
return await DbSet.Where(t=>t.BlogId == blogId).ToListAsync();
}
public async Task<Tag> GetByNameAsync(string name)
public async Task<Tag> GetByNameAsync(Guid blogId, string name)
{
return await DbSet.FirstAsync(t=>t.Name == name);
return await DbSet.FirstAsync(t=> t.BlogId == blogId && t.Name == name);
}
public async Task<Tag> FindByNameAsync(string name)
public async Task<Tag> FindByNameAsync(Guid blogId, string name)
{
return await DbSet.FirstOrDefaultAsync(t=>t.Name == name);
return await DbSet.FirstOrDefaultAsync(t => t.BlogId == blogId && t.Name == name);
}
public async Task<List<Tag>> GetListAsync(IEnumerable<Guid> ids)
{
return await DbSet.Where(c => ids.Contains(c.Id)).ToListAsync();
return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync();
}
public void DecreaseUsageCountOfTags(List<Guid> ids)

2
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs

@ -39,7 +39,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
{
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items;
PopularTags = (await _tagAppService.GetPopularTags(new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2}));
PopularTags = (await _tagAppService.GetPopularTags(new GetPopularTagsInput {BlogId = Blog.Id, ResultCount = 10, MinimumPostCount = 2}));
}
}
}

54
modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/TagAppService_Tests.cs

@ -11,69 +11,21 @@ namespace Volo.Blogging
{
private readonly ITagAppService _tagAppService;
private readonly ITagRepository _tagRepository;
private readonly BloggingTestData _bloggingTestData;
public TagAppService_Tests()
{
_tagAppService = GetRequiredService<ITagAppService>();
_tagRepository = GetRequiredService<ITagRepository>();
}
[Fact]
public async Task Should_Get_List_Of_Tags()
{
var tags = await _tagAppService.GetListAsync();
tags.Count.ShouldBeGreaterThan(0);
_bloggingTestData = GetRequiredService<BloggingTestData>();
}
[Fact]
public async Task Should_Get_Popular_Tags()
{
var tags = await _tagAppService.GetPopularTags(new GetPopularTagsInput() { ResultCount = 5, MinimumPostCount = 0 });
var tags = await _tagAppService.GetPopularTags(new GetPopularTagsInput() { BlogId = _bloggingTestData.Blog1Id, ResultCount = 5, MinimumPostCount = 0 });
tags.Count.ShouldBeGreaterThan(0);
}
[Fact]
public async Task Should_Create_A_Tag()
{
var name = "test name";
var description = "test description";
var tagDto = await _tagAppService.CreateAsync(new CreateTagDto() { Name = name, Description = description });
UsingDbContext(context =>
{
var tag = context.Tags.FirstOrDefault(q => q.Id == tagDto.Id);
tag.ShouldNotBeNull();
tag.Name.ShouldBe(tagDto.Name);
tag.Description.ShouldBe(tagDto.Description);
});
}
[Fact]
public async Task Should_Update_A_Tag()
{
var newDescription = "new description";
var oldTag = (await _tagRepository.GetListAsync()).FirstOrDefault(); ;
await _tagAppService.UpdateAsync(oldTag.Id, new UpdateTagDto()
{ Description = newDescription, Name = oldTag.Name});
UsingDbContext(context =>
{
var tag = context.Tags.FirstOrDefault(q => q.Id == oldTag.Id);
tag.Description.ShouldBe(newDescription);
});
}
[Fact]
public async Task Should_Delete_A_Tag()
{
var tag = (await _tagRepository.GetListAsync()).First();
await _tagAppService.DeleteAsync(tag.Id);
}
}
}

2
modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs

@ -42,7 +42,7 @@ namespace Volo.Blogging
await _postRepository.InsertAsync(new Post(_testData.Blog1Post1Id, _testData.Blog1Id, Guid.Empty, "title", "coverImage", "url"));
await _postRepository.InsertAsync(new Post(_testData.Blog1Post2Id, _testData.Blog1Id, Guid.Empty, "title", "coverImage", "url"));
await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment1Id,_testData.Blog1Post1Id,null,"text"));
await _tagRepository.InsertAsync(new Tag(_testData.Tag1Name));
await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag1Name));
}
}
}

Loading…
Cancel
Save