Browse Source

Completed ProductStore feature, close #2

Completed store management
pull/49/head
gdlcf88 6 years ago
parent
commit
581cf17827
  1. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductCategories/Dtos/CreateUpdateProductCategoryDto.cs
  2. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductCategories/Dtos/ProductCategoryDto.cs
  3. 9
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs
  4. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
  5. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs
  6. 74
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
  7. 13
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs
  8. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
  9. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
  10. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
  11. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
  12. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
  13. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
  14. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
  15. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
  16. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
  17. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
  18. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductCategories/IProductCategoryRepository.cs
  19. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductCategories/ProductCategory.cs
  20. 12
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs
  21. 33
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/ProductStore.cs
  22. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs
  23. 12
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
  24. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/EShopProductsEntityFrameworkCoreModule.cs
  25. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/IProductsDbContext.cs
  26. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContext.cs
  27. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs
  28. 10
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductCategories/ProductCategoryRepository.cs
  29. 32
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs
  30. 17
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs
  31. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj
  32. 15
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs
  33. 13
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs
  34. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml
  35. 22
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs
  36. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs
  37. 11
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js
  38. 9
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsMenuContributor.cs
  39. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs
  40. 23
      modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.Domain.Tests/ProductStores/ProductStoreDomainTests.cs
  41. 31
      modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductStores/ProductStoreRepositoryTests.cs
  42. 0
      modules/EasyAbp.EShop.Stores/host/EasyAbp.EShop.Stores.Web.Unified/EasyAbp.EShop.Stores.Web.Unified.csproj
  43. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj
  44. 7
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissionDefinitionProvider.cs
  45. 8
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissions.cs
  46. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs
  47. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs
  48. 10
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs
  49. 19
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/IStoreAppService.cs
  50. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj
  51. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/EShopStoresApplicationModule.cs
  52. 26
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs
  53. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresAppService.cs
  54. 8
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs
  55. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj
  56. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/EShopStoresDomainSharedModule.cs
  57. 12
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/cs.json
  58. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json
  59. 12
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pl.json
  60. 12
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pt-BR.json
  61. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/sl.json
  62. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/tr.json
  63. 12
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/vi.json
  64. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/zh-Hans.json
  65. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/zh-Hant.json
  66. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/StoresResource.cs
  67. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Stores/IMultiStore.cs
  68. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs
  69. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/cs.json
  70. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/en.json
  71. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/pl.json
  72. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/pt-BR.json
  73. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/sl.json
  74. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/tr.json
  75. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/vi.json
  76. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/zh-Hans.json
  77. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/zh-Hant.json
  78. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj
  79. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/EShopStoresDomainModule.cs
  80. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettingDefinitionProvider.cs
  81. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettings.cs
  82. 12
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreRepository.cs
  83. 26
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/Store.cs
  84. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoresDbProperties.cs
  85. 11
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/Stores/Store.cs
  86. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj
  87. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs
  88. 7
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs
  89. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs
  90. 13
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs
  91. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresModelBuilderConfigurationOptions.cs
  92. 22
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/Stores/StoreRepository.cs
  93. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj
  94. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp/EShop/Stores/EShopStoresHttpApiClientModule.cs
  95. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj
  96. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/EShopStoresHttpApiModule.cs
  97. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoresController.cs
  98. 6
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj
  99. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp/EShop/Stores/MongoDB/EShopStoresMongoDbModule.cs
  100. 0
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp/EShop/Stores/MongoDB/IStoresMongoDbContext.cs

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductCategories/Dtos/CreateUpdateProductCategoryDto.cs

