Browse Source

CmsKit - Refactor ContentAdminController

pull/7404/head
enisn 6 years ago
parent
commit
3e8f0fdf5d
  1. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs
  2. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs
  3. 4
      modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs
  4. 2
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs

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

@ -14,6 +14,6 @@ namespace Volo.CmsKit.Admin.Contents
ContentCreateDto, ContentCreateDto,
ContentUpdateDto> ContentUpdateDto>
{ {
Task<ContentDto> GetByEntityAsync(string entityType, string entityId); Task<ContentDto> GetAsync(string entityType, string entityId);
} }
} }

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

@ -57,7 +57,7 @@ namespace Volo.CmsKit.Admin.Contents
return MapToGetOutputDto(entity); return MapToGetOutputDto(entity);
} }
public async Task<ContentDto> GetByEntityAsync( public async Task<ContentDto> GetAsync(
[NotNull] string entityType, [NotNull] string entityType,
[NotNull] string entityId) [NotNull] string entityId)
{ {

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

@ -63,9 +63,9 @@ namespace Volo.CmsKit.Admin.Contents
[HttpGet] [HttpGet]
[Route("{entityType}/{entityId}")] [Route("{entityType}/{entityId}")]
[Authorize(CmsKitAdminPermissions.Contents.Default)] [Authorize(CmsKitAdminPermissions.Contents.Default)]
public Task<ContentDto> GetByEntityAsync(string entityType, string entityId) public Task<ContentDto> GetAsync(string entityType, string entityId)
{ {
return ContentAdminAppService.GetByEntityAsync(entityType, entityId); return ContentAdminAppService.GetAsync(entityType, entityId);
} }
} }
} }

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

@ -132,7 +132,7 @@ namespace Volo.CmsKit.Contents
[Fact] [Fact]
public async Task ShouldGetByEntityAsync() public async Task ShouldGetByEntityAsync()
{ {
var entity = await _service.GetByEntityAsync(_data.Content_1_EntityType, _data.Content_1_EntityId); var entity = await _service.GetAsync(_data.Content_1_EntityType, _data.Content_1_EntityId);
entity.ShouldNotBeNull(); entity.ShouldNotBeNull();
entity.EntityId.ShouldBe(_data.Content_1_EntityId); entity.EntityId.ShouldBe(_data.Content_1_EntityId);

Loading…
Cancel
Save