Browse Source

Refactor.

pull/4961/head
Halil İbrahim Kalkan 6 years ago
parent
commit
16285fabfa
  1. 2
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs
  2. 2
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs
  3. 12
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Comments/CommentPublicAppService.cs

2
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs

@ -8,7 +8,7 @@ namespace Volo.CmsKit.Comments
{ {
public interface ICommentRepository : IBasicRepository<Comment, Guid> public interface ICommentRepository : IBasicRepository<Comment, Guid>
{ {
Task<List<CommentWithAuthor>> GetListAsync( Task<List<CommentWithAuthor>> GetListWithAuthorsAsync(
[NotNull] string entityType, [NotNull] string entityType,
[NotNull] string entityId); [NotNull] string entityId);
} }

2
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs

@ -19,7 +19,7 @@ namespace Volo.CmsKit.Comments
{ {
} }
public async Task<List<CommentWithAuthor>> GetListAsync( public async Task<List<CommentWithAuthor>> GetListWithAuthorsAsync(
string entityType, string entityType,
string entityId) string entityId)
{ {

12
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Comments/CommentPublicAppService.cs

@ -14,16 +14,16 @@ namespace Volo.CmsKit.Comments
{ {
public class CommentPublicAppService : ApplicationService, ICommentPublicAppService public class CommentPublicAppService : ApplicationService, ICommentPublicAppService
{ {
private readonly CmsKitOptions _cmsKitOptions; protected CmsKitOptions CmsKitOptions { get; }
protected ICommentRepository CommentRepository { get; } protected ICommentRepository CommentRepository { get; }
public ICmsUserLookupService CmsUserLookupService { get; } protected ICmsUserLookupService CmsUserLookupService { get; }
public CommentPublicAppService( public CommentPublicAppService(
ICommentRepository commentRepository, ICommentRepository commentRepository,
ICmsUserLookupService cmsUserLookupService, ICmsUserLookupService cmsUserLookupService,
IOptionsSnapshot<CmsKitOptions> cmsKitOptions) IOptions<CmsKitOptions> cmsKitOptions)
{ {
_cmsKitOptions = cmsKitOptions.Value; CmsKitOptions = cmsKitOptions.Value;
CommentRepository = commentRepository; CommentRepository = commentRepository;
CmsUserLookupService = cmsUserLookupService; CmsUserLookupService = cmsUserLookupService;
} }
@ -32,7 +32,7 @@ namespace Volo.CmsKit.Comments
{ {
CheckAuthorizationAsync(entityType); CheckAuthorizationAsync(entityType);
var commentsWithAuthor = await CommentRepository.GetListAsync(entityType, entityId); var commentsWithAuthor = await CommentRepository.GetListWithAuthorsAsync(entityType, entityId);
return new ListResultDto<CommentWithDetailsDto>( return new ListResultDto<CommentWithDetailsDto>(
ConvertCommentsToNestedStructure(commentsWithAuthor) ConvertCommentsToNestedStructure(commentsWithAuthor)
@ -131,7 +131,7 @@ namespace Volo.CmsKit.Comments
private async Task<bool> IsPublicEntity(string entityType) private async Task<bool> IsPublicEntity(string entityType)
{ {
return _cmsKitOptions.PublicCommentEntities.Contains(entityType); return CmsKitOptions.PublicCommentEntities.Contains(entityType);
} }
private CmsUserDto GetAuthorAsDtoFromCommentList(List<CommentWithAuthor> comments, Guid commentId) private CmsUserDto GetAuthorAsDtoFromCommentList(List<CommentWithAuthor> comments, Guid commentId)

Loading…
Cancel
Save