@ -6,9 +6,6 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos
{
public class CreateUpdateProductCategoryDto
{
[DisplayName("ProductCategoryStoreId")]
public Guid StoreId { get; set; }
[Required]
[DisplayName("ProductCategoryCategoryId")]
public Guid CategoryId { get; set; }

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductCategories/Dtos/ProductCategoryDto.cs

@ -5,8 +5,6 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos
{
public class ProductCategoryDto : AuditedEntityDto<Guid>
{
public Guid StoreId { get; set; }
public Guid CategoryId { get; set; }
public Guid ProductId { get; set; }

9
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductDto.cs

@ -8,12 +8,15 @@ namespace EasyAbp.EShop.Products.Products.Dtos
{
public class CreateUpdateProductDto : IValidatableObject
{
[DisplayName("ProductStoreId")]
public Guid StoreId { get; set; }
[Required]
[DisplayName("ProductProductTypeId")]
public Guid ProductTypeId { get; set; }
/// <summary>
/// This property is set for adding the store to ProductStore in creation, or for permission checking in update.
/// </summary>
[DisplayName("ProductStoreId")]
public Guid StoreId { get; set; }
[DisplayName("ProductCategory")]
public ICollection<Guid> CategoryIds { get; set; }

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs

@ -6,10 +6,10 @@ namespace EasyAbp.EShop.Products.Products.Dtos
{
public class ProductDto : FullAuditedEntityDto<Guid>
{
public Guid StoreId { get; set; }
public Guid ProductTypeId { get; set; }
public ICollection<Guid> CategoryIds { get; set; }
public string DisplayName { get; set; }
public InventoryStrategy InventoryStrategy { get; set; }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs

@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Products.Products.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
@ -13,6 +14,6 @@ namespace EasyAbp.EShop.Products.Products
CreateUpdateProductDto,
CreateUpdateProductDto>
{
Task DeleteAsync(Guid id, Guid storeId);
}
}

74
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs

@ -5,9 +5,9 @@ using System.Threading.Tasks;
using EasyAbp.EShop.Products.Authorization;
using EasyAbp.EShop.Products.ProductCategories;
using EasyAbp.EShop.Products.Products.Dtos;
using Volo.Abp.Application.Dtos;
using EasyAbp.EShop.Products.ProductStores;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Threading;
namespace EasyAbp.EShop.Products.Products
{
@ -20,33 +20,25 @@ namespace EasyAbp.EShop.Products.Products
protected override string GetPolicyName { get; set; } = ProductsPermissions.Products.Default;
protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default;
private readonly IProductStoreRepository _productStoreRepository;
private readonly IProductCategoryRepository _productCategoryRepository;
private readonly IProductRepository _repository;
public ProductAppService(
IProductStoreRepository productStoreRepository,
IProductCategoryRepository productCategoryRepository,
IProductRepository repository) : base(repository)
{
_productStoreRepository = productStoreRepository;
_productCategoryRepository = productCategoryRepository;
_repository = repository;
}
protected override IQueryable<Product> CreateFilteredQuery(GetProductListDto input)
{
var query = base.CreateFilteredQuery(input);
if (input.CategoryId.HasValue)
{
var productIds = AsyncHelper
.RunSync(() => _productCategoryRepository.GetListByCategoryId(input.CategoryId.Value, input.StoreId))
.Select(pc => pc.ProductId).ToList();
query = query.Where(p => productIds.Contains(p.Id));
}
query = query.Where(p => p.StoreId == input.StoreId);
return query;
return input.CategoryId.HasValue
? _repository.GetQueryable(input.StoreId, input.CategoryId.Value)
: _repository.GetQueryable(input.StoreId);
}
public override async Task<ProductDto> CreateAsync(CreateUpdateProductDto input)
@ -60,16 +52,26 @@ namespace EasyAbp.EShop.Products.Products
await UpdateProductAttributesAsync(product, input);
await Repository.InsertAsync(product, autoSave: true);
await AddProductToStoreAsync(product.Id, input.StoreId);
await UpdateProductCategoriesAsync(product.Id, product.StoreId, input.CategoryIds);
await UpdateProductCategoriesAsync(product.Id, input.CategoryIds);
return MapToGetOutputDto(product);
}
protected virtual async Task AddProductToStoreAsync(Guid productId, Guid storeId)
{
await _productStoreRepository.InsertAsync(new ProductStore(GuidGenerator.Create(), CurrentTenant.Id,
storeId, productId, true), true);
}
public override async Task<ProductDto> UpdateAsync(Guid id, CreateUpdateProductDto input)
{
await CheckUpdatePolicyAsync();
await CheckStoreIsProductOwnerAsync(id, input.StoreId);
var product = await GetEntityByIdAsync(id);
MapToEntity(input, product);
@ -78,12 +80,22 @@ namespace EasyAbp.EShop.Products.Products
await Repository.UpdateAsync(product, autoSave: true);
await UpdateProductCategoriesAsync(product.Id, product.StoreId, input.CategoryIds);
await UpdateProductCategoriesAsync(product.Id, input.CategoryIds);
return MapToGetOutputDto(product);
}
private async Task UpdateProductAttributesAsync(Product product, CreateUpdateProductDto input)
protected virtual async Task CheckStoreIsProductOwnerAsync(Guid id, Guid storeId)
{
var productStore = await _productStoreRepository.GetAsync(id, storeId);
if (!productStore.IsOwner)
{
throw new StoreIsNotProductOwnerException(id, storeId);
}
}
protected virtual async Task UpdateProductAttributesAsync(Product product, CreateUpdateProductDto input)
{
foreach (var attributeDto in input.ProductAttributes)
{
@ -122,21 +134,39 @@ namespace EasyAbp.EShop.Products.Products
product.ProductAttributes.RemoveAll(a => exceptAttributeNames.Contains(a.DisplayName));
}
[RemoteService(IsMetadataEnabled = false)]
public override async Task DeleteAsync(Guid id)
{
throw new NotImplementedException();
}
public override async Task<ProductDto> GetAsync(Guid id)
{
var dto = await base.GetAsync(id);
dto.CategoryIds = (await _productCategoryRepository.GetListByProductIdAsync(dto.Id))
.Select(x => x.CategoryId).ToList();
return dto;
}
public async Task DeleteAsync(Guid id, Guid storeId)
{
await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(id));
await CheckStoreIsProductOwnerAsync(id, storeId);
await base.DeleteAsync(id);
}
protected virtual async Task UpdateProductCategoriesAsync(Guid productId, Guid storeId, IEnumerable<Guid> categoryIds)
protected virtual async Task UpdateProductCategoriesAsync(Guid productId, IEnumerable<Guid> categoryIds)
{
await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(productId));
foreach (var categoryId in categoryIds)
{
await _productCategoryRepository.InsertAsync(new ProductCategory(GuidGenerator.Create(),
CurrentTenant.Id, storeId, categoryId, productId));
await _productCategoryRepository.InsertAsync(
new ProductCategory(GuidGenerator.Create(), CurrentTenant.Id, categoryId, productId), true);
}
}
}

13
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs

@ -0,0 +1,13 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Products.Products
{
public class StoreIsNotProductOwnerException : BusinessException
{
public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base(
message: $"Store {storeId} is not a owner of the product {productId}")
{
}
}
}

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs

@ -18,12 +18,14 @@ namespace EasyAbp.EShop.Products
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<Product, ProductDto>();
CreateMap<Product, ProductDto>()
.Ignore(dto => dto.CategoryIds);
CreateMap<ProductDetail, ProductDetailDto>();
CreateMap<ProductAttribute, ProductAttributeDto>();
CreateMap<ProductAttributeOption, ProductAttributeOptionDto>();
CreateMap<ProductSku, ProductSkuDto>();
CreateMap<CreateUpdateProductDto, Product>(MemberList.Source)
.ForSourceMember(dto => dto.StoreId, opt => opt.DoNotValidate())
.ForSourceMember(dto => dto.CategoryIds, opt => opt.DoNotValidate())
.Ignore(p => p.ProductAttributes)
.Ignore(p => p.ProductSkus);

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json

@ -4,6 +4,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -46,7 +48,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json

@ -5,6 +5,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -47,7 +49,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json

@ -4,6 +4,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -46,7 +48,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json

@ -4,6 +4,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -46,7 +48,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json

@ -5,6 +5,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -47,7 +49,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json

@ -5,6 +5,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -47,7 +49,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json

@ -4,6 +4,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -46,7 +48,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json

@ -5,6 +5,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -47,7 +49,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json

@ -5,6 +5,8 @@
"Menu:Product": "MenuProduct",
"Product": "Product",
"ProductStore": "ProductStore",
"ProductProductTypeId": "ProductProductTypeId",
"ProductProductStoreId": "ProductProductStoreId",
"ProductDisplayName": "ProductDisplayName",
"ProductDetailDescription": "ProductDetailDescription",
"ProductDetailDisplayOrder": "ProductDetailDisplayOrder",
@ -47,7 +49,6 @@
"Menu:ProductCategory": "MenuProductCategory",
"ProductCategory": "ProductCategory",
"ProductCategoryTenantId": "ProductCategoryTenantId",
"ProductCategoryStoreId": "ProductCategoryStoreId",
"ProductCategoryCategoryId": "ProductCategoryCategoryId",
"ProductCategoryProductId": "ProductCategoryProductId",
"ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder",

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductCategories/IProductCategoryRepository.cs

@ -8,8 +8,8 @@ namespace EasyAbp.EShop.Products.ProductCategories
{
public interface IProductCategoryRepository : IRepository<ProductCategory, Guid>
{
Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid storeId, CancellationToken cancellationToken = default);
Task<List<ProductCategory>> GetListByCategoryIdAsync(Guid categoryId, CancellationToken cancellationToken = default);
Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid storeId, CancellationToken cancellationToken = default);
Task<List<ProductCategory>> GetListByProductIdAsync(Guid productId, CancellationToken cancellationToken = default);
}
}

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductCategories/ProductCategory.cs

@ -5,12 +5,10 @@ using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Products.ProductCategories
{
public class ProductCategory : AuditedAggregateRoot<Guid>, IMultiTenant, IMultiStore
public class ProductCategory : AuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid StoreId { get; protected set; }
public virtual Guid CategoryId { get; protected set; }
public virtual Guid ProductId { get; protected set; }
@ -24,14 +22,12 @@ namespace EasyAbp.EShop.Products.ProductCategories
public ProductCategory(
Guid id,
Guid? tenantId,
Guid storeId,
Guid categoryId,
Guid productId,
int displayOrder = 0
) :base(id)
{
TenantId = tenantId;
StoreId = storeId;
CategoryId = categoryId;
ProductId = productId;
DisplayOrder = displayOrder;

12
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs

@ -0,0 +1,12 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Products.ProductStores
{
public interface IProductStoreRepository : IRepository<ProductStore, Guid>
{
Task<ProductStore> GetAsync(Guid productId, Guid storeId, CancellationToken cancellationToken = default);
}
}

33
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/ProductStore.cs

@ -0,0 +1,33 @@
using System;
using EasyAbp.EShop.Stores.Stores;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Products.ProductStores
{
public class ProductStore : FullAuditedAggregateRoot<Guid>, IMultiTenant, IMultiStore
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid StoreId { get; protected set; }
public virtual Guid ProductId { get; protected set; }
public virtual bool IsOwner { get; protected set; }
protected ProductStore() {}
public ProductStore(
Guid id,
Guid? tenantId,
Guid storeId,
Guid productId,
bool isOwner) : base(id)
{
TenantId = tenantId;
StoreId = storeId;
ProductId = productId;
IsOwner = isOwner;
}
}
}

5
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs

@ -1,9 +1,14 @@
using System;
using System.Linq;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Products.Products
{
public interface IProductRepository : IRepository<Product, Guid>
{
IQueryable<Product> GetQueryable(Guid storeId, Guid categoryId);
IQueryable<Product> GetQueryable(Guid storeId);
}
}

12
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs

@ -1,18 +1,12 @@
using System;
using System.Collections.Generic;
using EasyAbp.EShop.Stores.Stores;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Products.Products
{
public class Product : FullAuditedAggregateRoot<Guid>, IMultiTenant, IMultiStore
public class Product : FullAuditedAggregateRoot<Guid>
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid StoreId { get; protected set; }
public virtual Guid ProductTypeId { get; protected set; }
[NotNull]
@ -41,8 +35,6 @@ namespace EasyAbp.EShop.Products.Products
public Product(
Guid id,
Guid? tenantId,
Guid storeId,
Guid productTypeId,
string displayName,
InventoryStrategy inventoryStrategy,
@ -51,8 +43,6 @@ namespace EasyAbp.EShop.Products.Products
int displayOrder
) :base(id)
{
TenantId = tenantId;
StoreId = storeId;
ProductTypeId = productTypeId;
DisplayName = displayName;
InventoryStrategy = inventoryStrategy;

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/EShopProductsEntityFrameworkCoreModule.cs

@ -1,3 +1,4 @@
using EasyAbp.EShop.Products.ProductStores;
using EasyAbp.EShop.Products.ProductCategories;
using EasyAbp.EShop.Products.ProductTypes;
using EasyAbp.EShop.Products.Categories;
@ -25,6 +26,7 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
options.AddRepository<Category, CategoryRepository>();
options.AddRepository<ProductType, ProductTypeRepository>();
options.AddRepository<ProductCategory, ProductCategoryRepository>();
options.AddRepository<ProductStore, ProductStoreRepository>();
});
}
}

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/IProductsDbContext.cs

@ -5,6 +5,7 @@ using EasyAbp.EShop.Products.Products;
using EasyAbp.EShop.Products.Categories;
using EasyAbp.EShop.Products.ProductTypes;
using EasyAbp.EShop.Products.ProductCategories;
using EasyAbp.EShop.Products.ProductStores;
namespace EasyAbp.EShop.Products.EntityFrameworkCore
{
@ -22,5 +23,6 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
DbSet<Category> Categories { get; set; }
DbSet<ProductType> ProductTypes { get; set; }
DbSet<ProductCategory> ProductCategories { get; set; }
DbSet<ProductStore> ProductStores { get; set; }
}
}

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContext.cs

@ -5,6 +5,7 @@ using EasyAbp.EShop.Products.Products;
using EasyAbp.EShop.Products.Categories;
using EasyAbp.EShop.Products.ProductTypes;
using EasyAbp.EShop.Products.ProductCategories;
using EasyAbp.EShop.Products.ProductStores;
namespace EasyAbp.EShop.Products.EntityFrameworkCore
{
@ -22,6 +23,7 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
public DbSet<Category> Categories { get; set; }
public DbSet<ProductType> ProductTypes { get; set; }
public DbSet<ProductCategory> ProductCategories { get; set; }
public DbSet<ProductStore> ProductStores { get; set; }
public ProductsDbContext(DbContextOptions<ProductsDbContext> options)
: base(options)

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs

@ -1,3 +1,4 @@
using EasyAbp.EShop.Products.ProductStores;
using EasyAbp.EShop.Products.ProductCategories;
using EasyAbp.EShop.Products.ProductTypes;
using EasyAbp.EShop.Products.Categories;
@ -102,6 +103,13 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
b.ConfigureByConvention();
/* Configure more properties here */
});
builder.Entity<ProductStore>(b =>
{
b.ToTable(options.TablePrefix + "ProductStores", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
});
}
}
}

