Browse Source

Merge pull request #6996 from abpframework/cotur/cms-kit

Cms-Kit page system implementation
pull/7186/head
İlkay İlknur 6 years ago
committed by GitHub
parent
commit
bad1d95ef5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs
  2. 2
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs
  3. 531
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs
  4. 309
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs
  5. 529
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs
  6. 1
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj
  7. 6
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs
  8. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs
  9. 1725
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs
  10. 95
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs
  11. 86
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
  12. 1
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj
  13. 10
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs
  14. 6
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs
  15. 18
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs
  16. 9
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs
  17. 17
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs
  18. 17
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs
  19. 10
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs
  20. 6
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs
  21. 8
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs
  22. 11
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs
  23. 85
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs
  24. 70
      modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs
  25. 63
      modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs
  26. 6
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs
  27. 13
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json
  28. 3
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json
  29. 8
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs
  30. 17
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs
  31. 23
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs
  32. 41
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs
  33. 50
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs
  34. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs
  35. 3
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml
  36. 11
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml
  37. 5
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs
  38. 117
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs
  39. 13
      modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs
  40. 34
      modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs
  41. 39
      modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs
  42. 1
      modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj

4
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs

@ -22,6 +22,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EntityFrameworkCore;
@ -47,7 +48,8 @@ namespace Volo.CmsKit
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreSerilogModule)
typeof(AbpAspNetCoreSerilogModule),
typeof(BlobStoringDatabaseEntityFrameworkCoreModule)
)]
public class CmsKitHttpApiHostModule : AbpModule
{

2
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace Volo.CmsKit.EntityFrameworkCore
@ -16,6 +17,7 @@ namespace Volo.CmsKit.EntityFrameworkCore
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCmsKit();
modelBuilder.ConfigureBlobStoring();
}
}
}

531
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs

@ -0,0 +1,531 @@
// <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.Abp.EntityFrameworkCore;
using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))]
[Migration("20201231111745_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.1");
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<Guid>("ContainerId")
.HasColumnType("uniqueidentifier");
b.Property<byte[]>("Content")
.HasMaxLength(2147483647)
.HasColumnType("varbinary(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("ContainerId");
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
});
modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid?>("RepliedCommentId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Text")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.HasKey("Id");
b.HasIndex("TenantId", "RepliedCommentId");
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsComments");
});
modelBuilder.Entity("Volo.CmsKit.Contents.Content", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2147483647)
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsContents");
});
modelBuilder.Entity("Volo.CmsKit.Pages.Page", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("TenantId", "Url");
b.ToTable("CmsPages");
});
modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<short>("StarCount")
.HasColumnType("smallint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId");
b.ToTable("CmsRatings");
});
modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ReactionName")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName");
b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName");
b.ToTable("CmsUserReactions");
});
modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b =>
{
b.Property<string>("EntityId")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("TagId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("EntityId", "TagId");
b.HasIndex("TenantId", "EntityId", "TagId");
b.ToTable("CmsEntityTags");
});
modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("CmsTags");
});
modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasColumnName("Email");
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
.HasColumnName("Name");
b.Property<string>("PhoneNumber")
.HasMaxLength(16)
.HasColumnType("nvarchar(16)")
.HasColumnName("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("PhoneNumberConfirmed");
b.Property<string>("Surname")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
.HasColumnName("Surname");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasColumnName("UserName");
b.HasKey("Id");
b.HasIndex("TenantId", "Email");
b.HasIndex("TenantId", "UserName");
b.ToTable("CmsUsers");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null)
.WithMany()
.HasForeignKey("ContainerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

309
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs

@ -0,0 +1,309 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.CmsKit.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsComments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Text = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false),
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsComments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsContents",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsContents", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsEntityTags",
columns: table => new
{
TagId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId });
});
migrationBuilder.CreateTable(
name: "CmsPages",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Url = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsPages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsRatings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StarCount = table.Column<short>(type: "smallint", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsRatings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsTags",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsTags", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUserReactions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ReactionName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUserReactions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUsers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobs", x => x.Id);
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_ContainerId",
table: "AbpBlobs",
column: "ContainerId");
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_EntityType_EntityId",
table: "CmsComments",
columns: new[] { "TenantId", "EntityType", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_RepliedCommentId",
table: "CmsComments",
columns: new[] { "TenantId", "RepliedCommentId" });
migrationBuilder.CreateIndex(
name: "IX_CmsContents_TenantId_EntityType_EntityId",
table: "CmsContents",
columns: new[] { "TenantId", "EntityType", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_CmsEntityTags_TenantId_EntityId_TagId",
table: "CmsEntityTags",
columns: new[] { "TenantId", "EntityId", "TagId" });
migrationBuilder.CreateIndex(
name: "IX_CmsPages_TenantId_Url",
table: "CmsPages",
columns: new[] { "TenantId", "Url" });
migrationBuilder.CreateIndex(
name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId",
table: "CmsRatings",
columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" });
migrationBuilder.CreateIndex(
name: "IX_CmsTags_TenantId_Name",
table: "CmsTags",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_Email",
table: "CmsUsers",
columns: new[] { "TenantId", "Email" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_UserName",
table: "CmsUsers",
columns: new[] { "TenantId", "UserName" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpBlobs");
migrationBuilder.DropTable(
name: "CmsComments");
migrationBuilder.DropTable(
name: "CmsContents");
migrationBuilder.DropTable(
name: "CmsEntityTags");
migrationBuilder.DropTable(
name: "CmsPages");
migrationBuilder.DropTable(
name: "CmsRatings");
migrationBuilder.DropTable(
name: "CmsTags");
migrationBuilder.DropTable(
name: "CmsUserReactions");
migrationBuilder.DropTable(
name: "CmsUsers");
migrationBuilder.DropTable(
name: "AbpBlobContainers");
}
}
}

529
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -0,0 +1,529 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))]
partial class CmsKitHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.1");
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<Guid>("ContainerId")
.HasColumnType("uniqueidentifier");
b.Property<byte[]>("Content")
.HasMaxLength(2147483647)
.HasColumnType("varbinary(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("ContainerId");
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
});
modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid?>("RepliedCommentId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Text")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.HasKey("Id");
b.HasIndex("TenantId", "RepliedCommentId");
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsComments");
});
modelBuilder.Entity("Volo.CmsKit.Contents.Content", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2147483647)
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsContents");
});
modelBuilder.Entity("Volo.CmsKit.Pages.Page", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("TenantId", "Url");
b.ToTable("CmsPages");
});
modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<short>("StarCount")
.HasColumnType("smallint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId");
b.ToTable("CmsRatings");
});
modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ReactionName")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName");
b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName");
b.ToTable("CmsUserReactions");
});
modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b =>
{
b.Property<string>("EntityId")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("TagId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("EntityId", "TagId");
b.HasIndex("TenantId", "EntityId", "TagId");
b.ToTable("CmsEntityTags");
});
modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("CmsTags");
});
modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasColumnName("Email");
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
.HasColumnName("Name");
b.Property<string>("PhoneNumber")
.HasMaxLength(16)
.HasColumnType("nvarchar(16)")
.HasColumnName("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("PhoneNumberConfirmed");
b.Property<string>("Surname")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
.HasColumnName("Surname");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasColumnName("UserName");
b.HasKey("Id");
b.HasIndex("TenantId", "Email");
b.HasIndex("TenantId", "UserName");
b.ToTable("CmsUsers");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null)
.WithMany()
.HasForeignKey("ContainerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

1
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj

@ -24,6 +24,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\blob-storing-database\src\Volo.Abp.BlobStoring.Database.EntityFrameworkCore\Volo.Abp.BlobStoring.Database.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>

6
modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs

@ -15,6 +15,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
@ -63,8 +64,9 @@ namespace Volo.CmsKit
typeof(AbpTenantManagementApplicationModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreSerilogModule)
)]
typeof(AbpAspNetCoreSerilogModule),
typeof(BlobStoringDatabaseEntityFrameworkCoreModule)
)]
public class CmsKitWebUnifiedModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs

@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
@ -28,6 +29,7 @@ namespace Volo.CmsKit.EntityFrameworkCore
modelBuilder.ConfigureTenantManagement();
modelBuilder.ConfigureFeatureManagement();
modelBuilder.ConfigureCmsKit();
modelBuilder.ConfigureBlobStoring();
}
}
}

1725
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs

File diff suppressed because it is too large

95
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs

@ -0,0 +1,95 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.CmsKit.Migrations
{
public partial class Added_Blob_Storing : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "CmsPages",
type: "nvarchar(512)",
maxLength: 512,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(515)",
oldMaxLength: 515,
oldNullable: true);
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobs", x => x.Id);
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_ContainerId",
table: "AbpBlobs",
column: "ContainerId");
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpBlobs");
migrationBuilder.DropTable(
name: "AbpBlobContainers");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "CmsPages",
type: "nvarchar(515)",
maxLength: 515,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(512)",
oldMaxLength: 512,
oldNullable: true);
}
}
}

86
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs

@ -273,6 +273,79 @@ namespace Volo.CmsKit.Migrations
b.ToTable("AbpEntityPropertyChanges");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<Guid>("ContainerId")
.HasColumnType("uniqueidentifier");
b.Property<byte[]>("Content")
.HasMaxLength(2147483647)
.HasColumnType("varbinary(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("ContainerId");
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
@ -1197,8 +1270,8 @@ namespace Volo.CmsKit.Migrations
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(515)
.HasColumnType("nvarchar(515)");
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
@ -1499,6 +1572,15 @@ namespace Volo.CmsKit.Migrations
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null)
.WithMany()
.HasForeignKey("ContainerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole", null)

1
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj

@ -32,6 +32,7 @@
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application\Volo.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Web\Volo.Abp.TenantManagement.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.EntityFrameworkCore\Volo.Abp.TenantManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\blob-storing-database\src\Volo.Abp.BlobStoring.Database.EntityFrameworkCore\Volo.Abp.BlobStoring.Database.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>

10
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs

@ -1,10 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Volo.CmsKit.Admin.Pages
{
public class CheckUrlInputDto
{
[Required]
public string Url { get; set; }
}
}

6
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs

@ -1,15 +1,21 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
using Volo.CmsKit.Contents;
using Volo.CmsKit.Pages;
namespace Volo.CmsKit.Admin.Pages
{
public class CreatePageInputDto
{
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))]
public string Title { get; set; }
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))]
public string Url { get; set; }
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))]
public string Description { get; set; }
}
}

18
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs

@ -1,18 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Volo.CmsKit.Admin.Pages
{
public class CreatePageWithContentInputDto
{
[Required]
public string Title { get; set; }
[Required]
public string Url { get; set; }
public string Description { get; set; }
[Required]
public string Content { get; set; }
}
}

9
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs

@ -0,0 +1,9 @@
using Volo.Abp.Application.Dtos;
namespace Volo.CmsKit.Admin.Pages
{
public class GetPagesInputDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}
}

17
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs

@ -1,22 +1,11 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Content;
namespace Volo.CmsKit.Admin.Pages
{
public interface IPageAdminAppService
public interface IPageAdminAppService : ICrudAppService<PageDto, PageDto, Guid, GetPagesInputDto, CreatePageInputDto, UpdatePageInputDto>
{
Task<PageDto> GetAsync(Guid id);
Task<PageDto> CreatePageAsync(CreatePageInputDto input);
Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input);
Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input);
Task<bool> DoesUrlExistAsync(CheckUrlInputDto input);
Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input);
Task DeleteAsync(Guid id);
}
}

17
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs

@ -1,17 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.CmsKit.Admin.Contents;
namespace Volo.CmsKit.Admin.Pages
{
public class PageWithContentDto : EntityDto<Guid>
{
public string Title { get; set; }
public string Url { get; set; }
public string Description { get; set; }
public ContentDto Content { get; set; }
}
}

10
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs

@ -1,10 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Volo.CmsKit.Admin.Pages
{
public class UpdatePageContentInputDto
{
[Required]
public string Content { get; set; }
}
}

6
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs

@ -1,15 +1,21 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
using Volo.CmsKit.Contents;
using Volo.CmsKit.Pages;
namespace Volo.CmsKit.Admin.Pages
{
public class UpdatePageInputDto
{
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))]
public string Title { get; set; }
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))]
public string Url { get; set; }
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))]
public string Description { get; set; }
}
}

8
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs

@ -27,6 +27,14 @@ namespace Volo.CmsKit.Permissions
tagGroup.AddChild(CmsKitAdminPermissions.Tags.Update, L("Permission:TagManagement.Update"));
tagGroup.AddChild(CmsKitAdminPermissions.Tags.Delete, L("Permission:TagManagement.Delete"));
}
if (GlobalFeatureManager.Instance.IsEnabled<PagesFeature>())
{
var pageManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement"));
pageManagement.AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create"));
pageManagement.AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update"));
pageManagement.AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete"));
}
}
private static LocalizableString L(string name)

11
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs

@ -5,6 +5,7 @@ namespace Volo.CmsKit.Permissions
public class CmsKitAdminPermissions
{
public const string GroupName = "CmsKit";
public static class Tags
{
public const string Default = GroupName + ".Tags";
@ -12,7 +13,7 @@ namespace Volo.CmsKit.Permissions
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
public static class Contents
{
public const string Default = GroupName + ".Contents";
@ -20,5 +21,13 @@ namespace Volo.CmsKit.Permissions
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
public static class Pages
{
public const string Default = GroupName + ".Pages";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
}
}

85
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs

@ -1,21 +1,24 @@
using System;
using System.Threading;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.CmsKit.Contents;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.GlobalFeatures;
using Volo.CmsKit.GlobalFeatures;
using Volo.CmsKit.Pages;
using Volo.CmsKit.Permissions;
namespace Volo.CmsKit.Admin.Pages
{
[RequiresGlobalFeature(typeof(PagesFeature))]
[Authorize(CmsKitAdminPermissions.Pages.Default)]
public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppService
{
protected readonly IPageRepository PageRepository;
protected readonly IContentRepository ContentRepository;
public PageAdminAppService(IPageRepository pageRepository, IContentRepository contentRepository)
public PageAdminAppService(IPageRepository pageRepository)
{
PageRepository = pageRepository;
ContentRepository = contentRepository;
}
public virtual async Task<PageDto> GetAsync(Guid id)
@ -25,34 +28,37 @@ namespace Volo.CmsKit.Admin.Pages
return ObjectMapper.Map<Page, PageDto>(page);
}
public virtual async Task<PageDto> CreatePageAsync(CreatePageInputDto input)
public virtual async Task<PagedResultDto<PageDto>> GetListAsync(GetPagesInputDto input)
{
var page = await CreatePageAsync(input.Title, input.Url, input.Description);
await PageRepository.InsertAsync(page);
var count = await PageRepository.GetCountAsync(input.Filter);
return ObjectMapper.Map<Page, PageDto>(page);
var pages = await PageRepository.GetListAsync(
input.Filter,
input.MaxResultCount,
input.SkipCount,
input.Sorting
);
return new PagedResultDto<PageDto>(
count,
ObjectMapper.Map<List<Page>, List<PageDto>>(pages)
);
}
public virtual async Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input)
[Authorize(CmsKitAdminPermissions.Pages.Create)]
public virtual async Task<PageDto> CreateAsync(CreatePageInputDto input)
{
var page = await CreatePageAsync(input.Title, input.Url, input.Description);
await CheckPageUrlAsync(input.Url);
await PageRepository.InsertAsync(page);
var content = new Content(
GuidGenerator.Create(),
nameof(Page),
page.Id.ToString(),
input.Content,
page.TenantId);
var page = new Page(GuidGenerator.Create(), input.Title, input.Url, input.Description, CurrentTenant?.Id);
await ContentRepository.InsertAsync(content);
await PageRepository.InsertAsync(page);
return ObjectMapper.Map<Page, PageDto>(page);
}
public virtual async Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input)
[Authorize(CmsKitAdminPermissions.Pages.Update)]
public virtual async Task<PageDto> UpdateAsync(Guid id, UpdatePageInputDto input)
{
var page = await PageRepository.GetAsync(id);
@ -66,42 +72,21 @@ namespace Volo.CmsKit.Admin.Pages
page.Description = input.Description;
await PageRepository.UpdateAsync(page);
return ObjectMapper.Map<Page, PageDto>(page);
}
public virtual Task<bool> DoesUrlExistAsync(CheckUrlInputDto input)
{
return PageRepository.DoesExistAsync(input.Url);
}
public virtual async Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input)
{
var pageContent = await ContentRepository.GetAsync(nameof(Page), id.ToString());
pageContent.SetValue(input.Content);
await ContentRepository.UpdateAsync(pageContent);
return ObjectMapper.Map<Page, PageDto>(page);
}
[Authorize(CmsKitAdminPermissions.Pages.Delete)]
public virtual async Task DeleteAsync(Guid id)
{
await ContentRepository.DeleteAsync(nameof(Page), id.ToString(), CurrentTenant?.Id, CancellationToken.None);
await PageRepository.DeleteAsync(id, cancellationToken: CancellationToken.None);
}
protected virtual async Task<Page> CreatePageAsync(string title, string url, string description)
{
await CheckPageUrlAsync(url);
return new Page(GuidGenerator.Create(), title, url, description, CurrentTenant?.Id);
await PageRepository.DeleteAsync(id);
}
protected virtual async Task CheckPageUrlAsync(string url)
{
if (await PageRepository.DoesExistAsync(url))
if (await PageRepository.ExistsAsync(url))
{
throw new UserFriendlyException("Url exist");
throw new PageUrlAlreadyExistException(url);
}
}
}

70
modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs

@ -1,70 +0,0 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.CmsKit.Admin.Pages;
namespace Volo.CmsKit.Admin.Page
{
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)]
[Area("cms-kit")]
[Route("api/cms-kit-admin/pages")]
public class PageAdminController : CmsKitAdminController, IPageAdminAppService
{
protected readonly IPageAdminAppService PageAdminAppService;
public PageAdminController(IPageAdminAppService pageAdminAppService)
{
PageAdminAppService = pageAdminAppService;
}
[HttpGet]
[Route("{id}")]
public virtual Task<PageDto> GetAsync(Guid id)
{
return PageAdminAppService.GetAsync(id);
}
[HttpPost]
[Route("create")]
public virtual Task<PageDto> CreatePageAsync(CreatePageInputDto input)
{
return PageAdminAppService.CreatePageAsync(input);
}
[HttpPost]
[Route("create-with-content")]
public virtual Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input)
{
return PageAdminAppService.CreatePageWithContentAsync(input);
}
[HttpPut]
[Route("{id}")]
public virtual Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input)
{
return PageAdminAppService.UpdatePageAsync(id, input);
}
[HttpPost]
[Route("does-url-exist")]
public virtual Task<bool> DoesUrlExistAsync(CheckUrlInputDto input)
{
return PageAdminAppService.DoesUrlExistAsync(input);
}
[HttpPut]
[Route("update-content/{id}")]
public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input)
{
return PageAdminAppService.UpdatePageContentAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public virtual Task DeleteAsync(Guid id)
{
return PageAdminAppService.DeleteAsync(id);
}
}
}

63
modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs

@ -0,0 +1,63 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.GlobalFeatures;
using Volo.CmsKit.GlobalFeatures;
using Volo.CmsKit.Permissions;
namespace Volo.CmsKit.Admin.Pages
{
[RequiresGlobalFeature(typeof(PagesFeature))]
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)]
[Area("cms-kit")]
[Authorize(CmsKitAdminPermissions.Pages.Default)]
[Route("api/cms-kit-admin/pages")]
public class PageAdminController : CmsKitAdminController, IPageAdminAppService
{
protected readonly IPageAdminAppService PageAdminAppService;
public PageAdminController(IPageAdminAppService pageAdminAppService)
{
PageAdminAppService = pageAdminAppService;
}
[HttpGet]
[Route("{id}")]
public virtual Task<PageDto> GetAsync(Guid id)
{
return PageAdminAppService.GetAsync(id);
}
[HttpGet]
public virtual Task<PagedResultDto<PageDto>> GetListAsync(GetPagesInputDto input)
{
return PageAdminAppService.GetListAsync(input);
}
[HttpPost]
[Authorize(CmsKitAdminPermissions.Pages.Create)]
public virtual Task<PageDto> CreateAsync(CreatePageInputDto input)
{
return PageAdminAppService.CreateAsync(input);
}
[HttpPut]
[Authorize(CmsKitAdminPermissions.Pages.Update)]
[Route("{id}")]
public virtual Task<PageDto> UpdateAsync(Guid id, UpdatePageInputDto input)
{
return PageAdminAppService.UpdateAsync(id, input);
}
[HttpDelete]
[Authorize(CmsKitAdminPermissions.Pages.Delete)]
[Route("{id}")]
public virtual Task DeleteAsync(Guid id)
{
return PageAdminAppService.DeleteAsync(id);
}
}
}

6
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs

@ -3,6 +3,12 @@
public static class CmsKitErrorCodes
{
public const string TagAlreadyExist = "CmsKit:0001";
public const string ContentAlreadyExist = "CmsKit:0002";
public static class Pages
{
public const string UrlAlreadyExist = "CmsKit:Page:0001";
}
}
}

13
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json

@ -17,9 +17,13 @@
"Permission:Contents.Delete": "Delete Content",
"Permission:Contents.Update": "Update Content",
"Permission:TagManagement": "Tag Management",
"Permission:TagManagement.Create": "Create Tag",
"Permission:TagManagement.Delete": "Delete Tag",
"Permission:TagManagement.Update": "Update Tag",
"Permission:TagManagement.Create": "Create",
"Permission:TagManagement.Delete": "Delete",
"Permission:TagManagement.Update": "Update",
"Permission:PageManagement": "Page Management",
"Permission:PageManagement:Create": "Create",
"Permission:PageManagement:Delete": "Delete",
"Permission:PageManagement:Update": "Update",
"PickYourReaction": "Pick your reaction",
"RatingUndoMessage": "Your rating will be undo.",
"Reply": "Reply",
@ -30,6 +34,7 @@
"Undo": "Undo",
"Update": "Update",
"YourComment": "Your comment",
"YourReply": "Your reply"
"YourReply": "Your reply",
"CmsKit:Page:0001": "The given url ({0}) already exists."
}
}

3
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json

@ -30,6 +30,7 @@
"Undo": "Geri al",
"Update": "Güncelle",
"YourComment": "Yorumunuz",
"YourReply": "Cevabınız"
"YourReply": "Cevabınız",
"CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır."
}
}

8
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs

@ -2,10 +2,10 @@
{
public class PageConsts
{
public static int MaxTitleLength = 256;
public static int MaxTitleLength { get; set; } = 256;
public static int MaxUrlLength { get; set; } = 256;
public static int MaxUrlLength = 256;
public static int MaxDescriptionLength = 515;
public static int MaxDescriptionLength { get; set; } = 512;
}
}

