Browse Source

Merge pull request #7085 from abpframework/cms-kit/refactoring

CmsKit - Remove huge content value from list items
pull/7355/head
İlkay İlknur 6 years ago
committed by GitHub
parent
commit
badad8d59f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs
  2. 1
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs
  3. 1
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs
  4. 3
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs
  5. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs
  6. 3
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs

12
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.Application.Dtos;
namespace Volo.CmsKit.Admin.Contents
{
public class ContentGetListDto : EntityDto<Guid>
{
public string EntityType { get; set; }
public string EntityId { get; set; }
}
}

1
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs

@ -7,6 +7,7 @@ namespace Volo.CmsKit.Admin.Contents
public interface IContentAdminAppService
: ICrudAppService<
ContentDto,
ContentGetListDto,
Guid,
ContentGetListInput,
ContentCreateDto,

1
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs

@ -13,6 +13,7 @@ namespace Volo.CmsKit.Admin
CreateMap<Page, PageDto>();
CreateMap<Content, ContentDto>(MemberList.Destination);
CreateMap<Content, ContentGetListDto>(MemberList.Destination);
CreateMap<ContentCreateDto, Content>(MemberList.Source);
CreateMap<ContentUpdateDto, Content>(MemberList.Source);
}

3
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs

@ -14,6 +14,7 @@ namespace Volo.CmsKit.Admin.Contents
CrudAppService<
Content,
ContentDto,
ContentGetListDto,
Guid,
ContentGetListInput,
ContentCreateDto,
@ -51,7 +52,7 @@ namespace Volo.CmsKit.Admin.Contents
await ContentManager.InsertAsync(entity);
return MapToGetListOutputDto(entity);
return MapToGetOutputDto(entity);
}
}
}

2
modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs

@ -48,7 +48,7 @@ namespace Volo.CmsKit.Admin.Contents
[HttpGet]
[Authorize(CmsKitAdminPermissions.Contents.Default)]
public Task<PagedResultDto<ContentDto>> GetListAsync(ContentGetListInput input)
public Task<PagedResultDto<ContentGetListDto>> GetListAsync(ContentGetListInput input)
{
return ContentAdminAppService.GetListAsync(input);
}

3
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs

@ -38,6 +38,7 @@ namespace Volo.CmsKit.Contents
result.ShouldNotBeNull();
result.Items.ShouldNotBeEmpty();
result.Items.Count.ShouldBe(4);
result.Items.All(x => x.ShouldBeOfType<ContentGetListDto>() != null);
}
[Fact]
@ -46,6 +47,8 @@ namespace Volo.CmsKit.Contents
var result = await _service.GetAsync(_data.Content_1_Id);
result.ShouldNotBeNull();
result.ShouldBeOfType<Admin.Contents.ContentDto>();
result.ShouldNotBeNull(result.Value);
}
[Fact]

Loading…
Cancel
Save