10
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductCategories/ProductCategoryRepository.cs

@ -16,18 +16,16 @@ namespace EasyAbp.EShop.Products.ProductCategories
{
}
public virtual async Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid storeId,
public virtual async Task<List<ProductCategory>> GetListByCategoryIdAsync(Guid categoryId,
CancellationToken cancellationToken = default)
{
return await GetQueryable().Where(pc => pc.CategoryId == categoryId && pc.StoreId == storeId)
.ToListAsync(cancellationToken);
return await GetQueryable().Where(pc => pc.CategoryId == categoryId).ToListAsync(cancellationToken);
}
public virtual async Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid storeId,
public virtual async Task<List<ProductCategory>> GetListByProductIdAsync(Guid productId,
CancellationToken cancellationToken = default)
{
return await GetQueryable().Where(pc => pc.ProductId == productId && pc.StoreId == storeId)
.ToListAsync(cancellationToken);
return await GetQueryable().Where(pc => pc.ProductId == productId).ToListAsync(cancellationToken);
}
}
}

32
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs

@ -0,0 +1,32 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using EasyAbp.EShop.Products.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Products.ProductStores
{
public class ProductStoreRepository : EfCoreRepository<ProductsDbContext, ProductStore, Guid>, IProductStoreRepository
{
public ProductStoreRepository(IDbContextProvider<ProductsDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual async Task<ProductStore> GetAsync(Guid productId, Guid storeId, CancellationToken cancellationToken = default)
{
var entity = await GetQueryable().Where(x => x.ProductId == productId && x.StoreId == storeId)
.FirstOrDefaultAsync(cancellationToken);
if (entity == null)
{
throw new EntityNotFoundException(typeof(ProductStore), new {ProductId = productId, StoreId = storeId});
}
return entity;
}
}
}

17
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs

@ -20,5 +20,22 @@ namespace EasyAbp.EShop.Products.Products
.Include(x => x.ProductAttributes).ThenInclude(x => x.ProductAttributeOptions)
.Include(x => x.ProductSkus);
}
public IQueryable<Product> GetQueryable(Guid storeId, Guid categoryId)
{
return from product in DbContext.Products
join productStore in DbContext.ProductStores on product.Id equals productStore.ProductId
join productCategory in DbContext.ProductCategories on product.Id equals productCategory.ProductId
where productStore.StoreId == storeId && productCategory.CategoryId == categoryId
select product;
}
public IQueryable<Product> GetQueryable(Guid storeId)
{
return from product in DbContext.Products
join productStore in DbContext.ProductStores on product.Id equals productStore.ProductId
where productStore.StoreId == storeId
select product;
}
}
}

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj

