Browse Source

CmsKit - Remove Description from Page

pull/7860/head
enisn 6 years ago
parent
commit
94dbe8f2ed
  1. 3
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs
  2. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs
  3. 3
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs
  4. 3
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs
  5. 2
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs
  6. 6
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs
  7. 1
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs
  8. 7
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs
  9. 4
      modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs
  10. 4
      modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs
  11. 4
      modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs

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

@ -16,8 +16,5 @@ namespace Volo.CmsKit.Admin.Pages
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
public string Slug { get; set; }
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))]
public string Description { get; set; }
}
}

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

@ -9,7 +9,5 @@ namespace Volo.CmsKit.Admin.Pages
public string Title { get; set; }
public string Slug { get; set; }
public string Description { get; set; }
}
}

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

@ -16,8 +16,5 @@ namespace Volo.CmsKit.Admin.Pages
[Required]
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))]
public string Slug { get; set; }
[DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))]
public string Description { get; set; }
}
}

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

@ -50,7 +50,7 @@ namespace Volo.CmsKit.Admin.Pages
{
await CheckPageSlugAsync(input.Slug);
var page = new Page(GuidGenerator.Create(), input.Title, input.Slug, input.Description, CurrentTenant?.Id);
var page = new Page(GuidGenerator.Create(), input.Title, input.Slug, CurrentTenant?.Id);
await PageRepository.InsertAsync(page);
@ -69,7 +69,6 @@ namespace Volo.CmsKit.Admin.Pages
page.SetTitle(input.Title);
page.SetSlug(input.Slug);
page.Description = input.Description;
await PageRepository.UpdateAsync(page);

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

@ -5,7 +5,5 @@
public static int MaxTitleLength { get; set; } = 256;
public static int MaxSlugLength { get; set; } = 256;
public static int MaxDescriptionLength { get; set; } = 512;
}
}

6
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs

@ -14,18 +14,14 @@ namespace Volo.CmsKit.Pages
[NotNull] public virtual string Slug { get; protected set; }
[CanBeNull] public virtual string Description { get; set; }
protected Page()
{
}
public Page(Guid id, [NotNull] string title, [NotNull] string slug, [CanBeNull] string description = null,
Guid? tenantId = null) : base(id)
public Page(Guid id, [NotNull] string title, [NotNull] string slug, [CanBeNull]Guid? tenantId = null) : base(id)
{
Title = Check.NotNullOrEmpty(title, nameof(title), PageConsts.MaxTitleLength);
Slug = Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength);
Description = Check.Length(description, nameof(description), PageConsts.MaxDescriptionLength);
TenantId = tenantId;
}

1
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs

@ -179,7 +179,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength);
b.Property(x => x.Slug).IsRequired().HasMaxLength(PageConsts.MaxSlugLength);
b.Property(x => x.Description).HasMaxLength(PageConsts.MaxDescriptionLength);
b.HasIndex(x => new { x.TenantId, Url = x.Slug });
});

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

@ -55,7 +55,7 @@ namespace Volo.CmsKit.Pages
{
var page = await _pageAdminAppService.GetAsync(_data.Page_1_Id);
page.Description.ShouldBe(_data.Page_1_Description);
page.Title.ShouldBe(_data.Page_1_Title);
}
[Fact]
@ -94,7 +94,6 @@ namespace Volo.CmsKit.Pages
var dto = new UpdatePageInputDto
{
Title = _data.Page_1_Title + "++",
Description = "new description",
Slug = _data.Page_1_Slug+ "test"
};
@ -107,9 +106,6 @@ namespace Volo.CmsKit.Pages
updatedPage.Slug.ShouldNotBe(_data.Page_1_Slug);
updatedPage.Slug.ShouldBe(dto.Slug);
updatedPage.Description.ShouldNotBe(_data.Page_1_Description);
updatedPage.Description.ShouldBe(dto.Description);
}
[Fact]
@ -118,7 +114,6 @@ namespace Volo.CmsKit.Pages
var dto = new UpdatePageInputDto
{
Title = _data.Page_1_Title + "++",
Description = "new description",
Slug = _data.Page_2_Slug
};

4
modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs

@ -310,13 +310,13 @@ namespace Volo.CmsKit
private async Task SeedPagesAsync()
{
var page1 = new Page(_cmsKitTestData.Page_1_Id, _cmsKitTestData.Page_1_Title, _cmsKitTestData.Page_1_Slug, _cmsKitTestData.Page_1_Description);
var page1 = new Page(_cmsKitTestData.Page_1_Id, _cmsKitTestData.Page_1_Title, _cmsKitTestData.Page_1_Slug);
var page1Content = new Content(_guidGenerator.Create(), nameof(Page), page1.Id.ToString(), _cmsKitTestData.Page_1_Content);
await _pageRepository.InsertAsync(page1);
await _contentRepository.InsertAsync(page1Content);
var page2 = new Page(_cmsKitTestData.Page_2_Id, _cmsKitTestData.Page_2_Title, _cmsKitTestData.Page_2_Slug, _cmsKitTestData.Page_2_Description);
var page2 = new Page(_cmsKitTestData.Page_2_Id, _cmsKitTestData.Page_2_Title, _cmsKitTestData.Page_2_Slug);
var page2Content = new Content(_guidGenerator.Create(), nameof(Page), page2.Id.ToString(), _cmsKitTestData.Page_2_Content);
await _pageRepository.InsertAsync(page2);

4
modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs

@ -47,8 +47,6 @@ namespace Volo.CmsKit
public string Page_1_Slug { get; } = "imagine-dragons-believer-lyrics";
public string Page_1_Description { get; } = "You can get the lyrics of the music.";
public Guid Page_1_Id { get; } = Guid.NewGuid();
public string Page_1_Content => Content_1;
@ -57,8 +55,6 @@ namespace Volo.CmsKit
public string Page_2_Slug { get; } = "imagine-dragons-believer-lyrics-2";
public string Page_2_Description { get; } = "You can get the lyrics of the music.";
public Guid Page_2_Id { get; } = Guid.NewGuid();
public string Page_2_Content => Content_2;

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

@ -56,7 +56,7 @@ namespace Volo.CmsKit.Pages
var page = await _pageRepository.GetBySlugAsync(_cmsKitTestData.Page_1_Slug);
page.ShouldNotBeNull();
page.Description.ShouldBe(_cmsKitTestData.Page_1_Description);
page.Title.ShouldBe(_cmsKitTestData.Page_1_Title);
}
[Fact]
@ -65,7 +65,7 @@ namespace Volo.CmsKit.Pages
var page = await _pageRepository.FindBySlugAsync(_cmsKitTestData.Page_1_Slug);
page.ShouldNotBeNull();
page.Description.ShouldBe(_cmsKitTestData.Page_1_Description);
page.Title.ShouldBe(_cmsKitTestData.Page_1_Title);
}
[Fact]

Loading…
Cancel
Save