Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Remove unused service ActivityKeywordsProvider

supportc74e9e1505e4
diff --git a/src/Business/Grand.Business.Common/Services/Logging/ActivityKeywordsProvider.cs b/src/Business/Grand.Business.Common/Services/Logging/ActivityKeywordsProvider.cs
deleted file mode 100644
index bb7c9e0b1..000000000
--- a/src/Business/Grand.Business.Common/Services/Logging/ActivityKeywordsProvider.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using Grand.Business.Core.Interfaces.Common.Logging;
-
-namespace Grand.Business.Common.Services.Logging
-{
- public class ActivityKeywordsProvider: IActivityKeywordsProvider
- {
- public virtual IList<string> GetCategorySystemKeywords()
- {
- var tokens = new List<string>
- {
- "PublicStore.ViewCategory",
- "EditCategory",
- "AddNewCategory",
- };
- return tokens;
- }
- public virtual IList<string> GetProductSystemKeywords()
- {
- var tokens = new List<string>
- {
- "PublicStore.ViewProduct",
- "EditProduct",
- "AddNewProduct",
- };
- return tokens;
- }
- public virtual IList<string> GetBrandSystemKeywords()
- {
- var tokens = new List<string>
- {
- "PublicStore.ViewBrand",
- "EditBrand",
- "AddNewBrand"
- };
- return tokens;
- }
-
- public virtual IList<string> GetCollectionSystemKeywords()
- {
- var tokens = new List<string>
- {
- "PublicStore.ViewCollection",
- "EditCollection",
- "AddNewCollection"
- };
- return tokens;
- }
-
- public IList<string> GetKnowledgebaseCategorySystemKeywords()
- {
- var tokens = new List<string>
- {
- "CreateKnowledgebaseCategory",
- "UpdateKnowledgebaseCategory",
- "DeleteKnowledgebaseCategory"
- };
- return tokens;
- }
-
-
- public IList<string> GetKnowledgebaseArticleSystemKeywords()
- {
- var tokens = new List<string>
- {
- "CreateKnowledgebaseArticle",
- "UpdateKnowledgebaseArticle",
- "DeleteKnowledgebaseArticle",
- };
- return tokens;
- }
- }
-}
diff --git a/src/Business/Grand.Business.Common/Services/Logging/CustomerActivityService.cs b/src/Business/Grand.Business.Common/Services/Logging/CustomerActivityService.cs
index 32786afe3..59663d9c4 100644
--- a/src/Business/Grand.Business.Common/Services/Logging/CustomerActivityService.cs
+++ b/src/Business/Grand.Business.Common/Services/Logging/CustomerActivityService.cs
@@ -22,7 +22,6 @@ namespace Grand.Business.Common.Services.Logging
private readonly ICacheBase _cacheBase;
private readonly IRepository<ActivityLog> _activityLogRepository;
private readonly IRepository<ActivityLogType> _activityLogTypeRepository;
- private readonly IActivityKeywordsProvider _activityKeywordsProvider;
#endregion
@@ -34,13 +33,11 @@ namespace Grand.Business.Common.Services.Logging
public CustomerActivityService(
ICacheBase cacheBase,
IRepository<ActivityLog> activityLogRepository,
- IRepository<ActivityLogType> activityLogTypeRepository,
- IActivityKeywordsProvider activityKeywordsProvider)
+ IRepository<ActivityLogType> activityLogTypeRepository)
{
_cacheBase = cacheBase;
_activityLogRepository = activityLogRepository;
_activityLogTypeRepository = activityLogTypeRepository;
- _activityKeywordsProvider = activityKeywordsProvider;
}
#endregion
@@ -122,7 +119,7 @@ namespace Grand.Business.Common.Services.Logging
/// </summary>
/// <returns>Activity log type items</returns>
public virtual async Task<IList<ActivityLogType>> GetAllActivityTypes()
- {
+ {
return await Task.FromResult(ActivityLogTypes().ToList());
}
@@ -282,7 +279,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetCategorySystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetCategorySystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -312,7 +309,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetKnowledgebaseCategorySystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetKnowledgebaseCategorySystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -342,7 +339,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetKnowledgebaseArticleSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetKnowledgebaseArticleSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -371,7 +368,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetBrandSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetBrandSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -401,7 +398,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetCollectionSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetCollectionSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -431,7 +428,7 @@ namespace Grand.Business.Common.Services.Logging
query = query.Where(al => createdOnTo.Value >= al.CreatedOnUtc);
var activityTypes = await GetAllActivityTypesCached();
- var activityTypeIds = activityTypes.ToList().Where(at => _activityKeywordsProvider.GetProductSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
+ var activityTypeIds = activityTypes.ToList().Where(at => GetProductSystemKeywords().Contains(at.SystemKeyword)).Select(x => x.Id);
query = query.Where(al => activityTypeIds.Contains(al.ActivityLogTypeId));
@@ -459,5 +456,74 @@ namespace Grand.Business.Common.Services.Logging
}
#endregion
+
+ #region Private methods
+
+ private IList<string> GetCategorySystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "PublicStore.ViewCategory",
+ "EditCategory",
+ "AddNewCategory",
+ };
+ return tokens;
+ }
+ private IList<string> GetProductSystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "PublicStore.ViewProduct",
+ "EditProduct",
+ "AddNewProduct",
+ };
+ return tokens;
+ }
+ private IList<string> GetBrandSystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "PublicStore.ViewBrand",
+ "EditBrand",
+ "AddNewBrand"
+ };
+ return tokens;
+ }
+
+ private IList<string> GetCollectionSystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "PublicStore.ViewCollection",
+ "EditCollection",
+ "AddNewCollection"
+ };
+ return tokens;
+ }
+
+ private IList<string> GetKnowledgebaseCategorySystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "CreateKnowledgebaseCategory",
+ "UpdateKnowledgebaseCategory",
+ "DeleteKnowledgebaseCategory"
+ };
+ return tokens;
+ }
+
+
+ private IList<string> GetKnowledgebaseArticleSystemKeywords()
+ {
+ var tokens = new List<string>
+ {
+ "CreateKnowledgebaseArticle",
+ "UpdateKnowledgebaseArticle",
+ "DeleteKnowledgebaseArticle",
+ };
+ return tokens;
+ }
+
+ #endregion
}
}
diff --git a/src/Business/Grand.Business.Common/Startup/StartupApplication.cs b/src/Business/Grand.Business.Common/Startup/StartupApplication.cs
index 91319f3f7..5b7e796c0 100644
--- a/src/Business/Grand.Business.Common/Startup/StartupApplication.cs
+++ b/src/Business/Grand.Business.Common/Startup/StartupApplication.cs
@@ -1,4 +1,13 @@
-using Grand.Business.Core.Interfaces.Common.Addresses;
+using Grand.Business.Common.Services.Addresses;
+using Grand.Business.Common.Services.Configuration;
+using Grand.Business.Common.Services.Directory;
+using Grand.Business.Common.Services.Localization;
+using Grand.Business.Common.Services.Logging;
+using Grand.Business.Common.Services.Pdf;
+using Grand.Business.Common.Services.Security;
+using Grand.Business.Common.Services.Seo;
+using Grand.Business.Common.Services.Stores;
+using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Configuration;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
@@ -7,20 +16,11 @@ using Grand.Business.Core.Interfaces.Common.Pdf;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Business.Core.Interfaces.Common.Stores;
-using Grand.Business.Common.Services.Addresses;
-using Grand.Business.Common.Services.Configuration;
-using Grand.Business.Common.Services.Directory;
-using Grand.Business.Common.Services.Localization;
-using Grand.Business.Common.Services.Logging;
-using Grand.Business.Common.Services.Pdf;
-using Grand.Business.Common.Services.Seo;
-using Grand.Business.Common.Services.Stores;
using Grand.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Grand.Business.Common.Services.Security;
namespace Grand.Business.Common.Startup
{
@@ -74,7 +74,6 @@ namespace Grand.Business.Common.Startup
private void RegisterLoggingService(IServiceCollection serviceCollection)
{
serviceCollection.AddScoped<ICustomerActivityService, CustomerActivityService>();
- serviceCollection.AddScoped<IActivityKeywordsProvider, ActivityKeywordsProvider>();
serviceCollection.AddScoped<ILogger, DefaultLogger>();
}
diff --git a/src/Business/Grand.Business.Core/Interfaces/Common/Logging/IActivityKeywordsProvider.cs b/src/Business/Grand.Business.Core/Interfaces/Common/Logging/IActivityKeywordsProvider.cs
deleted file mode 100644
index 245d60aab..000000000
--- a/src/Business/Grand.Business.Core/Interfaces/Common/Logging/IActivityKeywordsProvider.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Grand.Business.Core.Interfaces.Common.Logging
-{
- public partial interface IActivityKeywordsProvider
- {
- IList<string> GetCategorySystemKeywords();
- IList<string> GetProductSystemKeywords();
- IList<string> GetBrandSystemKeywords();
- IList<string> GetCollectionSystemKeywords();
- IList<string> GetKnowledgebaseCategorySystemKeywords();
- IList<string> GetKnowledgebaseArticleSystemKeywords();
- }
-}