@ -16,6 +16,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Application.Contracts\EasyAbp.EShop.Stores.Application.Contracts.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Products.HttpApi\EasyAbp.EShop.Products.HttpApi.csproj" />
</ItemGroup>

15
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs

@ -17,7 +17,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
public class CreateModalModel : ProductsPageModel
{
[BindProperty]
public CreateUpdateProductViewModel Product { get; set; }
public CreateEditProductViewModel Product { get; set; }
public ICollection<SelectListItem> ProductTypes { get; set; }
@ -37,7 +37,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
_service = service;
}
public async Task OnGetAsync(Guid storeId)
public virtual async Task OnGetAsync(Guid storeId, Guid? categoryId)
{
ProductTypes =
(await _productTypeAppService.GetListAsync(new PagedAndSortedResultRequestDto
@ -49,15 +49,20 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
{MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount}))?.Items
.Select(dto => new SelectListItem(dto.DisplayName, dto.Id.ToString())).ToList();
Product = new CreateUpdateProductViewModel
Product = new CreateEditProductViewModel
{
StoreId = storeId
};
if (categoryId.HasValue)
{
Product.CategoryIds = new List<Guid>(new[] {categoryId.Value});
}
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
await _service.CreateAsync(ObjectMapper.Map<CreateUpdateProductViewModel, CreateUpdateProductDto>(Product));
await _service.CreateAsync(ObjectMapper.Map<CreateEditProductViewModel, CreateUpdateProductDto>(Product));
return NoContent();
}
}