17
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@ -6,10 +8,19 @@ namespace Volo.CmsKit.Pages
{
public interface IPageRepository : IBasicRepository<Page, Guid>
{
Task<Page> GetByUrlAsync(string url);
Task<int> GetCountAsync(string filter = null, CancellationToken cancellationToken = default);
Task<Page> FindByUrlAsync(string url);
Task<List<Page>> GetListAsync(
string filter = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
string sorting = null,
CancellationToken cancellationToken = default);
Task<Page> GetByUrlAsync(string url, CancellationToken cancellationToken = default);
Task<bool> DoesExistAsync(string url);
Task<Page> FindByUrlAsync(string url, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(string url, CancellationToken cancellationToken = default);
}
}

23
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs

@ -0,0 +1,23 @@
using System;
using System.Runtime.Serialization;
using JetBrains.Annotations;
using Volo.Abp;
namespace Volo.CmsKit.Pages
{
[Serializable]
public class PageUrlAlreadyExistException : BusinessException
{
public PageUrlAlreadyExistException([NotNull] string url)
{
Code = CmsKitErrorCodes.Pages.UrlAlreadyExist;
WithData(nameof(Page.Url), url);
}
public PageUrlAlreadyExistException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
}
}

41
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs

@ -1,4 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
@ -13,19 +17,44 @@ namespace Volo.CmsKit.Pages
{
}
public Task<Page> GetByUrlAsync(string url)
public virtual async Task<int> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{
return GetAsync(x => x.Url == url);
return await (await GetDbSetAsync()).WhereIf(
!filter.IsNullOrWhiteSpace(),
x =>
x.Title.Contains(filter)
).CountAsync(GetCancellationToken(cancellationToken));
}
public Task<Page> FindByUrlAsync(string url)
public virtual async Task<List<Page>> GetListAsync(
string filter = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
string sorting = null,
CancellationToken cancellationToken = default)
{
return FindAsync(x => x.Url == url);
return await (await GetDbSetAsync()).WhereIf(
!filter.IsNullOrWhiteSpace(),
x =>
x.Title.Contains(filter))
.OrderBy(sorting ?? nameof(Page.Title))
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<bool> DoesExistAsync(string url)
public virtual Task<Page> GetByUrlAsync(string url, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url);
return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual Task<Page> FindByUrlAsync(string url, CancellationToken cancellationToken = default)
{
return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistsAsync(string url, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken));
}
}
}

50
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs

@ -1,5 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
@ -13,19 +18,52 @@ namespace Volo.CmsKit.MongoDB.Pages
{
}
public Task<Page> GetByUrlAsync(string url)
public virtual async Task<int> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{
return GetAsync(x => x.Url == url);
var cancellation = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellation))
.WhereIf<Page, IMongoQueryable<Page>>(
!filter.IsNullOrWhiteSpace(),
u =>
u.Title.Contains(filter)
).CountAsync(cancellation);
}
public Task<Page> FindByUrlAsync(string url)
public virtual async Task<List<Page>> GetListAsync(
string filter = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
string sorting = null,
CancellationToken cancellationToken = default)
{
return FindAsync(x => x.Url == url);
var cancellation = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellation))
.WhereIf<Page, IMongoQueryable<Page>>(
!filter.IsNullOrWhiteSpace(),
u =>
u.Title.Contains(filter)
)
.OrderBy(sorting ?? nameof(Page.Title))
.As<IMongoQueryable<Page>>()
.PageBy<Page, IMongoQueryable<Page>>(skipCount, maxResultCount)
.ToListAsync(cancellation);
}
public async Task<bool> DoesExistAsync(string url)
public virtual Task<Page> GetByUrlAsync(string url, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync()).AnyAsync(x => x.Url == url);
return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual Task<Page> FindByUrlAsync(string url, CancellationToken cancellationToken = default)
{
return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistsAsync(string url, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken));
}
}
}

2
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs

@ -8,7 +8,5 @@ namespace Volo.CmsKit.Public.Pages
public string Title { get; set; }
public string Url { get; set; }
public string Description { get; set; }
}
}

3
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml

@ -9,6 +9,5 @@
new
{
pageId = Model.Page.Id,
title = Model.Page.Title,
description = Model.Page.Description
title = Model.Page.Title
})

11
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml

@ -12,10 +12,11 @@
</abp-card-header>
<abp-card-body>
<p>
@Model.Description
</p>
@await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = nameof(Page), entityId = Model.Id.ToString() })
@await Component.InvokeAsync(typeof(ContentViewComponent),
new
{
entityType = nameof(Page),
entityId = Model.Id.ToString()
})
</abp-card-body>
</abp-card>

