Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
support committed Dec 12, 2023
2 parents 2bdf223 + 4235699 commit a411e60
Show file tree
Hide file tree
Showing 167 changed files with 141 additions and 5,578 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Brands;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using MediatR;

namespace Grand.Api.Commands.Handlers.Catalog
Expand All @@ -17,26 +15,17 @@ public class AddBrandCommandHandler : IRequestHandler<AddBrandCommand, BrandDto>
private readonly IBrandService _brandService;
private readonly ISlugService _slugService;
private readonly ILanguageService _languageService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;
private readonly SeoSettings _seoSettings;

public AddBrandCommandHandler(
IBrandService brandService,
ISlugService slugService,
ILanguageService languageService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext,
SeoSettings seoSettings)
{
_brandService = brandService;
_slugService = slugService;
_languageService = languageService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
_seoSettings = seoSettings;
}

Expand All @@ -51,9 +40,6 @@ public async Task<BrandDto> Handle(AddBrandCommand request, CancellationToken ca
await _brandService.UpdateBrand(brand);
await _slugService.SaveSlug(brand, request.Model.SeName, "");

//activity log
_ = _customerActivityService.InsertActivity("AddNewBrand", brand.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.AddNewBrand"), brand.Name);

return brand.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Domain.Seo;
using Grand.Infrastructure;
Expand All @@ -17,7 +16,6 @@ public class AddCategoryCommandHandler : IRequestHandler<AddCategoryCommand, Cat
private readonly ICategoryService _categoryService;
private readonly ISlugService _slugService;
private readonly ILanguageService _languageService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;
private readonly SeoSettings _seoSettings;
Expand All @@ -26,15 +24,13 @@ public AddCategoryCommandHandler(
ICategoryService categoryService,
ISlugService slugService,
ILanguageService languageService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext,
SeoSettings seoSettings)
{
_categoryService = categoryService;
_slugService = slugService;
_languageService = languageService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
_seoSettings = seoSettings;
Expand All @@ -52,10 +48,6 @@ public async Task<CategoryDto> Handle(AddCategoryCommand request, CancellationTo
await _categoryService.UpdateCategory(category);
await _slugService.SaveSlug(category, request.Model.SeName, "");

//activity log
_ = _customerActivityService.InsertActivity("AddNewCategory", category.Id, _workContext.CurrentCustomer, "",
_translationService.GetResource("ActivityLog.AddNewCategory"), category.Name);

return category.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Collections;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Domain.Seo;
using Grand.Infrastructure;
Expand All @@ -17,7 +16,6 @@ public class AddCollectionCommandHandler : IRequestHandler<AddCollectionCommand,
private readonly ICollectionService _collectionService;
private readonly ISlugService _slugService;
private readonly ILanguageService _languageService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;
private readonly SeoSettings _seoSettings;
Expand All @@ -26,15 +24,13 @@ public AddCollectionCommandHandler(
ICollectionService collectionService,
ISlugService slugService,
ILanguageService languageService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext,
SeoSettings seoSettings)
{
_collectionService = collectionService;
_slugService = slugService;
_languageService = languageService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
_seoSettings = seoSettings;
Expand All @@ -51,11 +47,6 @@ public async Task<CollectionDto> Handle(AddCollectionCommand request, Cancellati
await _collectionService.UpdateCollection(collection);
await _slugService.SaveSlug(collection, request.Model.SeName, "");

//activity log
_ = _customerActivityService.InsertActivity("AddNewCollection", collection.Id,
_workContext.CurrentCustomer, "",
_translationService.GetResource("ActivityLog.AddNewCollection"), collection.Name);

return collection.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Grand.Api.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Infrastructure;
using MediatR;

Expand All @@ -12,32 +11,24 @@ namespace Grand.Api.Commands.Handlers.Catalog
public class AddProductAttributeCommandHandler : IRequestHandler<AddProductAttributeCommand, ProductAttributeDto>
{
private readonly IProductAttributeService _productAttributeService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;

public AddProductAttributeCommandHandler(
IProductAttributeService productAttributeService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext)
{
_productAttributeService = productAttributeService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
}

public async Task<ProductAttributeDto> Handle(AddProductAttributeCommand request, CancellationToken cancellationToken)
{
var productAttribute = request.Model.ToEntity();

await _productAttributeService.InsertProductAttribute(productAttribute);

//activity log
_ = _customerActivityService.InsertActivity("AddNewProductAttribute",
productAttribute.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.AddNewProductAttribute"), productAttribute.Name);

return productAttribute.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Common.Seo;
using Grand.Domain.Seo;
using Grand.Infrastructure;
Expand All @@ -16,7 +15,6 @@ public class AddProductCommandHandler : IRequestHandler<AddProductCommand, Produ
{
private readonly IProductService _productService;
private readonly ISlugService _slugService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly ILanguageService _languageService;
private readonly IWorkContext _workContext;
Expand All @@ -26,15 +24,13 @@ public class AddProductCommandHandler : IRequestHandler<AddProductCommand, Produ
public AddProductCommandHandler(
IProductService productService,
ISlugService slugService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
ILanguageService languageService,
IWorkContext workContext,
SeoSettings seoSettings)
{
_productService = productService;
_slugService = slugService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_languageService = languageService;
_workContext = workContext;
Expand All @@ -54,9 +50,6 @@ public async Task<ProductDto> Handle(AddProductCommand request, CancellationToke
await _slugService.SaveSlug(product, request.Model.SeName, "");
await _productService.UpdateProduct(product);

//activity log
_ = _customerActivityService.InsertActivity("AddNewProduct", product.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.AddNewProduct"), product.Name);

return product.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Grand.Api.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Infrastructure;
using MediatR;

Expand All @@ -12,18 +11,15 @@ namespace Grand.Api.Commands.Handlers.Catalog
public class AddSpecificationAttributeCommandHandler : IRequestHandler<AddSpecificationAttributeCommand, SpecificationAttributeDto>
{
private readonly ISpecificationAttributeService _specificationAttributeService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;

public AddSpecificationAttributeCommandHandler(
ISpecificationAttributeService specificationAttributeService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext)
{
_specificationAttributeService = specificationAttributeService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
}
Expand All @@ -33,9 +29,6 @@ public async Task<SpecificationAttributeDto> Handle(AddSpecificationAttributeCom
var specificationAttribute = request.Model.ToEntity();
await _specificationAttributeService.InsertSpecificationAttribute(specificationAttribute);

//activity log
_ = _customerActivityService.InsertActivity("AddNewSpecAttribute", specificationAttribute.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.AddNewSpecAttribute"), specificationAttribute.Name);

return specificationAttribute.ToModel();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Grand.Api.Commands.Models.Catalog;
using Grand.Business.Core.Interfaces.Catalog.Brands;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Infrastructure;
using MediatR;

Expand All @@ -10,18 +9,15 @@ namespace Grand.Api.Commands.Handlers.Catalog
public class DeleteBrandCommandHandler : IRequestHandler<DeleteBrandCommand, bool>
{
private readonly IBrandService _brandService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;

public DeleteBrandCommandHandler(
IBrandService brandService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext)
{
_brandService = brandService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
}
Expand All @@ -32,9 +28,6 @@ public async Task<bool> Handle(DeleteBrandCommand request, CancellationToken can
if (brand != null)
{
await _brandService.DeleteBrand(brand);

//activity log
_ = _customerActivityService.InsertActivity("DeleteBrand", brand.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.DeleteBrand"), brand.Name);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Grand.Api.Commands.Models.Catalog;
using Grand.Business.Core.Interfaces.Catalog.Categories;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Infrastructure;
using MediatR;

Expand All @@ -10,18 +9,15 @@ namespace Grand.Api.Commands.Handlers.Catalog
public class DeleteCategoryCommandHandler : IRequestHandler<DeleteCategoryCommand, bool>
{
private readonly ICategoryService _categoryService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;

public DeleteCategoryCommandHandler(
ICategoryService categoryService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext)
{
_categoryService = categoryService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
}
Expand All @@ -32,9 +28,6 @@ public async Task<bool> Handle(DeleteCategoryCommand request, CancellationToken
if (category != null)
{
await _categoryService.DeleteCategory(category);

//activity log
_ = _customerActivityService.InsertActivity("DeleteCategory", category.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.DeleteCategory"), category.Name);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Grand.Api.Commands.Models.Catalog;
using Grand.Business.Core.Interfaces.Catalog.Collections;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Infrastructure;
using MediatR;

Expand All @@ -10,18 +9,15 @@ namespace Grand.Api.Commands.Handlers.Catalog
public class DeleteCollectionCommandHandler : IRequestHandler<DeleteCollectionCommand, bool>
{
private readonly ICollectionService _collectionService;
private readonly ICustomerActivityService _customerActivityService;
private readonly ITranslationService _translationService;
private readonly IWorkContext _workContext;

public DeleteCollectionCommandHandler(
ICollectionService collectionService,
ICustomerActivityService customerActivityService,
ITranslationService translationService,
IWorkContext workContext)
{
_collectionService = collectionService;
_customerActivityService = customerActivityService;
_translationService = translationService;
_workContext = workContext;
}
Expand All @@ -32,9 +28,6 @@ public async Task<bool> Handle(DeleteCollectionCommand request, CancellationToke
if (collection != null)
{
await _collectionService.DeleteCollection(collection);

//activity log
_ = _customerActivityService.InsertActivity("DeleteCollection", collection.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.DeleteCollection"), collection.Name);
}
return true;
}
Expand Down
Loading

0 comments on commit a411e60

Please sign in to comment.