13
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs

@ -20,7 +20,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
public Guid Id { get; set; }
[BindProperty]
public CreateUpdateProductViewModel Product { get; set; }
public CreateEditProductViewModel Product { get; set; }
public ICollection<SelectListItem> ProductTypes { get; set; }
@ -40,7 +40,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
_service = service;
}
public async Task OnGetAsync()
public virtual async Task OnGetAsync(Guid storeId)
{
ProductTypes =
(await _productTypeAppService.GetListAsync(new PagedAndSortedResultRequestDto
@ -53,13 +53,16 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
.Select(dto => new SelectListItem(dto.DisplayName, dto.Id.ToString())).ToList();
var productDto = await _service.GetAsync(Id);
Product = ObjectMapper.Map<ProductDto, CreateUpdateProductViewModel>(productDto);
Product = ObjectMapper.Map<ProductDto, CreateEditProductViewModel>(productDto);
Product.StoreId = storeId;
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
await _service.UpdateAsync(Id,
ObjectMapper.Map<CreateUpdateProductViewModel, CreateUpdateProductDto>(Product));
ObjectMapper.Map<CreateEditProductViewModel, CreateUpdateProductDto>(Product));
return NoContent();
}
}

7
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml

@ -18,12 +18,16 @@
{
<abp-style src="/Pages/EShop/Products/Products/Product/index.css"/>
}
<script>
let storeId = '@Model.StoreId';
let categoryId = '@Model.CategoryId';
</script>
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["Product"]</abp-card-title>
<abp-card-title>@L["Product"] - @Model.StoreName</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-right">
<abp-button id="NewProductButton"
@ -38,7 +42,6 @@
<thead>
<tr>
<th>@L["Actions"]</th>
<th>@L["ProductStoreId"]</th>
<th>@L["ProductProductTypeId"]</th>
<th>@L["ProductDisplayName"]</th>
<th>@L["ProductInventoryStrategy"]</th>

22
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs

@ -1,12 +1,30 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Stores.Stores;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
{
public class IndexModel : ProductsPageModel
{
public async Task OnGetAsync()
private readonly IStoreAppService _storeAppService;
[BindProperty(SupportsGet = true)]
public Guid StoreId { get; set; }
[BindProperty(SupportsGet = true)]
public Guid? CategoryId { get; set; }
public string StoreName { get; set; }
public IndexModel(IStoreAppService storeAppService)
{
_storeAppService = storeAppService;
}
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
StoreName = (await _storeAppService.GetAsync(StoreId)).Name;
}
}
}

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateUpdateProductViewModel.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs

@ -9,7 +9,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewModels
{
public class CreateUpdateProductViewModel
public class CreateEditProductViewModel
{
[HiddenInput]
[Display(Name = "ProductStore")]

11
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js

@ -14,7 +14,9 @@ $(function () {
autoWidth: false,
scrollCollapse: true,
order: [[1, "asc"]],
ajax: abp.libs.datatables.createAjax(service.getList),
ajax: abp.libs.datatables.createAjax(service.getList, function () {
return { storeId: storeId, categoryId: categoryId }
}),
columnDefs: [
{
rowAction: {
@ -23,7 +25,7 @@ $(function () {
{
text: l('Edit'),
action: function (data) {
editModal.open({ id: data.record.id });
editModal.open({ id: data.record.id, storeId: storeId });
}
},
{
@ -32,7 +34,7 @@ $(function () {
return l('ProductDeletionConfirmationMessage', data.record.id);
},
action: function (data) {
service.delete(data.record.id)
service.delete({ id: data.record.id, storeId: storeId })
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
@ -42,7 +44,6 @@ $(function () {
]
}
},
{ data: "storeId" },
{ data: "productTypeId" },
{ data: "displayName" },
{ data: "inventoryStrategy" },
@ -61,6 +62,6 @@ $(function () {
$('#NewProductButton').click(function (e) {
e.preventDefault();
createModal.open();
createModal.open({ storeId: storeId, categoryId: categoryId });
});
});

9
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsMenuContributor.cs

@ -10,6 +10,7 @@ using EasyAbp.EShop.Products.Localization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using EasyAbp.EShop.Products.Localization;
using EasyAbp.EShop.Stores.Stores;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.UI.Navigation;
@ -17,7 +18,7 @@ namespace EasyAbp.EShop.Products.Web
{
public class ProductsMenuContributor : IMenuContributor
{
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
public virtual async Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name == StandardMenus.Main)
{
@ -49,8 +50,12 @@ namespace EasyAbp.EShop.Products.Web
if (await authorizationService.IsGrantedAsync(ProductsPermissions.Products.Default))
{
var storeAppService = context.ServiceProvider.GetRequiredService<IStoreAppService>();
var defaultStore = (await storeAppService.GetDefaultAsync())?.Id;
productManagementMenuItem.AddItem(
new ApplicationMenuItem("Product", l["Menu:Product"], "/EShop/Products/Products/Product")
new ApplicationMenuItem("Product", l["Menu:Product"], "/EShop/Products/Products/Product?storeId=" + defaultStore)
);
}

5
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs

@ -17,7 +17,8 @@ namespace EasyAbp.EShop.Products.Web
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<ProductDto, CreateUpdateProductViewModel>()
CreateMap<ProductDto, CreateEditProductViewModel>()
.Ignore(dto => dto.StoreId)
// .Ignore(x => x.ProductAttributes);
.ForMember(dest => dest.ProductAttributeNames,
opt => opt.MapFrom(source =>
@ -27,7 +28,7 @@ namespace EasyAbp.EShop.Products.Web
x.ProductAttributes
.Select(a => a.ProductAttributeOptions.Select(o => o.DisplayName).JoinAsString(","))
.JoinAsString(Environment.NewLine)));
CreateMap<CreateUpdateProductViewModel, CreateUpdateProductDto>()
CreateMap<CreateEditProductViewModel, CreateUpdateProductDto>()
.ForMember(dest => dest.ProductAttributes,
opt => opt.MapFrom(x =>
x.ProductAttributeNames.Split(",", StringSplitOptions.RemoveEmptyEntries).Select((s, i) =>

23
modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.Domain.Tests/ProductStores/ProductStoreDomainTests.cs

@ -0,0 +1,23 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace EasyAbp.EShop.Products.ProductStores
{
public class ProductStoreDomainTests : ProductsDomainTestBase
{
public ProductStoreDomainTests()
{
}
[Fact]
public async Task Test1()
{
// Arrange
// Assert
// Assert
}
}
}

31
modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductStores/ProductStoreRepositoryTests.cs

@ -0,0 +1,31 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Products.ProductStores;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EasyAbp.EShop.Products.EntityFrameworkCore.ProductStores
{
public class ProductStoreRepositoryTests : ProductsEntityFrameworkCoreTestBase
{
private readonly IRepository<ProductStore, Guid> _productStoreRepository;
public ProductStoreRepositoryTests()
{
_productStoreRepository = GetRequiredService<IRepository<ProductStore, Guid>>();
}
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
}
}

0
modules/EasyAbp.EShop.Stores/host/EasyAbp.EShop.Stores.Web.Unified/EasyAbp.EShop.Stores.Web.Unified.csproj

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

7
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/Authorization/StoresPermissionDefinitionProvider.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissionDefinitionProvider.cs

@ -8,7 +8,12 @@ namespace EasyAbp.EShop.Stores.Authorization
{
public override void Define(IPermissionDefinitionContext context)
{
//var moduleGroup = context.AddGroup(StoresPermissions.GroupName, L("Permission:Stores"));
var moduleGroup = context.AddGroup(StoresPermissions.GroupName, L("Permission:Stores"));
var stores = moduleGroup.AddPermission(StoresPermissions.Stores.Default, L("Permission:Store"));
stores.AddChild(StoresPermissions.Stores.Create, L("Permission:Create"));
stores.AddChild(StoresPermissions.Stores.Update, L("Permission:Update"));
stores.AddChild(StoresPermissions.Stores.Delete, L("Permission:Delete"));
}
private static LocalizableString L(string name)

8
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/Authorization/StoresPermissions.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissions.cs

@ -10,5 +10,13 @@ namespace EasyAbp.EShop.Stores.Authorization
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(StoresPermissions));
}
public class Stores
{
public const string Default = GroupName + ".Store";
public const string Delete = Default + ".Delete";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
}
}
}

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EShopStoresApplicationContractsModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs

@ -0,0 +1,13 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Stores.Stores.Dtos
{
public class CreateUpdateStoreDto
{
[Required]
[DisplayName("StoreName")]
public string Name { get; set; }
}
}

10
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs

@ -0,0 +1,10 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Stores.Stores.Dtos
{
public class StoreDto : FullAuditedEntityDto<Guid>
{
public string Name { get; set; }
}
}

19
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/IStoreAppService.cs

@ -0,0 +1,19 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Stores.Stores.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Stores.Stores
{
public interface IStoreAppService :
ICrudAppService<
StoreDto,
Guid,
PagedAndSortedResultRequestDto,
CreateUpdateStoreDto,
CreateUpdateStoreDto>
{
Task<StoreDto> GetDefaultAsync();
}
}

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EShopStoresApplicationModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/EShopStoresApplicationModule.cs

26
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs

@ -0,0 +1,26 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Stores.Stores.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Stores.Stores
{
public class StoreAppService : CrudAppService<Store, StoreDto, Guid, PagedAndSortedResultRequestDto, CreateUpdateStoreDto, CreateUpdateStoreDto>,
IStoreAppService
{
private readonly IStoreRepository _repository;
public StoreAppService(IStoreRepository repository) : base(repository)
{
_repository = repository;
}
public async Task<StoreDto> GetDefaultAsync()
{
// Todo: need to be improved
return ObjectMapper.Map<Store, StoreDto>(await _repository.FirstOrDefaultAsync());
}
}
}

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/StoresAppService.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresAppService.cs

8
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/StoresApplicationAutoMapperProfile.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs

@ -1,4 +1,6 @@
using AutoMapper;
using EasyAbp.EShop.Stores.Stores;
using EasyAbp.EShop.Stores.Stores.Dtos;
using AutoMapper;
namespace EasyAbp.EShop.Stores
{
@ -9,6 +11,8 @@ namespace EasyAbp.EShop.Stores
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<Store, StoreDto>();
CreateMap<CreateUpdateStoreDto, Store>(MemberList.Source);
}
}
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
@ -12,8 +12,8 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\Stores\*.json" />
<Content Remove="Localization\Stores\*.json" />
<EmbeddedResource Include="EasyAbp\EShop\Stores\Localization\Stores\*.json" />
<Content Remove="EasyAbp\EShop\Stores\Localization\Stores\*.json" />
</ItemGroup>
</Project>

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EShopStoresDomainSharedModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/EShopStoresDomainSharedModule.cs

@ -17,7 +17,7 @@ namespace EasyAbp.EShop.Stores
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<EShopStoresDomainSharedModule>("EasyAbp.EShop.Stores");
options.FileSets.AddEmbedded<EShopStoresDomainSharedModule>();
});
Configure<AbpLocalizationOptions>(options =>
@ -25,12 +25,12 @@ namespace EasyAbp.EShop.Stores
options.Resources
.Add<StoresResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/Stores");
.AddVirtualJson("/EasyAbp/EShop/Stores/Localization/Stores");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace("Stores", typeof(StoresResource));
options.MapCodeNamespace("EasyAbp.EShop.Stores", typeof(StoresResource));
});
}
}

12
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/cs.json

@ -0,0 +1,12 @@
{
"culture": "cs",
"texts": {
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json

@ -0,0 +1,13 @@
{
"culture": "en",
"texts": {
"ManageYourProfile": "Manage your profile",
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

12
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pl.json

@ -0,0 +1,12 @@
{
"culture": "pl",
"texts": {
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

12
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/pt-BR.json

@ -0,0 +1,12 @@
{
"culture": "pt-BR",
"texts": {
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/sl.json

@ -0,0 +1,13 @@
{
"culture": "sl",
"texts": {
"ManageYourProfile": "Upravljajte svojim profilom",
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/tr.json

@ -0,0 +1,13 @@
{
"culture": "tr",
"texts": {
"ManageYourProfile": "Profil y�netimi",
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

12
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/vi.json

@ -0,0 +1,12 @@
{
"culture": "vi",
"texts": {
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/zh-Hans.json

@ -0,0 +1,13 @@
{
"culture": "zh-Hans",
"texts": {
"ManageYourProfile": "管理个人资料",
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/zh-Hant.json

@ -0,0 +1,13 @@
{
"culture": "zh-Hant",
"texts": {
"ManageYourProfile": "管理個人資料",
"Menu:Store": "MenuStore",
"Store": "Store",
"StoreName": "StoreName",
"CreateStore": "CreateStore",
"EditStore": "EditStore",
"StoreDeletionConfirmationMessage": "Are you sure to delete the store {0}?",
"SuccessfullyDeleted": "Successfully deleted"
}
}

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/StoresResource.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/StoresResource.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Stores/IMultiStore.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Stores/IMultiStore.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/StoresErrorCodes.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/cs.json

@ -1,6 +0,0 @@
{
"culture": "cs",
"texts": {
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/en.json

@ -1,6 +0,0 @@
{
"culture": "en",
"texts": {
"ManageYourProfile": "Manage your profile"
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/pl.json

@ -1,6 +0,0 @@
{
"culture": "pl",
"texts": {
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/pt-BR.json

@ -1,6 +0,0 @@
{
"culture": "pt-BR",
"texts": {
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/sl.json

@ -1,6 +0,0 @@
{
"culture": "sl",
"texts": {
"ManageYourProfile": "Upravljajte svojim profilom"
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/tr.json

@ -1,6 +0,0 @@
{
"culture": "tr",
"texts": {
"ManageYourProfile": "Profil yönetimi"
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/vi.json

@ -1,6 +0,0 @@
{
"culture": "vi",
"texts": {
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/zh-Hans.json

@ -1,6 +0,0 @@
{
"culture": "zh-Hans",
"texts": {
"ManageYourProfile": "管理个人资料"
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/Localization/Stores/zh-Hant.json

@ -1,6 +0,0 @@
{
"culture": "zh-Hant",
"texts": {
"ManageYourProfile": "管理個人資料"
}
}

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EShopStoresDomainModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/EShopStoresDomainModule.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/Settings/StoresSettingDefinitionProvider.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettingDefinitionProvider.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/Settings/StoresSettings.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettings.cs

12
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreRepository.cs

@ -0,0 +1,12 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Stores.Stores
{
public interface IStoreRepository : IRepository<Store, Guid>
{
Task<Store> FirstOrDefaultAsync(CancellationToken cancellationToken = default);
}
}

26
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/Store.cs

@ -0,0 +1,26 @@
using System;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Stores.Stores
{
public class Store : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
[NotNull]
public virtual string Name { get; protected set; }
// Todo: more properties.
protected Store() {}
public Store(
Guid id,
[NotNull] string name) : base(id)
{
Name = name;
}
}
}

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/StoresDbProperties.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoresDbProperties.cs

11
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/Stores/Store.cs

@ -1,11 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Stores.Stores
{
public class Store : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
@ -12,4 +12,8 @@
<ProjectReference Include="..\EasyAbp.EShop.Stores.Domain\EasyAbp.EShop.Stores.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="EasyAbp\EShop\Stores" />
</ItemGroup>
</Project>

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using EasyAbp.EShop.Stores.Stores;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
@ -17,7 +18,8 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore
/* Add custom repositories here. Example:
* options.AddRepository<Question, EfCoreQuestionRepository>();
*/
options.AddRepository<Store, StoreRepository>();
});
}
}
}
}

7
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EntityFrameworkCore/IStoresDbContext.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs

@ -1,5 +1,7 @@
using Volo.Abp.Data;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Stores.Stores;
namespace EasyAbp.EShop.Stores.EntityFrameworkCore
{
@ -9,5 +11,6 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore
/* Add DbSet for each Aggregate Root here. Example:
* DbSet<Question> Questions { get; }
*/
DbSet<Store> Stores { get; set; }
}
}
}

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EntityFrameworkCore/StoresDbContext.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Stores.Stores;
namespace EasyAbp.EShop.Stores.EntityFrameworkCore
{
@ -10,6 +11,7 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore
/* Add DbSet for each Aggregate Root here. Example:
* public DbSet<Question> Questions { get; set; }
*/
public DbSet<Store> Stores { get; set; }
public StoresDbContext(DbContextOptions<StoresDbContext> options)
: base(options)
@ -24,4 +26,4 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore
builder.ConfigureStores();
}
}
}
}

13
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs

@ -1,6 +1,8 @@
using System;
using EasyAbp.EShop.Stores.Stores;
using System;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace EasyAbp.EShop.Stores.EntityFrameworkCore
{
@ -38,6 +40,13 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore
b.HasIndex(q => q.CreationTime);
});
*/
builder.Entity<Store>(b =>
{
b.ToTable(options.TablePrefix + "Stores", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
});
}
}
}
}

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EntityFrameworkCore/StoresModelBuilderConfigurationOptions.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresModelBuilderConfigurationOptions.cs

22
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/Stores/StoreRepository.cs

@ -0,0 +1,22 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using EasyAbp.EShop.Stores.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Stores.Stores
{
public class StoreRepository : EfCoreRepository<StoresDbContext, Store, Guid>, IStoreRepository
{
public StoreRepository(IDbContextProvider<StoresDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<Store> FirstOrDefaultAsync(CancellationToken cancellationToken = default)
{
return await WithDetails().FirstOrDefaultAsync(cancellationToken: cancellationToken);
}
}
}

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EShopStoresHttpApiClientModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp/EShop/Stores/EShopStoresHttpApiClientModule.cs

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EShopStoresHttpApiModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/EShopStoresHttpApiModule.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/StoresController.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoresController.cs

6
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>EasyAbp.EShop.Stores</RootNamespace>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
@ -12,4 +12,8 @@
<ProjectReference Include="..\EasyAbp.EShop.Stores.Domain\EasyAbp.EShop.Stores.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="EasyAbp\EShop\Stores" />
</ItemGroup>
</Project>

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/MongoDB/EShopStoresMongoDbModule.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp/EShop/Stores/MongoDB/EShopStoresMongoDbModule.cs

0
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/MongoDB/IStoresMongoDbContext.cs → modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp/EShop/Stores/MongoDB/IStoresMongoDbContext.cs

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save