From ea2227fbb1fd6c241b868f74edd7c98b4674fc8c Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 17 Feb 2021 17:45:57 +0300 Subject: [PATCH] refactoring --- .../Volo/CmsKit/Admin/Comments/CommentGetListInput.cs | 2 -- .../Volo/CmsKit/Admin/Comments/CommentAdminAppService.cs | 4 ++-- .../Volo/CmsKit/Comments/ICommentRepository.cs | 2 +- .../Volo/CmsKit/Comments/EfCoreCommentRepository.cs | 8 ++++---- .../CmsKit/MongoDB/Comments/MongoCommentRepository.cs | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Comments/CommentGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Comments/CommentGetListInput.cs index 88e8d459b1..beaf997947 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Comments/CommentGetListInput.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Comments/CommentGetListInput.cs @@ -5,8 +5,6 @@ namespace Volo.CmsKit.Admin.Comments { public class CommentGetListInput : PagedAndSortedResultRequestDto { - public string Filter { get; set; } - public string EntityType { get; set; } public string EntityId { get; set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Comments/CommentAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Comments/CommentAdminAppService.cs index 12ac3b247e..60c83a2551 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Comments/CommentAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Comments/CommentAdminAppService.cs @@ -25,7 +25,7 @@ namespace Volo.CmsKit.Admin.Comments public virtual async Task> GetListAsync(CommentGetListInput input) { var totalCount = await CommentRepository.GetCountAsync( - input.Filter, + input.Text, input.EntityType, input.EntityId, input.RepliedCommentId, @@ -34,7 +34,7 @@ namespace Volo.CmsKit.Admin.Comments input.CreationEndDate); var comments = await CommentRepository.GetListAsync( - input.Filter, + input.Text, input.EntityType, input.EntityId, input.RepliedCommentId, diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs index 7ea61d47bf..6293e125b6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentRepository.cs @@ -26,7 +26,7 @@ namespace Volo.CmsKit.Comments ); Task GetCountAsync( - string filter = null, + string text = null, string entityType = null, string entityId = null, Guid? repliedCommentId = null, diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs index 95781ae496..1e939e7740 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs @@ -72,7 +72,7 @@ namespace Volo.CmsKit.Comments } public async Task GetCountAsync( - string filter = null, + string text = null, string entityType = null, string entityId = null, Guid? repliedCommentId = null, @@ -83,7 +83,7 @@ namespace Volo.CmsKit.Comments ) { var query = await GetListQueryAsync( - filter, + text, entityType, entityId, repliedCommentId, @@ -146,8 +146,8 @@ namespace Volo.CmsKit.Comments { return (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), c => c.Text.Contains(filter)) - .WhereIf(!entityType.IsNullOrWhiteSpace(), c => c.EntityType == entityType) - .WhereIf(!entityId.IsNullOrWhiteSpace(), c => c.EntityId == entityId) + .WhereIf(!entityType.IsNullOrWhiteSpace(), c => c.EntityType.Contains(entityType)) + .WhereIf(!entityId.IsNullOrWhiteSpace(), c => c.EntityId.Contains(entityId)) .WhereIf(repliedCommentId.HasValue, c => c.RepliedCommentId == repliedCommentId) .WhereIf(creatorId.HasValue, c => c.CreatorId == creatorId) .WhereIf(creationStartDate.HasValue, c => c.CreationTime >= creationStartDate) diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs index 78d727b57c..39eb8cb223 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs @@ -72,7 +72,7 @@ namespace Volo.CmsKit.MongoDB.Comments } public async Task GetCountAsync( - string filter = null, + string text = null, string entityType = null, string entityId = null, Guid? repliedCommentId = null, @@ -83,7 +83,7 @@ namespace Volo.CmsKit.MongoDB.Comments ) { var query = await GetListQueryAsync( - filter, + text, entityType, entityId, repliedCommentId,