Skip to content

Commit

Permalink
Merge pull request #7085 from abpframework/cms-kit/refactoring
Browse files Browse the repository at this point in the history
CmsKit - Remove huge content value from list items
  • Loading branch information
ilkayilknur committed Jan 19, 2021
2 parents 739a4f5 + 8fe9a59 commit badad8d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Volo.CmsKit.Admin.Contents
public interface IContentAdminAppService
: ICrudAppService<
ContentDto,
ContentGetListDto,
Guid,
ContentGetListInput,
ContentCreateDto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public CmsKitAdminApplicationAutoMapperProfile()
CreateMap<Page, PageDto>();

CreateMap<Content, ContentDto>(MemberList.Destination);
CreateMap<Content, ContentGetListDto>(MemberList.Destination);
CreateMap<ContentCreateDto, Content>(MemberList.Source);
CreateMap<ContentUpdateDto, Content>(MemberList.Source);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ContentAdminAppService :
CrudAppService<
Content,
ContentDto,
ContentGetListDto,
Guid,
ContentGetListInput,
ContentCreateDto,
Expand Down Expand Up @@ -51,7 +52,7 @@ public override async Task<ContentDto> CreateAsync(ContentCreateDto input)

await ContentManager.InsertAsync(entity);

return MapToGetListOutputDto(entity);
return MapToGetOutputDto(entity);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Task<ContentDto> GetAsync(Guid id)

[HttpGet]
[Authorize(CmsKitAdminPermissions.Contents.Default)]
public Task<PagedResultDto<ContentDto>> GetListAsync(ContentGetListInput input)
public Task<PagedResultDto<ContentGetListDto>> GetListAsync(ContentGetListInput input)
{
return ContentAdminAppService.GetListAsync(input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public async Task ShouldGetListAsync()
result.ShouldNotBeNull();
result.Items.ShouldNotBeEmpty();
result.Items.Count.ShouldBe(4);
result.Items.All(x => x.ShouldBeOfType<ContentGetListDto>() != null);
}

[Fact]
Expand All @@ -46,6 +47,8 @@ public async Task ShouldGetAsync()
var result = await _service.GetAsync(_data.Content_1_Id);

result.ShouldNotBeNull();
result.ShouldBeOfType<Admin.Contents.ContentDto>();
result.ShouldNotBeNull(result.Value);
}

[Fact]
Expand Down

0 comments on commit badad8d

Please sign in to comment.