5
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs

@ -21,8 +21,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages
var model = new PageViewModel
{
Id = pageId,
Title = title,
Description = description
Title = title
};
return View("~/Pages/CmsKit/Shared/Components/Pages/Default.cshtml", model);
@ -34,7 +33,5 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
}

117
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Uow;
@ -14,16 +15,41 @@ namespace Volo.CmsKit.Pages
private readonly IPageAdminAppService _pageAdminAppService;
private readonly IPageRepository _pageRepository;
private readonly IContentRepository _contentRepository;
public PageAdminAppService_Tests()
{
_data = GetRequiredService<CmsKitTestData>();
_pageAdminAppService = GetRequiredService<IPageAdminAppService>();
_pageRepository = GetRequiredService<IPageRepository>();
_contentRepository = GetRequiredService<IContentRepository>();
}
[Fact]
public async Task ShouldGetListAsync()
{
var input = new GetPagesInputDto();
var pages = await _pageAdminAppService.GetListAsync(input);
pages.TotalCount.ShouldBe(2);
pages.Items.Count.ShouldBe(2);
input.MaxResultCount = 1;
var pages2 = await _pageAdminAppService.GetListAsync(input);
pages2.TotalCount.ShouldBe(2);
pages2.Items.Count.ShouldBe(1);
pages2.Items.First().Title.ShouldBe(_data.Page_1_Title);
input.SkipCount = 1;
var pages3 = await _pageAdminAppService.GetListAsync(input);
pages3.TotalCount.ShouldBe(2);
pages3.Items.Count.ShouldBe(1);
pages3.Items.First().Title.ShouldBe(_data.Page_2_Title);
}
[Fact]
public async Task ShouldGetAsync()
{
@ -41,7 +67,7 @@ namespace Volo.CmsKit.Pages
Url = "test-url"
};
await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageAsync(dto));
await Should.NotThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto));
var page = await _pageRepository.GetByUrlAsync(dto.Url);
@ -49,7 +75,7 @@ namespace Volo.CmsKit.Pages
}
[Fact]
public async Task ShouldNotCreateAsync()
public async Task ShouldNotCreateExistUrlAsync()
{
var dto = new CreatePageInputDto
{
@ -57,39 +83,9 @@ namespace Volo.CmsKit.Pages
Url = _data.Page_1_Url
};
await Should.ThrowAsync<Exception>(async () => await _pageAdminAppService.CreatePageAsync(dto));
}
[Fact]
public async Task ShouldCreateWithContentAsync()
{
var dto = new CreatePageWithContentInputDto
{
Title = "test",
Url = "test-url",
Content = "my-test-content"
};
await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto));
var page = await _pageRepository.GetByUrlAsync(dto.Url);
var content = await _contentRepository.GetAsync(nameof(Page), page.Id.ToString());
var exception = await Should.ThrowAsync<PageUrlAlreadyExistException>(async () => await _pageAdminAppService.CreateAsync(dto));
content.Value.ShouldBe(dto.Content);
}
[Fact]
public async Task ShouldNotCreateWithContentAsync()
{
var dto = new CreatePageWithContentInputDto
{
Title = "test",
Url = _data.Page_1_Url,
Content = "my-test-content"
};
await Should.ThrowAsync<Exception>(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto));
exception.Code.ShouldBe(CmsKitErrorCodes.Pages.UrlAlreadyExist);
}
[Fact]
@ -102,7 +98,7 @@ namespace Volo.CmsKit.Pages
Url = _data.Page_1_Url+ "test"
};
await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto));
await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto));
var updatedPage = await _pageRepository.GetAsync(_data.Page_1_Id);
@ -117,7 +113,7 @@ namespace Volo.CmsKit.Pages
}
[Fact]
public async Task ShouldNotUpdatePageAsync()
public async Task ShouldNotUpdateWithExistUrlAsync()
{
var dto = new UpdatePageInputDto
{
@ -126,58 +122,15 @@ namespace Volo.CmsKit.Pages
Url = _data.Page_2_Url
};
await Should.ThrowAsync<Exception>(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto));
await Should.ThrowAsync<Exception>(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto));
}
[Fact]
public async Task ShouldBeExistAsync()
{
var dto = new CheckUrlInputDto
{
Url = _data.Page_1_Url
};
var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto);
doesExist.ShouldBeTrue();
}
[Fact]
public async Task ShouldNotBeExistAsync()
{
var dto = new CheckUrlInputDto
{
Url = _data.Page_1_Url+ "+"
};
var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto);
doesExist.ShouldBeFalse();
}
[Fact]
public async Task ShouldUpdateContentAsync()
{
var dto = new UpdatePageContentInputDto
{
Content = "my-new-content"
};
await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageContentAsync(_data.Page_1_Id, dto));
var content = await _contentRepository.GetAsync(nameof(Page), _data.Page_1_Id.ToString());
content.Value.ShouldBe(dto.Content);
}
[Fact]
public async Task ShouldDeleteAsync()
{
await _pageAdminAppService.DeleteAsync(_data.Page_1_Id);
await Should.ThrowAsync<Exception>(async () => await _pageRepository.GetAsync(_data.Page_1_Id));
await Should.ThrowAsync<Exception>(async () => await _contentRepository.GetAsync(nameof(Page), _data.Page_1_Id.ToString()));
}
}
}

13
modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs

@ -1,11 +1,14 @@
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Volo.Abp;
using Volo.Abp.Authorization;
using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring;
using Volo.Abp.Data;
using Volo.Abp.GlobalFeatures;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;
using Volo.FileManagement;
namespace Volo.CmsKit
{
@ -26,6 +29,16 @@ namespace Volo.CmsKit
GlobalFeatureManager.Instance.Modules.CmsKit().EnableAll();
});
context.Services.AddSingleton<IBlobProvider>(Substitute.For<FakeBlobProvider>());
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureAll((containerName, containerConfiguration) =>
{
containerConfiguration.ProviderType = typeof(FakeBlobProvider);
});
});
context.Services.AddAlwaysAllowAuthorization();
}

34
modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs

@ -0,0 +1,34 @@
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
namespace Volo.FileManagement
{
public class FakeBlobProvider : IBlobProvider
{
public virtual Task SaveAsync(BlobProviderSaveArgs args)
{
throw new System.NotImplementedException();
}
public virtual Task<bool> DeleteAsync(BlobProviderDeleteArgs args)
{
throw new System.NotImplementedException();
}
public virtual Task<bool> ExistsAsync(BlobProviderExistsArgs args)
{
throw new System.NotImplementedException();
}
public virtual Task<Stream> GetAsync(BlobProviderGetArgs args)
{
throw new System.NotImplementedException();
}
public virtual Task<Stream> GetOrNullAsync(BlobProviderGetArgs args)
{
throw new System.NotImplementedException();
}
}
}

39
modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Linq;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Modularity;
using Xunit;
@ -17,6 +18,38 @@ namespace Volo.CmsKit.Pages
_pageRepository = GetRequiredService<IPageRepository>();
}
[Fact]
public async Task CountAsync()
{
var totalCount = await _pageRepository.GetCountAsync();
totalCount.ShouldBe(2);
var filteredCount = await _pageRepository.GetCountAsync(_cmsKitTestData.Page_2_Title);
filteredCount.ShouldBe(1);
}
[Fact]
public async Task GetListAsync()
{
var list = await _pageRepository.GetListAsync();
list.ShouldNotBeNull();
list.Count.ShouldBe(2);
var list_page_1 = await _pageRepository.GetListAsync(maxResultCount: 1);
var list_page_2 = await _pageRepository.GetListAsync(maxResultCount: 1, skipCount: 1);
list_page_1.ShouldNotBeNull();
list_page_1.Count.ShouldBe(1);
list_page_1.First().Title.ShouldBe(_cmsKitTestData.Page_1_Title);
list_page_2.ShouldNotBeNull();
list_page_1.Count.ShouldBe(1);
list_page_2.First().Title.ShouldBe(_cmsKitTestData.Page_2_Title);
}
[Fact]
public async Task ShouldGetByUrlAsync()
{
@ -46,7 +79,7 @@ namespace Volo.CmsKit.Pages
[Fact]
public async Task ShouldBeExistAsync()
{
var page = await _pageRepository.DoesExistAsync(_cmsKitTestData.Page_1_Url);
var page = await _pageRepository.ExistsAsync(_cmsKitTestData.Page_1_Url);
page.ShouldBeTrue();
}
@ -54,7 +87,7 @@ namespace Volo.CmsKit.Pages
[Fact]
public async Task ShouldNotBeExistAsync()
{
var page = await _pageRepository.DoesExistAsync("not-exist-lyrics");
var page = await _pageRepository.ExistsAsync("not-exist-lyrics");
page.ShouldBeFalse();
}

1
modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj

@ -15,6 +15,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Authorization\Volo.Abp.Authorization.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.BlobStoring\Volo.Abp.BlobStoring.csproj" />
<ProjectReference Include="..\..\src\Volo.CmsKit.Domain\Volo.CmsKit.Domain.csproj" />
</ItemGroup>

Loading…
Cancel
Save