mirror of https://github.com/abpframework/abp.git
157 changed files with 16892 additions and 918 deletions
@ -0,0 +1,30 @@ |
|||||
|
{ |
||||
|
"items": [{ |
||||
|
"text": "Getting Started", |
||||
|
"items": [{ |
||||
|
"text": "From Startup Templates", |
||||
|
"items": [{ |
||||
|
"text": "ASP.NET Core MVC", |
||||
|
"path": "Getting-Started-AspNetCore-MVC-Template.md" |
||||
|
}] |
||||
|
},{ |
||||
|
"text": "From Empty Projects", |
||||
|
"items": [{ |
||||
|
"text": "With ASP.NET Core Web Application", |
||||
|
"path": "Getting-Started-AspNetCore-Application.md" |
||||
|
},{ |
||||
|
"text": "With Console Application", |
||||
|
"path": "Getting-Started-Console-Application.md" |
||||
|
}] |
||||
|
}] |
||||
|
},{ |
||||
|
"text": "Tutorials", |
||||
|
"items": [{ |
||||
|
"text": "Application Development", |
||||
|
"items": [{ |
||||
|
"text": "With ASP.NET Core MVC", |
||||
|
"path": "Tutorials/AspNetCore-Mvc/Part-I.md" |
||||
|
}] |
||||
|
}] |
||||
|
}] |
||||
|
} |
||||
@ -0,0 +1,625 @@ |
|||||
|
// <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("20180912113852_Added_BlogUsers")] |
||||
|
partial class Added_BlogUsers |
||||
|
{ |
||||
|
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.IdentityRole", b => |
||||
|
{ |
||||
|
b.Property<Guid>("Id") |
||||
|
.ValueGeneratedOnAdd(); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp"); |
||||
|
|
||||
|
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<string>("Email") |
||||
|
.HasColumnName("Email") |
||||
|
.HasMaxLength(256); |
||||
|
|
||||
|
b.Property<bool>("EmailConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("EmailConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<bool>("LockoutEnabled") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("LockoutEnabled") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<DateTimeOffset?>("LockoutEnd"); |
||||
|
|
||||
|
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<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(128); |
||||
|
|
||||
|
b.Property<string>("Name"); |
||||
|
|
||||
|
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<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>("PhoneNumber") |
||||
|
.HasColumnName("PhoneNumber") |
||||
|
.HasMaxLength(16); |
||||
|
|
||||
|
b.Property<bool>("PhoneNumberConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("PhoneNumberConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations |
||||
|
{ |
||||
|
public partial class Added_BlogUsers : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "BlgUsers", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(nullable: false), |
||||
|
TenantId = table.Column<Guid>(nullable: true), |
||||
|
UserName = table.Column<string>(maxLength: 256, nullable: false), |
||||
|
Email = table.Column<string>(maxLength: 256, nullable: true), |
||||
|
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
||||
|
PhoneNumber = table.Column<string>(maxLength: 16, nullable: true), |
||||
|
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
||||
|
ExtraProperties = table.Column<string>(nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_BlgUsers", x => x.Id); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "BlgUsers"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,650 @@ |
|||||
|
// <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("20180918060116_Added_SocialLinks_To_Blog")] |
||||
|
partial class Added_SocialLinks_To_Blog |
||||
|
{ |
||||
|
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.IdentityRole", b => |
||||
|
{ |
||||
|
b.Property<Guid>("Id") |
||||
|
.ValueGeneratedOnAdd(); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp"); |
||||
|
|
||||
|
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<string>("Email") |
||||
|
.HasColumnName("Email") |
||||
|
.HasMaxLength(256); |
||||
|
|
||||
|
b.Property<bool>("EmailConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("EmailConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<bool>("LockoutEnabled") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("LockoutEnabled") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<DateTimeOffset?>("LockoutEnd"); |
||||
|
|
||||
|
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<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(128); |
||||
|
|
||||
|
b.Property<string>("Name"); |
||||
|
|
||||
|
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<string>("Facebook") |
||||
|
.IsRequired() |
||||
|
.HasColumnName("Facebook") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Github") |
||||
|
.IsRequired() |
||||
|
.HasColumnName("Github") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Instagram") |
||||
|
.IsRequired() |
||||
|
.HasColumnName("Instagram") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
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.Property<string>("StackOverflow") |
||||
|
.IsRequired() |
||||
|
.HasColumnName("StackOverflow") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Twitter") |
||||
|
.IsRequired() |
||||
|
.HasColumnName("Twitter") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
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<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>("PhoneNumber") |
||||
|
.HasColumnName("PhoneNumber") |
||||
|
.HasMaxLength(16); |
||||
|
|
||||
|
b.Property<bool>("PhoneNumberConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("PhoneNumberConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations |
||||
|
{ |
||||
|
public partial class Added_SocialLinks_To_Blog : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Facebook", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
defaultValue: ""); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Github", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
defaultValue: ""); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Instagram", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
defaultValue: ""); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "StackOverflow", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
defaultValue: ""); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Twitter", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
defaultValue: ""); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Facebook", |
||||
|
table: "BlgBlogs"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Github", |
||||
|
table: "BlgBlogs"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Instagram", |
||||
|
table: "BlgBlogs"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "StackOverflow", |
||||
|
table: "BlgBlogs"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Twitter", |
||||
|
table: "BlgBlogs"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,645 @@ |
|||||
|
// <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("20180918061015_SocialLinks_Made_Nullable")] |
||||
|
partial class SocialLinks_Made_Nullable |
||||
|
{ |
||||
|
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.IdentityRole", b => |
||||
|
{ |
||||
|
b.Property<Guid>("Id") |
||||
|
.ValueGeneratedOnAdd(); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp"); |
||||
|
|
||||
|
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<string>("Email") |
||||
|
.HasColumnName("Email") |
||||
|
.HasMaxLength(256); |
||||
|
|
||||
|
b.Property<bool>("EmailConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("EmailConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<bool>("LockoutEnabled") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("LockoutEnabled") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
b.Property<DateTimeOffset?>("LockoutEnd"); |
||||
|
|
||||
|
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<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(128); |
||||
|
|
||||
|
b.Property<string>("Name"); |
||||
|
|
||||
|
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<string>("Facebook") |
||||
|
.HasColumnName("Facebook") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Github") |
||||
|
.HasColumnName("Github") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Instagram") |
||||
|
.HasColumnName("Instagram") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
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.Property<string>("StackOverflow") |
||||
|
.HasColumnName("StackOverflow") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
b.Property<string>("Twitter") |
||||
|
.HasColumnName("Twitter") |
||||
|
.HasMaxLength(128); |
||||
|
|
||||
|
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<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>("PhoneNumber") |
||||
|
.HasColumnName("PhoneNumber") |
||||
|
.HasMaxLength(16); |
||||
|
|
||||
|
b.Property<bool>("PhoneNumberConfirmed") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnName("PhoneNumberConfirmed") |
||||
|
.HasDefaultValue(false); |
||||
|
|
||||
|
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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,98 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations |
||||
|
{ |
||||
|
public partial class SocialLinks_Made_Nullable : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Twitter", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "StackOverflow", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Instagram", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Github", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Facebook", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Twitter", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128, |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "StackOverflow", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128, |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Instagram", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128, |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Github", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128, |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Facebook", |
||||
|
table: "BlgBlogs", |
||||
|
maxLength: 128, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldMaxLength: 128, |
||||
|
oldNullable: true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -1,14 +0,0 @@ |
|||||
using System; |
|
||||
using Volo.Abp.Application.Dtos; |
|
||||
|
|
||||
namespace Volo.Blogging.Blogs |
|
||||
{ |
|
||||
public class BlogDto : EntityDto<Guid> |
|
||||
{ |
|
||||
public string Name { get; set; } |
|
||||
|
|
||||
public string ShortName { get; set; } |
|
||||
|
|
||||
public string Description { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Volo.Blogging.Blogs.Dtos |
||||
|
{ |
||||
|
public class BlogDto : FullAuditedEntityDto<Guid> |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string ShortName { get; set; } |
||||
|
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
public string Facebook { get; set; } |
||||
|
|
||||
|
public string Twitter { get; set; } |
||||
|
|
||||
|
public string Instagram { get; set; } |
||||
|
|
||||
|
public string Github { get; set; } |
||||
|
|
||||
|
public string StackOverflow { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
namespace Volo.Blogging.Blogs.Dtos |
||||
|
{ |
||||
|
public class CreateBlogDto |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string ShortName { get; set; } |
||||
|
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
public string Facebook { get; set; } |
||||
|
|
||||
|
public string Twitter { get; set; } |
||||
|
|
||||
|
public string Instagram { get; set; } |
||||
|
|
||||
|
public string Github { get; set; } |
||||
|
|
||||
|
public string StackOverflow { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Blogging.Blogs.Dtos |
||||
|
{ |
||||
|
public class UpdateBlogDto |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string ShortName { get; set; } |
||||
|
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
public string Facebook { get; set; } |
||||
|
|
||||
|
public string Twitter { get; set; } |
||||
|
|
||||
|
public string Instagram { get; set; } |
||||
|
|
||||
|
public string Github { get; set; } |
||||
|
|
||||
|
public string StackOverflow { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,12 +1,15 @@ |
|||||
using System; |
using System; |
||||
using Volo.Abp.Application.Dtos; |
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Blogging.Posts; |
||||
|
|
||||
namespace Volo.Blogging.Comments.Dtos |
namespace Volo.Blogging.Comments.Dtos |
||||
{ |
{ |
||||
public class CommentDto : FullAuditedEntityDto<Guid> |
public class CommentWithDetailsDto : FullAuditedEntityDto<Guid> |
||||
{ |
{ |
||||
public Guid? RepliedCommentId { get; set; } |
public Guid? RepliedCommentId { get; set; } |
||||
|
|
||||
public string Text { get; set; } |
public string Text { get; set; } |
||||
|
|
||||
|
public BlogUserDto Writer { get; set; } |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"Permission:Blogging": "Blog", |
||||
|
"Permission:Blogs": "Blogs", |
||||
|
"Permission:Posts": "Posts", |
||||
|
"Permission:Tags": "Tags", |
||||
|
"Permission:Comments": "Comments", |
||||
|
"Permission:Management": "Management", |
||||
|
"Permission:Edit": "Edit", |
||||
|
"Permission:Create": "Create", |
||||
|
"Permission:Delete": "Delete" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
{ |
||||
|
"culture": "tr", |
||||
|
"texts": { |
||||
|
"Permission:Blogging": "Blog", |
||||
|
"Permission:Blogs": "Bloglar", |
||||
|
"Permission:Posts": "Yazılar", |
||||
|
"Permission:Tags": "Etiketler", |
||||
|
"Permission:Comments": "Yorumlar", |
||||
|
"Permission:Management": "Yönetme", |
||||
|
"Permission:Edit": "Düzenle", |
||||
|
"Permission:Create": "Ekle", |
||||
|
"Permission:Delete": "Sil" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Volo.Blogging.Posts |
||||
|
{ |
||||
|
public class BlogUserDto : EntityDto<Guid> |
||||
|
{ |
||||
|
public Guid? TenantId { get; set; } |
||||
|
|
||||
|
public string UserName { get; set; } |
||||
|
|
||||
|
public string Email { get; set; } |
||||
|
|
||||
|
public bool EmailConfirmed { get; set; } |
||||
|
|
||||
|
public string PhoneNumber { get; set; } |
||||
|
|
||||
|
public bool PhoneNumberConfirmed { get; set; } |
||||
|
|
||||
|
public Dictionary<string, object> ExtraProperties { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,20 +0,0 @@ |
|||||
using System; |
|
||||
using Volo.Abp.Application.Dtos; |
|
||||
|
|
||||
namespace Volo.Blogging.Posts |
|
||||
{ |
|
||||
public class PostDto : FullAuditedEntityDto<Guid> |
|
||||
{ |
|
||||
public Guid BlogId { get; protected set; } |
|
||||
|
|
||||
public string Title { get; protected set; } |
|
||||
|
|
||||
public string CoverImage { get; protected set; } |
|
||||
|
|
||||
public string Url { get; set; } |
|
||||
|
|
||||
public int ReadCount { get; set; } |
|
||||
|
|
||||
public string Content { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,61 @@ |
|||||
|
using System.Security.Principal; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Authorization.Infrastructure; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
|
||||
|
namespace Volo.Blogging.Comments |
||||
|
{ |
||||
|
public class CommentAuthorizationHandler : AuthorizationHandler<OperationAuthorizationRequirement, Comment> |
||||
|
{ |
||||
|
private readonly IPermissionChecker _permissionChecker; |
||||
|
|
||||
|
public CommentAuthorizationHandler(IPermissionChecker permissionChecker) |
||||
|
{ |
||||
|
_permissionChecker = permissionChecker; |
||||
|
} |
||||
|
|
||||
|
protected override async Task HandleRequirementAsync( |
||||
|
AuthorizationHandlerContext context, |
||||
|
OperationAuthorizationRequirement requirement, |
||||
|
Comment resource) |
||||
|
{ |
||||
|
if (requirement.Name == CommonOperations.Delete.Name && await HasDeletePermission(context, resource)) |
||||
|
{ |
||||
|
context.Succeed(requirement); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (requirement.Name == CommonOperations.Update.Name && await HasUpdatePermission(context, resource)) |
||||
|
{ |
||||
|
context.Succeed(requirement); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private async Task<bool> HasDeletePermission(AuthorizationHandlerContext context, Comment resource) |
||||
|
{ |
||||
|
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Comments.Delete)) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
private async Task<bool> HasUpdatePermission(AuthorizationHandlerContext context, Comment resource) |
||||
|
{ |
||||
|
if (resource.CreatorId != null && resource.CreatorId == context.User.FindUserId()) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Comments.Update)) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using Microsoft.AspNetCore.Authorization.Infrastructure; |
||||
|
|
||||
|
namespace Volo.Blogging |
||||
|
{ |
||||
|
public static class CommonOperations |
||||
|
{ |
||||
|
public static OperationAuthorizationRequirement Update = new OperationAuthorizationRequirement { Name = nameof(Update) }; |
||||
|
public static OperationAuthorizationRequirement Delete = new OperationAuthorizationRequirement { Name = nameof(Delete) }; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
using System.Security.Principal; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Authorization.Infrastructure; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
|
||||
|
namespace Volo.Blogging.Posts |
||||
|
{ |
||||
|
public class PostAuthorizationHandler : AuthorizationHandler<OperationAuthorizationRequirement, Post> |
||||
|
{ |
||||
|
private readonly IPermissionChecker _permissionChecker; |
||||
|
|
||||
|
public PostAuthorizationHandler(IPermissionChecker permissionChecker) |
||||
|
{ |
||||
|
_permissionChecker = permissionChecker; |
||||
|
} |
||||
|
|
||||
|
protected override async Task HandleRequirementAsync( |
||||
|
AuthorizationHandlerContext context, |
||||
|
OperationAuthorizationRequirement requirement, |
||||
|
Post resource) |
||||
|
{ |
||||
|
if (requirement.Name == CommonOperations.Delete.Name && await HasDeletePermission(context, resource)) |
||||
|
{ |
||||
|
context.Succeed(requirement); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (requirement.Name == CommonOperations.Update.Name && await HasUpdatePermission(context, resource)) |
||||
|
{ |
||||
|
context.Succeed(requirement); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private async Task<bool> HasDeletePermission(AuthorizationHandlerContext context, Post resource) |
||||
|
{ |
||||
|
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Comments.Delete)) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
private async Task<bool> HasUpdatePermission(AuthorizationHandlerContext context, Post resource) |
||||
|
{ |
||||
|
if (resource.CreatorId != null && resource.CreatorId == context.User.FindUserId()) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Comments.Update)) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,13 @@ |
|||||
using Volo.Abp.Domain.Repositories; |
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
namespace Volo.Blogging.Posts |
namespace Volo.Blogging.Posts |
||||
{ |
{ |
||||
public interface IPostTagRepository : IBasicRepository<PostTag> |
public interface IPostTagRepository : IBasicRepository<PostTag> |
||||
{ |
{ |
||||
|
void DeleteOfPost(Guid id); |
||||
|
|
||||
|
Task<PostTag> FindByTagIdAndPostIdAsync(Guid postId, Guid tagId); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public class BlogUser : AggregateRoot<Guid>, IUser, IHasExtraProperties |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
|
||||
|
public virtual string UserName { get; protected set; } |
||||
|
|
||||
|
public virtual string Email { get; protected set; } |
||||
|
|
||||
|
public virtual bool EmailConfirmed { get; protected set; } |
||||
|
|
||||
|
public virtual string PhoneNumber { get; protected set; } |
||||
|
|
||||
|
public virtual bool PhoneNumberConfirmed { get; protected set; } |
||||
|
|
||||
|
public virtual Dictionary<string, object> ExtraProperties { get; protected set; } |
||||
|
|
||||
|
protected BlogUser() |
||||
|
{ |
||||
|
ExtraProperties = new Dictionary<string, object>(); |
||||
|
} |
||||
|
|
||||
|
public BlogUser(IUserData user) |
||||
|
{ |
||||
|
Id = user.Id; |
||||
|
Email = user.Email; |
||||
|
EmailConfirmed = user.EmailConfirmed; |
||||
|
PhoneNumber = user.PhoneNumber; |
||||
|
PhoneNumberConfirmed = user.PhoneNumberConfirmed; |
||||
|
UserName = user.UserName; |
||||
|
TenantId = user.TenantId; |
||||
|
|
||||
|
ExtraProperties = new Dictionary<string, object>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using Volo.Abp.Uow; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public class BlogUserLookupService : UserLookupService<BlogUser, IBlogUserRepository>, IBlogUserLookupService |
||||
|
{ |
||||
|
public BlogUserLookupService( |
||||
|
IBlogUserRepository userRepository, |
||||
|
IUnitOfWorkManager unitOfWorkManager) |
||||
|
: base( |
||||
|
userRepository, |
||||
|
unitOfWorkManager) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override BlogUser CreateUser(IUserData externalUser) |
||||
|
{ |
||||
|
return new BlogUser(externalUser); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public interface IBlogUserLookupService : IUserLookupService<BlogUser> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public interface IBlogUserRepository : IBasicRepository<BlogUser, Guid>, IUserRepository<BlogUser> |
||||
|
{ |
||||
|
Task<List<BlogUser>> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.Users.EntityFrameworkCore; |
||||
|
using Volo.Blogging.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Volo.Blogging.Users |
||||
|
{ |
||||
|
public class EfCoreBlogUserRepository : EfCoreUserRepositoryBase<IBloggingDbContext, BlogUser>, IBlogUserRepository |
||||
|
{ |
||||
|
public EfCoreBlogUserRepository(IDbContextProvider<IBloggingDbContext> dbContextProvider) |
||||
|
: base(dbContextProvider) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async Task<List<BlogUser>> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await DbSet |
||||
|
.WhereIf( !string.IsNullOrWhiteSpace( filter), x=>x.UserName.Contains(filter)) |
||||
|
.Take(maxCount).ToListAsync(cancellationToken); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,12 +1,20 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace Volo.Blogging |
namespace Volo.Blogging |
||||
{ |
{ |
||||
[DependsOn( |
[DependsOn( |
||||
typeof(BloggingApplicationContractsModule))] |
typeof(BloggingApplicationContractsModule), |
||||
|
typeof(AbpHttpClientModule))] |
||||
public class BloggingHttpApiClientModule : AbpModule |
public class BloggingHttpApiClientModule : AbpModule |
||||
{ |
{ |
||||
|
public const string RemoteServiceName = "Blogging"; |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddHttpClientProxies(typeof(BloggingApplicationContractsModule).Assembly, RemoteServiceName); |
||||
|
} |
||||
|
|
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,77 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Auditing; |
||||
|
using Volo.Blogging.Blogs; |
||||
|
using Volo.Blogging.Blogs.Dtos; |
||||
|
|
||||
|
namespace Volo.Blogging |
||||
|
{ |
||||
|
[RemoteService] |
||||
|
[Area("blogging")] |
||||
|
[Controller] |
||||
|
[ControllerName("Blogs")] |
||||
|
[Route("api/blogging/blogs")] |
||||
|
[DisableAuditing] |
||||
|
public class BlogsController : AbpController, IBlogAppService |
||||
|
{ |
||||
|
private readonly IBlogAppService _blogAppService; |
||||
|
|
||||
|
public BlogsController(IBlogAppService blogAppService) |
||||
|
{ |
||||
|
_blogAppService = blogAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("")] |
||||
|
public async Task<PagedResultDto<BlogDto>> GetListPagedAsync(PagedAndSortedResultRequestDto input) |
||||
|
{ |
||||
|
return await _blogAppService.GetListPagedAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("/all")] |
||||
|
public async Task<ListResultDto<BlogDto>> GetListAsync() |
||||
|
{ |
||||
|
return await _blogAppService.GetListAsync(); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("{shortName}")] |
||||
|
public async Task<BlogDto> GetByShortNameAsync(string shortName) |
||||
|
{ |
||||
|
return await _blogAppService.GetByShortNameAsync(shortName); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
public async Task<BlogDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
return await _blogAppService.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task<BlogDto> Create(CreateBlogDto input) |
||||
|
{ |
||||
|
return await _blogAppService.Create(input); |
||||
|
} |
||||
|
|
||||
|
[HttpPut] |
||||
|
[Route("{id}")] |
||||
|
public async Task<BlogDto> Update(Guid id, UpdateBlogDto input) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
[HttpDelete] |
||||
|
public async Task Delete(Guid id) |
||||
|
{ |
||||
|
await _blogAppService.Delete(id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Blogging.Posts; |
||||
|
|
||||
|
namespace Volo.Blogging.Areas.Blog.Controllers |
||||
|
{ |
||||
|
[Area("Blog")] |
||||
|
[Route("Blog/[controller]/[action]")]
|
||||
|
public class PostsController : AbpController |
||||
|
{ |
||||
|
private readonly IPostAppService _postAppService; |
||||
|
|
||||
|
public PostsController(IPostAppService postAppService) |
||||
|
{ |
||||
|
_postAppService = postAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task Delete(Guid id) |
||||
|
{ |
||||
|
await _postAppService.DeleteAsync(id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,210 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
using System.Linq; |
||||
|
using System.Security.Cryptography; |
||||
|
using System.Text; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Blogging.Areas.Blog.Helpers.TagHelpers |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
/// <summary>
|
||||
|
/// Returns a Globally Recognised Avatar https://en.gravatar.com
|
||||
|
/// </summary>
|
||||
|
[HtmlTargetElement("img", Attributes = "gravatar-email")] |
||||
|
public class GravatarTagHelper : TagHelper |
||||
|
{ |
||||
|
private readonly IHttpContextAccessor _contextAccessor; |
||||
|
|
||||
|
public GravatarTagHelper(IHttpContextAccessor contextAccessor) |
||||
|
{ |
||||
|
_contextAccessor = contextAccessor; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Email Address for the Gravatar
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("gravatar-email")] |
||||
|
public string Email { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gravatar content rating (note that Gravatars are self-rated)
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("gravatar-rating")] |
||||
|
public GravatarRating Rating { get; set; } = GravatarRating.GeneralAudiences; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Size in pixels (default: 80)
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("gravatar-size")] |
||||
|
public int Size { get; set; } = 80; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// URL to a custom default image (e.g: 'Url.Content("~/images/no-grvatar.png")' )
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("default-image-url")] |
||||
|
public string DefaultImageUrl { get; set; } = ""; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Prefer the default image over the users own Gravatar
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("force-default-image")] |
||||
|
public bool ForceDefaultImage { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Default image if user hasn't created a Gravatar
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("default-image")] |
||||
|
public GravatarDefaultImage DefaultImage { get; set; } = GravatarDefaultImage.Default; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Always do secure (https) requests
|
||||
|
/// </summary>
|
||||
|
[HtmlAttributeName("force-secure-request")] |
||||
|
public bool ForceSecureRequest { get; set; } = true; |
||||
|
|
||||
|
|
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var emailAddress = Email == null ? string.Empty : Email.Trim().ToLower(); |
||||
|
|
||||
|
var url = string.Format("{0}://{1}.gravatar.com/avatar/{2}?s={3}{4}{5}{6}", |
||||
|
GetUrlScheme(), |
||||
|
GetUrlPrefix(), |
||||
|
GetMd5Hash(emailAddress), |
||||
|
Size, |
||||
|
GetDefaultImageParameter(), |
||||
|
GetForceDefaultImageParameter(), |
||||
|
GetRatingParameter() |
||||
|
); |
||||
|
|
||||
|
output.Attributes.SetAttribute("src", url); |
||||
|
} |
||||
|
|
||||
|
private string GetUrlScheme() |
||||
|
{ |
||||
|
return ForceSecureRequest || _contextAccessor.HttpContext.Request.IsHttps |
||||
|
? "https" : "http"; |
||||
|
} |
||||
|
|
||||
|
private string GetUrlPrefix() |
||||
|
{ |
||||
|
return ForceSecureRequest || _contextAccessor.HttpContext.Request.IsHttps ? "secure" : "www"; |
||||
|
} |
||||
|
|
||||
|
private string GetDefaultImageParameter() |
||||
|
{ |
||||
|
return "&d=" + (!string.IsNullOrEmpty(DefaultImageUrl) |
||||
|
? System.Net.WebUtility.UrlEncode(DefaultImageUrl) |
||||
|
: GetEnumDescription(DefaultImage)); |
||||
|
} |
||||
|
|
||||
|
private string GetForceDefaultImageParameter() |
||||
|
{ |
||||
|
return ForceDefaultImage ? "&f=y" : ""; |
||||
|
} |
||||
|
|
||||
|
private string GetRatingParameter() |
||||
|
{ |
||||
|
return "&r=" + GetEnumDescription(Rating); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Generates an MD5 hash of the given string
|
||||
|
/// </summary>
|
||||
|
/// <remarks>Source: http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5.aspx </remarks>
|
||||
|
private static string GetMd5Hash(string input) |
||||
|
{ |
||||
|
// Convert the input string to a byte array and compute the hash.
|
||||
|
var data = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(input)); |
||||
|
|
||||
|
// Create a new Stringbuilder to collect the bytes
|
||||
|
// and create a string.
|
||||
|
var sBuilder = new StringBuilder(); |
||||
|
|
||||
|
// Loop through each byte of the hashed data
|
||||
|
// and format each one as a hexadecimal string.
|
||||
|
foreach (var t in data) |
||||
|
{ |
||||
|
sBuilder.Append(t.ToString("x2")); |
||||
|
} |
||||
|
|
||||
|
// Return the hexadecimal string.
|
||||
|
return sBuilder.ToString(); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Returns the value of a Description for a given Enum value
|
||||
|
/// </summary>
|
||||
|
/// <remarks>Source: http://blogs.msdn.com/b/abhinaba/archive/2005/10/21/483337.aspx </remarks>
|
||||
|
/// <param name="en"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private static string GetEnumDescription(Enum en) |
||||
|
{ |
||||
|
var type = en.GetType(); |
||||
|
var memInfo = type.GetMember(en.ToString()); |
||||
|
|
||||
|
if (memInfo == null || memInfo.Length <= 0) |
||||
|
{ |
||||
|
return en.ToString(); |
||||
|
} |
||||
|
|
||||
|
var attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); |
||||
|
|
||||
|
if (attrs != null && attrs.Any()) |
||||
|
{ |
||||
|
return ((DescriptionAttribute)attrs.First()).Description; |
||||
|
} |
||||
|
|
||||
|
return en.ToString(); |
||||
|
} |
||||
|
|
||||
|
public enum GravatarDefaultImage |
||||
|
{ |
||||
|
/// <summary>Default Gravatar logo</summary>
|
||||
|
[Description("")] |
||||
|
Default, |
||||
|
/// <summary>404 - do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response</summary>
|
||||
|
[Description("404")] |
||||
|
Http404, |
||||
|
/// <summary>Mystery-Man - a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)</summary>
|
||||
|
[Description("mm")] |
||||
|
MysteryMan, |
||||
|
/// <summary>Identicon - a geometric pattern based on an email hash</summary>
|
||||
|
[Description("identicon")] |
||||
|
Identicon, |
||||
|
/// <summary>MonsterId - a generated 'monster' with different colors, faces, etc</summary>
|
||||
|
[Description("monsterid")] |
||||
|
MonsterId, |
||||
|
/// <summary>Wavatar - generated faces with differing features and backgrounds</summary>
|
||||
|
[Description("wavatar")] |
||||
|
Wavatar, |
||||
|
/// <summary>Retro - awesome generated, 8-bit arcade-style pixelated faces</summary>
|
||||
|
[Description("retro")] |
||||
|
Retro |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience. By default, only 'G' rated images are displayed unless you indicate that you would like to see higher ratings
|
||||
|
/// </summary>
|
||||
|
public enum GravatarRating |
||||
|
{ |
||||
|
/// <summary>Suitable for display on all websites with any audience type</summary>
|
||||
|
[Description("g")] |
||||
|
GeneralAudiences, |
||||
|
|
||||
|
/// <summary>May contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence</summary>
|
||||
|
[Description("pg")] |
||||
|
ParentalGuidance, |
||||
|
|
||||
|
/// <summary>May contain such things as harsh profanity, intense violence, nudity, or hard drug use</summary>
|
||||
|
[Description("r")] |
||||
|
Restricted, |
||||
|
|
||||
|
/// <summary>May contain hardcore sexual imagery or extremely disturbing violence</summary>
|
||||
|
[Description("x")] |
||||
|
OnlyMature |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
@page |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
||||
|
@using Volo.Blogging.Pages.Blog |
||||
|
@inherits BloggingPage |
||||
|
@model Volo.Blogging.Pages.Admin.Blogs.CreateModel |
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
<form asp-page="/Admin/Blogs/Create"> |
||||
|
<abp-modal size="@(AbpModalSize.Large)"> |
||||
|
<abp-modal-header title="@L["Create"].Value"></abp-modal-header> |
||||
|
<abp-modal-body> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="@L["Info"].Value"> |
||||
|
<abp-input asp-for="Blog.Name"/> |
||||
|
<abp-input asp-for="Blog.ShortName"/> |
||||
|
<abp-input asp-for="Blog.Description"/> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="@L["Social"].Value"> |
||||
|
<abp-input asp-for="Blog.Facebook" /> |
||||
|
<abp-input asp-for="Blog.Twitter" /> |
||||
|
<abp-input asp-for="Blog.Instagram" /> |
||||
|
<abp-input asp-for="Blog.Github" /> |
||||
|
<abp-input asp-for="Blog.StackOverflow" /> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</abp-modal-body> |
||||
|
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"> |
||||
|
</abp-modal-footer> |
||||
|
</abp-modal> |
||||
|
</form> |
||||
@ -0,0 +1,65 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
||||
|
using Volo.Blogging.Blogs; |
||||
|
using Volo.Blogging.Blogs.Dtos; |
||||
|
|
||||
|
namespace Volo.Blogging.Pages.Admin.Blogs |
||||
|
{ |
||||
|
public class CreateModel : AbpPageModel |
||||
|
{ |
||||
|
private readonly IBlogAppService _blogAppService; |
||||
|
|
||||
|
[BindProperty] |
||||
|
public BlogCreateModalView Blog { get; set; } = new BlogCreateModalView(); |
||||
|
|
||||
|
public CreateModel(IBlogAppService blogAppService) |
||||
|
{ |
||||
|
_blogAppService = blogAppService; |
||||
|
} |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async void OnPostAsync() |
||||
|
{ |
||||
|
var language = ObjectMapper.Map<BlogCreateModalView, CreateBlogDto>(Blog); |
||||
|
|
||||
|
await _blogAppService.Create(language); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public class BlogCreateModalView |
||||
|
{ |
||||
|
[Required] |
||||
|
[StringLength(BlogConsts.MaxNameLength)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(BlogConsts.MaxShortNameLength)] |
||||
|
public string ShortName { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxDescriptionLength)] |
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Facebook { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Twitter { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Instagram { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Github { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string StackOverflow { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
@page |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
||||
|
@using Volo.Blogging.Pages.Blog |
||||
|
@inherits BloggingPage |
||||
|
@model Volo.Blogging.Pages.Admin.Blogs.EditModel |
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
<form asp-page="/Admin/Blogs/Edit"> |
||||
|
<abp-modal size="@(AbpModalSize.Large)"> |
||||
|
<abp-modal-header title="@L["Edit"].Value"></abp-modal-header> |
||||
|
<abp-modal-body> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="@L["Info"].Value"> |
||||
|
<abp-input asp-for="Blog.Id" /> |
||||
|
<abp-input asp-for="Blog.Name" /> |
||||
|
<abp-input asp-for="Blog.ShortName" /> |
||||
|
<abp-input asp-for="Blog.Description" /> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="@L["Social"].Value"> |
||||
|
<abp-input asp-for="Blog.Facebook" /> |
||||
|
<abp-input asp-for="Blog.Twitter" /> |
||||
|
<abp-input asp-for="Blog.Instagram" /> |
||||
|
<abp-input asp-for="Blog.Github" /> |
||||
|
<abp-input asp-for="Blog.StackOverflow" /> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</abp-modal-body> |
||||
|
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"> |
||||
|
</abp-modal-footer> |
||||
|
</abp-modal> |
||||
|
</form> |
||||
@ -0,0 +1,85 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
||||
|
using Volo.Blogging.Blogs; |
||||
|
using Volo.Blogging.Blogs.Dtos; |
||||
|
using Volo.Blogging.Posts; |
||||
|
|
||||
|
namespace Volo.Blogging.Pages.Admin.Blogs |
||||
|
{ |
||||
|
public class EditModel : AbpPageModel |
||||
|
{ |
||||
|
private readonly IBlogAppService _blogAppService; |
||||
|
|
||||
|
[BindProperty(SupportsGet = true)] |
||||
|
public Guid BlogId { get; set; } |
||||
|
|
||||
|
[BindProperty] |
||||
|
public BlogEditViewModel Blog { get; set; } = new BlogEditViewModel(); |
||||
|
|
||||
|
public EditModel(IBlogAppService blogAppService) |
||||
|
{ |
||||
|
_blogAppService = blogAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task OnGet() |
||||
|
{ |
||||
|
var blog = await _blogAppService.GetAsync(BlogId); |
||||
|
|
||||
|
Blog = ObjectMapper.Map<BlogDto, BlogEditViewModel>(blog); |
||||
|
} |
||||
|
|
||||
|
public async Task OnPost() |
||||
|
{ |
||||
|
await _blogAppService.Update(Blog.Id, new UpdateBlogDto() |
||||
|
{ |
||||
|
Name = Blog.Name, |
||||
|
ShortName = Blog.ShortName, |
||||
|
Description = Blog.Description, |
||||
|
Facebook = Blog.Facebook, |
||||
|
Twitter = Blog.Twitter, |
||||
|
Instagram = Blog.Instagram, |
||||
|
Github = Blog.Github, |
||||
|
StackOverflow = Blog.StackOverflow |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public class BlogEditViewModel |
||||
|
{ |
||||
|
[HiddenInput] |
||||
|
[Required] |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(BlogConsts.MaxNameLength)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(BlogConsts.MaxShortNameLength)] |
||||
|
public string ShortName { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxDescriptionLength)] |
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Facebook { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Twitter { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Instagram { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string Github { get; set; } |
||||
|
|
||||
|
[StringLength(BlogConsts.MaxSocialLinkLength)] |
||||
|
public string StackOverflow { get; set; } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
@page |
||||
|
@using Microsoft.AspNetCore.Authorization |
||||
|
@using Volo.Blogging |
||||
|
@using Volo.Blogging.Pages.Blog |
||||
|
@inherits BloggingPage |
||||
|
@model Volo.Blogging.Pages.Admin.Blogs.IndexModel |
||||
|
@inject IAuthorizationService Authorization |
||||
|
@{ |
||||
|
ViewBag.PageTitle = "Blogs"; |
||||
|
} |
||||
|
|
||||
|
@section scripts { |
||||
|
<abp-script src="/Pages/Admin/Blogs/index.js" /> |
||||
|
<abp-script src="/Pages/Admin/Blogs/create.js" /> |
||||
|
<abp-script src="/Pages/Admin/Blogs/edit.js" /> |
||||
|
} |
||||
|
|
||||
|
<abp-card> |
||||
|
<abp-card-header> |
||||
|
<abp-row> |
||||
|
<abp-column size-md="_6"> |
||||
|
<h2>@L["Blogs"]</h2> |
||||
|
</abp-column> |
||||
|
<abp-column size-md="_6" class="text-right"> |
||||
|
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Blogs.Create)) |
||||
|
{ |
||||
|
<abp-button icon="plus" text="@L["CreateANewBlog"].Value" button-type="Primary" id="CreateNewBlogButtonId"></abp-button> |
||||
|
} |
||||
|
</abp-column> |
||||
|
</abp-row> |
||||
|
</abp-card-header> |
||||
|
<abp-card-body> |
||||
|
<abp-table striped-rows="true" id="BlogsTable" class="nowrap"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>@L["Actions"]</th> |
||||
|
<th>@L["Name"]</th> |
||||
|
<th>@L["ShortName"]</th> |
||||
|
<th>@L["CreationTime"]</th> |
||||
|
<th>@L["Description"]</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
</abp-table> |
||||
|
</abp-card-body> |
||||
|
</abp-card> |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
||||
|
|
||||
|
namespace Volo.Blogging.Pages.Admin.Blogs |
||||
|
{ |
||||
|
public class IndexModel : AbpPageModel |
||||
|
{ |
||||
|
public async Task OnGetAsync() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
var abp = abp || {}; |
||||
|
$(function () { |
||||
|
abp.modals.blogCreate = function () { |
||||
|
var initModal = function (publicApi, args) { |
||||
|
var $form = publicApi.getForm(); |
||||
|
|
||||
|
|
||||
|
}; |
||||
|
|
||||
|
return { |
||||
|
initModal: initModal |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
@ -0,0 +1,14 @@ |
|||||
|
var abp = abp || {}; |
||||
|
$(function () { |
||||
|
abp.modals.blogEdit = function () { |
||||
|
var initModal = function (publicApi, args) { |
||||
|
var $form = publicApi.getForm(); |
||||
|
|
||||
|
|
||||
|
}; |
||||
|
|
||||
|
return { |
||||
|
initModal: initModal |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
@ -0,0 +1,84 @@ |
|||||
|
$(function () { |
||||
|
|
||||
|
var l = abp.localization.getResource('Blogging'); |
||||
|
var _createModal = new abp.ModalManager(abp.appPath + 'Admin/Blogs/Create'); |
||||
|
var _editModal = new abp.ModalManager(abp.appPath + 'Admin/Blogs/Edit'); |
||||
|
|
||||
|
var _dataTable = $('#BlogsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
||||
|
processing: true, |
||||
|
serverSide: true, |
||||
|
paging: true, |
||||
|
searching: false, |
||||
|
autoWidth: false, |
||||
|
scrollCollapse: true, |
||||
|
order: [[3, "desc"]], |
||||
|
ajax: abp.libs.datatables.createAjax(volo.blogging.blogs.getListPaged), |
||||
|
columnDefs: [ |
||||
|
{ |
||||
|
rowAction: { |
||||
|
items: |
||||
|
[ |
||||
|
{ |
||||
|
text: l('Edit'), |
||||
|
visible: function () { |
||||
|
return true; //TODO: Check permission
|
||||
|
}, |
||||
|
action: function (data) { |
||||
|
_editModal.open({ |
||||
|
blogId: data.record.id |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: l('Delete'), |
||||
|
visible: function () { |
||||
|
return true; //TODO: Check permission
|
||||
|
}, |
||||
|
confirmMessage: function (data) { return l('BlogDeletionWarningMessage') }, |
||||
|
action: function (data) { |
||||
|
volo.blogging.blogs |
||||
|
.delete(data.record.id) |
||||
|
.then(function () { |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 1, |
||||
|
data: "name" |
||||
|
}, |
||||
|
{ |
||||
|
target: 2, |
||||
|
data: "shortName" |
||||
|
}, |
||||
|
{ |
||||
|
target: 3, |
||||
|
data: "creationTime", |
||||
|
render: function (date) { |
||||
|
return date; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 4, |
||||
|
data: "description" |
||||
|
} |
||||
|
] |
||||
|
})); |
||||
|
|
||||
|
|
||||
|
$("#CreateNewBlogButtonId").click(function () { |
||||
|
_createModal.open(); |
||||
|
}); |
||||
|
|
||||
|
_createModal.onClose(function () { |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
|
||||
|
_editModal.onResult(function () { |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue