Browse Source

Refactor StoreAssetCategoryDto to GrantedStoreDto

pull/157/head
gdlcf88 4 years ago
parent
commit
f8d9e8984b
  1. 42
      plugins/Booking/src/EasyAbp.EShop.Orders.Booking.Application/EasyAbp/EShop/Orders/Booking/Authorization/BookingOrderCreationAuthorizationHandler.cs
  2. 16
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/CreateUpdateGrantedStoreDto.cs
  3. 16
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/GetGrantedStoreListDto.cs
  4. 17
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/GrantedStoreDto.cs
  5. 17
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/IGrantedStoreAppService.cs
  6. 8
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissionDefinitionProvider.cs
  7. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissions.cs
  8. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/CreateUpdateStoreAssetCategoryDto.cs
  9. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/GetStoreAssetCategoryListDto.cs
  10. 13
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/StoreAssetCategoryDto.cs
  11. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/IStoreAssetCategoryAppService.cs
  12. 8
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/BookingApplicationAutoMapperProfile.cs
  13. 36
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreAppService.cs
  14. 34
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryAppService.cs
  15. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/en.json
  16. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hans.json
  17. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hant.json
  18. 39
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStore.cs
  19. 9
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/GrantedStores/IGrantedStoreRepository.cs
  20. 9
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/IStoreAssetCategoryRepository.cs
  21. 30
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory.cs
  22. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContext.cs
  23. 6
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContextModelCreatingExtensions.cs
  24. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/EShopPluginsBookingEntityFrameworkCoreModule.cs
  25. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/IBookingDbContext.cs
  26. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreEfCoreQuerableExtensions.cs
  27. 21
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreRepository.cs
  28. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryEfCoreQuerableExtensions.cs
  29. 21
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryRepository.cs
  30. 20
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreController.cs
  31. 8
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/BookingWebAutoMapperProfile.cs
  32. 6
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenuContributor.cs
  33. 2
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenus.cs
  34. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/CreateModal.cshtml
  35. 28
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/CreateModal.cshtml.cs
  36. 4
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/EditModal.cshtml
  37. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/EditModal.cshtml.cs
  38. 22
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/Index.cshtml
  39. 2
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/Index.cshtml.cs
  40. 22
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/ViewModels/CreateEditGrantedStoreViewModel.cs
  41. 0
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.css
  42. 28
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.js
  43. 28
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/CreateModal.cshtml.cs
  44. 28
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/GrantedStores/GrantedStoreAppServiceTests.cs
  45. 28
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/StoreAssetCategories/StoreAssetCategoryAppServiceTests.cs
  46. 6
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/GrantedStores/GrantedStoreDomainTests.cs
  47. 33
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/GrantedStores/GrantedStoreRepositoryTests.cs
  48. 33
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreAssetCategories/StoreAssetCategoryRepositoryTests.cs
  49. 5422
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/20220604201021_RefactoredToGrantedStore.Designer.cs
  50. 64
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/20220604201021_RefactoredToGrantedStore.cs
  51. 100
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/EShopSampleDbContextModelSnapshot.cs

42
plugins/Booking/src/EasyAbp.EShop.Orders.Booking.Application/EasyAbp/EShop/Orders/Booking/Authorization/BookingOrderCreationAuthorizationHandler.cs

@ -13,8 +13,8 @@ using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.ProductAssets; using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Volo.Abp; using Volo.Abp;
@ -24,7 +24,7 @@ namespace EasyAbp.EShop.Orders.Booking.Authorization
{ {
private readonly IPeriodSchemeAppService _periodSchemeAppService; private readonly IPeriodSchemeAppService _periodSchemeAppService;
private readonly IProductAssetAppService _productAssetAppService; private readonly IProductAssetAppService _productAssetAppService;
private readonly IStoreAssetCategoryAppService _storeAssetCategoryAppService; private readonly IGrantedStoreAppService _grantedStoreAppService;
private readonly IProductAssetCategoryAppService _productAssetCategoryAppService; private readonly IProductAssetCategoryAppService _productAssetCategoryAppService;
private readonly IAssetOccupancyAppService _assetOccupancyAppService; private readonly IAssetOccupancyAppService _assetOccupancyAppService;
private readonly IBookingProductGroupDefinitionAppService _definitionAppService; private readonly IBookingProductGroupDefinitionAppService _definitionAppService;
@ -32,14 +32,14 @@ namespace EasyAbp.EShop.Orders.Booking.Authorization
public BookingOrderCreationAuthorizationHandler( public BookingOrderCreationAuthorizationHandler(
IPeriodSchemeAppService periodSchemeAppService, IPeriodSchemeAppService periodSchemeAppService,
IProductAssetAppService productAssetAppService, IProductAssetAppService productAssetAppService,
IStoreAssetCategoryAppService storeAssetCategoryAppService, IGrantedStoreAppService grantedStoreAppService,
IProductAssetCategoryAppService productAssetCategoryAppService, IProductAssetCategoryAppService productAssetCategoryAppService,
IAssetOccupancyAppService assetOccupancyAppService, IAssetOccupancyAppService assetOccupancyAppService,
IBookingProductGroupDefinitionAppService definitionAppService) IBookingProductGroupDefinitionAppService definitionAppService)
{ {
_periodSchemeAppService = periodSchemeAppService; _periodSchemeAppService = periodSchemeAppService;
_productAssetAppService = productAssetAppService; _productAssetAppService = productAssetAppService;
_storeAssetCategoryAppService = storeAssetCategoryAppService; _grantedStoreAppService = grantedStoreAppService;
_productAssetCategoryAppService = productAssetCategoryAppService; _productAssetCategoryAppService = productAssetCategoryAppService;
_assetOccupancyAppService = assetOccupancyAppService; _assetOccupancyAppService = assetOccupancyAppService;
_definitionAppService = definitionAppService; _definitionAppService = definitionAppService;
@ -146,7 +146,26 @@ namespace EasyAbp.EShop.Orders.Booking.Authorization
protected virtual async Task<bool> IsAssetInfoValidAsync(CreateOrderLineDto orderLine, protected virtual async Task<bool> IsAssetInfoValidAsync(CreateOrderLineDto orderLine,
OrderCreationResource resource) OrderCreationResource resource)
{ {
// Todo: check store to asset mapping. var mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
{
MaxResultCount = 1,
StoreId = resource.Input.StoreId,
AssetId = orderLine.GetBookingAssetId()
})).Items.FirstOrDefault();
if (mapping is null)
{
mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
{
MaxResultCount = 1,
AllowAll = true
})).Items.FirstOrDefault();
}
if (mapping is null)
{
return false;
}
var productAsset = (await _productAssetAppService.GetListAsync( var productAsset = (await _productAssetAppService.GetListAsync(
new GetProductAssetListDto new GetProductAssetListDto
@ -166,13 +185,22 @@ namespace EasyAbp.EShop.Orders.Booking.Authorization
protected virtual async Task<bool> IsAssetCategoryInfoValidAsync(CreateOrderLineDto orderLine, protected virtual async Task<bool> IsAssetCategoryInfoValidAsync(CreateOrderLineDto orderLine,
OrderCreationResource resource) OrderCreationResource resource)
{ {
var mapping = (await _storeAssetCategoryAppService.GetListAsync(new GetStoreAssetCategoryListDto var mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
{ {
MaxResultCount = 1, MaxResultCount = 1,
StoreId = resource.Input.StoreId, StoreId = resource.Input.StoreId,
AssetCategoryId = orderLine.GetBookingAssetCategoryId() AssetCategoryId = orderLine.GetBookingAssetCategoryId()
})).Items.FirstOrDefault(); })).Items.FirstOrDefault();
if (mapping is null)
{
mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
{
MaxResultCount = 1,
AllowAll = true
})).Items.FirstOrDefault();
}
if (mapping is null) if (mapping is null)
{ {
return false; return false;

16
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/CreateUpdateGrantedStoreDto.cs

@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos
{
[Serializable]
public class CreateUpdateGrantedStoreDto
{
public Guid StoreId { get; set; }
public Guid? AssetId { get; set; }
public Guid? AssetCategoryId { get; set; }
public bool AllowAll { get; set; }
}
}

16
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/GetGrantedStoreListDto.cs

@ -0,0 +1,16 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
[Serializable]
public class GetGrantedStoreListDto : PagedAndSortedResultRequestDto
{
public Guid? StoreId { get; set; }
public Guid? AssetId { get; set; }
public Guid? AssetCategoryId { get; set; }
public bool? AllowAll { get; set; }
}

17
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/Dtos/GrantedStoreDto.cs

@ -0,0 +1,17 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos
{
[Serializable]
public class GrantedStoreDto : AuditedEntityDto<Guid>
{
public Guid StoreId { get; set; }
public Guid? AssetId { get; set; }
public Guid? AssetCategoryId { get; set; }
public bool AllowAll { get; set; }
}
}

17
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/GrantedStores/IGrantedStoreAppService.cs

@ -0,0 +1,17 @@
using System;
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public interface IGrantedStoreAppService :
ICrudAppService<
GrantedStoreDto,
Guid,
GetGrantedStoreListDto,
CreateUpdateGrantedStoreDto,
CreateUpdateGrantedStoreDto>
{
}
}

8
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissionDefinitionProvider.cs

@ -22,10 +22,10 @@ public class BookingPermissionDefinitionProvider : PermissionDefinitionProvider
productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Update, L("Permission:Update")); productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Update, L("Permission:Update"));
productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Delete, L("Permission:Delete")); productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Delete, L("Permission:Delete"));
var storeAssetCategoryPermission = myGroup.AddPermission(BookingPermissions.StoreAssetCategory.Default, L("Permission:StoreAssetCategory")); var grantedStorePermission = myGroup.AddPermission(BookingPermissions.GrantedStore.Default, L("Permission:GrantedStore"));
storeAssetCategoryPermission.AddChild(BookingPermissions.StoreAssetCategory.Create, L("Permission:Create")); grantedStorePermission.AddChild(BookingPermissions.GrantedStore.Create, L("Permission:Create"));
storeAssetCategoryPermission.AddChild(BookingPermissions.StoreAssetCategory.Update, L("Permission:Update")); grantedStorePermission.AddChild(BookingPermissions.GrantedStore.Update, L("Permission:Update"));
storeAssetCategoryPermission.AddChild(BookingPermissions.StoreAssetCategory.Delete, L("Permission:Delete")); grantedStorePermission.AddChild(BookingPermissions.GrantedStore.Delete, L("Permission:Delete"));
} }
private static LocalizableString L(string name) private static LocalizableString L(string name)

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissions.cs

@ -29,9 +29,9 @@ public class BookingPermissions
public const string Delete = Default + ".Delete"; public const string Delete = Default + ".Delete";
} }
public class StoreAssetCategory public class GrantedStore
{ {
public const string Default = GroupName + ".StoreAssetCategory"; public const string Default = GroupName + ".GrantedStore";
public const string Update = Default + ".Update"; public const string Update = Default + ".Update";
public const string Create = Default + ".Create"; public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete"; public const string Delete = Default + ".Delete";

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/CreateUpdateStoreAssetCategoryDto.cs

@ -1,12 +0,0 @@
using System;
using System.ComponentModel;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos
{
[Serializable]
public class CreateUpdateStoreAssetCategoryDto
{
public Guid StoreId { get; set; }
public Guid AssetCategoryId { get; set; }
}
}

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/GetStoreAssetCategoryListDto.cs

@ -1,12 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos;
[Serializable]
public class GetStoreAssetCategoryListDto : PagedAndSortedResultRequestDto
{
public Guid? StoreId { get; set; }
public Guid? AssetCategoryId { get; set; }
}

13
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/Dtos/StoreAssetCategoryDto.cs

@ -1,13 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos
{
[Serializable]
public class StoreAssetCategoryDto : AuditedEntityDto<Guid>
{
public Guid StoreId { get; set; }
public Guid AssetCategoryId { get; set; }
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/IStoreAssetCategoryAppService.cs

@ -1,18 +0,0 @@
using System;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public interface IStoreAssetCategoryAppService :
ICrudAppService<
StoreAssetCategoryDto,
Guid,
GetStoreAssetCategoryListDto,
CreateUpdateStoreAssetCategoryDto,
CreateUpdateStoreAssetCategoryDto>
{
}
}

8
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/BookingApplicationAutoMapperProfile.cs

@ -2,8 +2,8 @@ using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using AutoMapper; using AutoMapper;
namespace EasyAbp.EShop.Plugins.Booking; namespace EasyAbp.EShop.Plugins.Booking;
@ -27,7 +27,7 @@ public class BookingApplicationAutoMapperProfile : Profile
CreateMap<CreateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source); CreateMap<CreateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source);
CreateMap<UpdateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source); CreateMap<UpdateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source);
CreateMap<StoreAssetCategory, StoreAssetCategoryDto>(); CreateMap<GrantedStore, GrantedStoreDto>();
CreateMap<CreateUpdateStoreAssetCategoryDto, StoreAssetCategory>(MemberList.Source); CreateMap<CreateUpdateGrantedStoreDto, GrantedStore>(MemberList.Source);
} }
} }

36
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreAppService.cs

@ -0,0 +1,36 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.Permissions;
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public class GrantedStoreAppService : CrudAppService<GrantedStore, GrantedStoreDto, Guid,
GetGrantedStoreListDto, CreateUpdateGrantedStoreDto, CreateUpdateGrantedStoreDto>,
IGrantedStoreAppService
{
protected override string GetPolicyName { get; set; } = null;
protected override string GetListPolicyName { get; set; } = null;
protected override string CreatePolicyName { get; set; } = BookingPermissions.GrantedStore.Create;
protected override string UpdatePolicyName { get; set; } = BookingPermissions.GrantedStore.Update;
protected override string DeletePolicyName { get; set; } = BookingPermissions.GrantedStore.Delete;
private readonly IGrantedStoreRepository _repository;
public GrantedStoreAppService(IGrantedStoreRepository repository) : base(repository)
{
_repository = repository;
}
protected override async Task<IQueryable<GrantedStore>> CreateFilteredQueryAsync(GetGrantedStoreListDto input)
{
return (await base.CreateFilteredQueryAsync(input))
.WhereIf(input.StoreId.HasValue, x => x.StoreId == input.StoreId)
.WhereIf(input.AssetId.HasValue, x => x.AssetId == input.AssetId)
.WhereIf(input.AssetCategoryId.HasValue, x => x.AssetCategoryId == input.AssetCategoryId)
.WhereIf(input.AllowAll.HasValue, x => x.AllowAll == input.AllowAll);
}
}
}

34
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryAppService.cs

@ -1,34 +0,0 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.Permissions;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public class StoreAssetCategoryAppService : CrudAppService<StoreAssetCategory, StoreAssetCategoryDto, Guid,
GetStoreAssetCategoryListDto, CreateUpdateStoreAssetCategoryDto, CreateUpdateStoreAssetCategoryDto>,
IStoreAssetCategoryAppService
{
protected override string GetPolicyName { get; set; } = null;
protected override string GetListPolicyName { get; set; } = null;
protected override string CreatePolicyName { get; set; } = BookingPermissions.StoreAssetCategory.Create;
protected override string UpdatePolicyName { get; set; } = BookingPermissions.StoreAssetCategory.Update;
protected override string DeletePolicyName { get; set; } = BookingPermissions.StoreAssetCategory.Delete;
private readonly IStoreAssetCategoryRepository _repository;
public StoreAssetCategoryAppService(IStoreAssetCategoryRepository repository) : base(repository)
{
_repository = repository;
}
protected override async Task<IQueryable<StoreAssetCategory>> CreateFilteredQueryAsync(GetStoreAssetCategoryListDto input)
{
return (await base.CreateFilteredQueryAsync(input))
.WhereIf(input.StoreId.HasValue, x => x.StoreId == input.StoreId)
.WhereIf(input.AssetCategoryId.HasValue, x => x.AssetCategoryId == input.AssetCategoryId);
}
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/en.json

@ -55,13 +55,15 @@
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "Exist conflicting product asset mapping.", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "Exist conflicting product asset mapping.",
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "Exist conflicting product asset category mapping.", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "Exist conflicting product asset category mapping.",
"EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "Wrong StoreId {storeId} for product {productId}.", "EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "Wrong StoreId {storeId} for product {productId}.",
"Permission:StoreAssetCategory": "Store assets", "Permission:GrantedStore": "Store assets",
"Menu:StoreAssetCategory": "Store assets", "Menu:GrantedStore": "Store assets",
"StoreAssetCategory": "Store assets", "GrantedStore": "Store assets",
"StoreAssetCategoryStoreId": "Store ID", "GrantedStoreStoreId": "Store ID",
"StoreAssetCategoryAssetCategoryId": "Asset category ID", "GrantedStoreAssetId": "Asset ID",
"CreateStoreAssetCategory": "New", "GrantedStoreAssetCategoryId": "Asset category ID",
"EditStoreAssetCategory": "Edit", "GrantedStoreAllowAll": "Allow all",
"StoreAssetCategoryDeletionConfirmationMessage": "Are you sure to delete the store asset category {0}?" "CreateGrantedStore": "New",
"EditGrantedStore": "Edit",
"GrantedStoreDeletionConfirmationMessage": "Are you sure to delete the store asset category {0}?"
} }
} }

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hans.json

@ -55,13 +55,15 @@
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "存在冲突的产品资产映射。", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "存在冲突的产品资产映射。",
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "存在冲突的产品资产映射。", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "存在冲突的产品资产映射。",
"EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "错误的店铺 ID {storeId} 之于产品 {productId}。", "EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "错误的店铺 ID {storeId} 之于产品 {productId}。",
"Permission:StoreAssetCategory": "店铺资产", "Permission:GrantedStore": "店铺资产",
"Menu:StoreAssetCategory": "店铺资产", "Menu:GrantedStore": "店铺资产",
"StoreAssetCategory": "店铺资产", "GrantedStore": "店铺资产",
"StoreAssetCategoryStoreId": "店铺 ID", "GrantedStoreStoreId": "店铺 ID",
"StoreAssetCategoryAssetCategoryId": "资产目录 ID", "GrantedStoreAssetId": "资产 ID",
"CreateStoreAssetCategory": "新建", "GrantedStoreAssetCategoryId": "资产目录 ID",
"EditStoreAssetCategory": "编辑", "GrantedStoreAllowAll": "允许所有",
"StoreAssetCategoryDeletionConfirmationMessage": "确认删除店铺资产 {0}?" "CreateGrantedStore": "新建",
"EditGrantedStore": "编辑",
"GrantedStoreDeletionConfirmationMessage": "确认删除店铺资产 {0}?"
} }
} }

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hant.json

@ -55,13 +55,15 @@
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "存在衝突的產品資產映射。", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAsset": "存在衝突的產品資產映射。",
"EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "存在衝突的產品資產映射。", "EasyAbp.EShop.Plugins.Booking:ConflictingProductAssetCategory": "存在衝突的產品資產映射。",
"EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "錯誤的店鋪 ID {storeId} 之於產品 {productId}。", "EasyAbp.EShop.Plugins.Booking:WrongStoreIdForProduct": "錯誤的店鋪 ID {storeId} 之於產品 {productId}。",
"Permission:StoreAssetCategory": "店鋪資產", "Permission:GrantedStore": "店鋪資產",
"Menu:StoreAssetCategory": "店鋪資產", "Menu:GrantedStore": "店鋪資產",
"StoreAssetCategory": "店鋪資產", "GrantedStore": "店鋪資產",
"StoreAssetCategoryStoreId": "店鋪 ID", "GrantedStoreStoreId": "店鋪 ID",
"StoreAssetCategoryAssetCategoryId": "資產目錄 ID", "GrantedStoreAssetId": "資產 ID",
"CreateStoreAssetCategory": "新建", "GrantedStoreAssetCategoryId": "資產目錄 ID",
"EditStoreAssetCategory": "編輯", "GrantedStoreAllowAll": "允許所有",
"StoreAssetCategoryDeletionConfirmationMessage": "確認刪除店鋪資產 {0}?" "CreateGrantedStore": "新建",
"EditGrantedStore": "編輯",
"GrantedStoreDeletionConfirmationMessage": "確認刪除店鋪資產 {0}?"
} }
} }

39
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStore.cs

@ -0,0 +1,39 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores;
/// <summary>
/// Mapping of Store to Asset or AssetCategory.
/// It determines which Asset or AssetCategory can a store owner set to provide booking service as a product of its store.
/// </summary>
public class GrantedStore : AuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid StoreId { get; protected set; }
public virtual Guid? AssetId { get; protected set; }
public virtual Guid? AssetCategoryId { get; protected set; }
/// <summary>
/// Allow using any assets in any categories.
/// </summary>
public virtual bool AllowAll { get; protected set; }
protected GrantedStore()
{
}
public GrantedStore(Guid id, Guid? tenantId, Guid storeId, Guid? assetId, Guid? assetCategoryId,
bool allowAll) : base(id)
{
TenantId = tenantId;
StoreId = storeId;
AssetId = assetId;
AssetCategoryId = assetCategoryId;
AllowAll = allowAll;
}
}

9
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/GrantedStores/IGrantedStoreRepository.cs

@ -0,0 +1,9 @@
using System;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public interface IGrantedStoreRepository : IRepository<GrantedStore, Guid>
{
}
}

9
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/IStoreAssetCategoryRepository.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public interface IStoreAssetCategoryRepository : IRepository<StoreAssetCategory, Guid>
{
}
}

30
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory.cs

@ -1,30 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories;
/// <summary>
/// Mapping of Store to AssetCategory.
/// It determines which AssetCategory can a store owner set to provide booking service as a product of its store.
/// Stores can use all the sub-categories if you set a parent category for them.
/// </summary>
public class StoreAssetCategory : AuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid StoreId { get; protected set; }
public virtual Guid AssetCategoryId { get; protected set; }
protected StoreAssetCategory()
{
}
public StoreAssetCategory(Guid id, Guid? tenantId, Guid storeId, Guid assetCategoryId) : base(id)
{
TenantId = tenantId;
StoreId = storeId;
AssetCategoryId = assetCategoryId;
}
}

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContext.cs

@ -3,7 +3,7 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Booking.ProductAssets; using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore; namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
@ -17,7 +17,7 @@ public class BookingDbContext : AbpDbContext<BookingDbContext>, IBookingDbContex
public DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; } public DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; }
public DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; } public DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; }
public DbSet<ProductAssetCategory> ProductAssetCategories { get; set; } public DbSet<ProductAssetCategory> ProductAssetCategories { get; set; }
public DbSet<StoreAssetCategory> StoreAssetCategories { get; set; } public DbSet<GrantedStore> GrantedStores { get; set; }
public BookingDbContext(DbContextOptions<BookingDbContext> options) public BookingDbContext(DbContextOptions<BookingDbContext> options)
: base(options) : base(options)

6
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContextModelCreatingExtensions.cs

@ -1,4 +1,4 @@
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssets; using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -71,9 +71,9 @@ public static class BookingDbContextModelCreatingExtensions
}); });
builder.Entity<StoreAssetCategory>(b => builder.Entity<GrantedStore>(b =>
{ {
b.ToTable(BookingDbProperties.DbTablePrefix + "StoreAssetCategories", BookingDbProperties.DbSchema); b.ToTable(BookingDbProperties.DbTablePrefix + "GrantedStores", BookingDbProperties.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
/* Configure more properties here */ /* Configure more properties here */

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/EShopPluginsBookingEntityFrameworkCoreModule.cs

@ -1,4 +1,4 @@
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssets; using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -22,7 +22,7 @@ public class EShopPluginsBookingEntityFrameworkCoreModule : AbpModule
*/ */
options.AddRepository<ProductAsset, ProductAssetRepository>(); options.AddRepository<ProductAsset, ProductAssetRepository>();
options.AddRepository<ProductAssetCategory, ProductAssetCategoryRepository>(); options.AddRepository<ProductAssetCategory, ProductAssetCategoryRepository>();
options.AddRepository<StoreAssetCategory, StoreAssetCategoryRepository>(); options.AddRepository<GrantedStore, GrantedStoreRepository>();
}); });
} }
} }

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/IBookingDbContext.cs

@ -3,7 +3,7 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Booking.ProductAssets; using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore; namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
@ -17,5 +17,5 @@ public interface IBookingDbContext : IEfCoreDbContext
DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; } DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; }
DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; } DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; }
DbSet<ProductAssetCategory> ProductAssetCategories { get; set; } DbSet<ProductAssetCategory> ProductAssetCategories { get; set; }
DbSet<StoreAssetCategory> StoreAssetCategories { get; set; } DbSet<GrantedStore> GrantedStores { get; set; }
} }

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreEfCoreQuerableExtensions.cs

@ -0,0 +1,18 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public static class GrantedStoreEfCoreQueryableExtensions
{
public static IQueryable<GrantedStore> IncludeDetails(this IQueryable<GrantedStore> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable;
}
}
}

21
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreRepository.cs

@ -0,0 +1,21 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public class GrantedStoreRepository : EfCoreRepository<IBookingDbContext, GrantedStore, Guid>, IGrantedStoreRepository
{
public GrantedStoreRepository(IDbContextProvider<IBookingDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public override async Task<IQueryable<GrantedStore>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryEfCoreQuerableExtensions.cs

@ -1,18 +0,0 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public static class StoreAssetCategoryEfCoreQueryableExtensions
{
public static IQueryable<StoreAssetCategory> IncludeDetails(this IQueryable<StoreAssetCategory> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable;
}
}
}

21
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryRepository.cs

@ -1,21 +0,0 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public class StoreAssetCategoryRepository : EfCoreRepository<IBookingDbContext, StoreAssetCategory, Guid>, IStoreAssetCategoryRepository
{
public StoreAssetCategoryRepository(IDbContextProvider<IBookingDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public override async Task<IQueryable<StoreAssetCategory>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}
}

20
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategoryController.cs → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/GrantedStores/GrantedStoreController.cs

@ -1,34 +1,34 @@
using System; using System;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{ {
[RemoteService(Name = "BookingStoreAssetCategory")] [RemoteService(Name = "BookingGrantedStore")]
[Route("/api/booking/store-asset-category")] [Route("/api/booking/store-asset-category")]
public class StoreAssetCategoryController : BookingController, IStoreAssetCategoryAppService public class GrantedStoreController : BookingController, IGrantedStoreAppService
{ {
private readonly IStoreAssetCategoryAppService _service; private readonly IGrantedStoreAppService _service;
public StoreAssetCategoryController(IStoreAssetCategoryAppService service) public GrantedStoreController(IGrantedStoreAppService service)
{ {
_service = service; _service = service;
} }
[HttpPost] [HttpPost]
[Route("")] [Route("")]
public virtual Task<StoreAssetCategoryDto> CreateAsync(CreateUpdateStoreAssetCategoryDto input) public virtual Task<GrantedStoreDto> CreateAsync(CreateUpdateGrantedStoreDto input)
{ {
return _service.CreateAsync(input); return _service.CreateAsync(input);
} }
[HttpPut] [HttpPut]
[Route("{id}")] [Route("{id}")]
public virtual Task<StoreAssetCategoryDto> UpdateAsync(Guid id, CreateUpdateStoreAssetCategoryDto input) public virtual Task<GrantedStoreDto> UpdateAsync(Guid id, CreateUpdateGrantedStoreDto input)
{ {
return _service.UpdateAsync(id, input); return _service.UpdateAsync(id, input);
} }
@ -42,14 +42,14 @@ namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
[HttpGet] [HttpGet]
[Route("{id}")] [Route("{id}")]
public virtual Task<StoreAssetCategoryDto> GetAsync(Guid id) public virtual Task<GrantedStoreDto> GetAsync(Guid id)
{ {
return _service.GetAsync(id); return _service.GetAsync(id);
} }
[HttpGet] [HttpGet]
[Route("")] [Route("")]
public virtual Task<PagedResultDto<StoreAssetCategoryDto>> GetListAsync(GetStoreAssetCategoryListDto input) public virtual Task<PagedResultDto<GrantedStoreDto>> GetListAsync(GetGrantedStoreListDto input)
{ {
return _service.GetListAsync(input); return _service.GetListAsync(input);
} }

8
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/BookingWebAutoMapperProfile.cs

@ -6,9 +6,9 @@ using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using AutoMapper; using AutoMapper;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels; using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels; using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.ViewModels; using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web; namespace EasyAbp.EShop.Plugins.Booking.Web;
@ -35,7 +35,7 @@ public class BookingWebAutoMapperProfile : Profile
CreateMap<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto>(); CreateMap<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto>();
CreateMap<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto>(); CreateMap<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto>();
CreateMap<StoreAssetCategoryDto, CreateEditStoreAssetCategoryViewModel>(); CreateMap<GrantedStoreDto, CreateEditGrantedStoreViewModel>();
CreateMap<CreateEditStoreAssetCategoryViewModel, CreateUpdateStoreAssetCategoryDto>(); CreateMap<CreateEditGrantedStoreViewModel, CreateUpdateGrantedStoreDto>();
} }
} }

6
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenuContributor.cs

@ -25,11 +25,11 @@ public class BookingMenuContributor : IMenuContributor
var bookingMenuItem = new ApplicationMenuItem(BookingMenus.Prefix, l["Menu:Booking"]); var bookingMenuItem = new ApplicationMenuItem(BookingMenus.Prefix, l["Menu:Booking"]);
if (await context.IsGrantedAsync(BookingPermissions.StoreAssetCategory.Default)) if (await context.IsGrantedAsync(BookingPermissions.GrantedStore.Default))
{ {
bookingMenuItem.AddItem( bookingMenuItem.AddItem(
new ApplicationMenuItem(BookingMenus.StoreAssetCategory, l["Menu:StoreAssetCategory"], new ApplicationMenuItem(BookingMenus.GrantedStore, l["Menu:GrantedStore"],
"/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory") "/EShop/Plugins/Booking/GrantedStores/GrantedStore")
); );
} }

2
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenus.cs

@ -11,5 +11,5 @@ public class BookingMenus
public const string ProductAsset = Prefix + ".ProductAsset"; public const string ProductAsset = Prefix + ".ProductAsset";
public const string ProductAssetCategory = Prefix + ".ProductAssetCategory"; public const string ProductAssetCategory = Prefix + ".ProductAssetCategory";
public const string StoreAssetCategory = Prefix + ".StoreAssetCategory"; public const string GrantedStore = Prefix + ".GrantedStore";
} }

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/CreateModal.cshtml → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/CreateModal.cshtml

@ -3,13 +3,13 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using EasyAbp.EShop.Plugins.Booking.Localization @using EasyAbp.EShop.Plugins.Booking.Localization
@inject IHtmlLocalizer<BookingResource> L @inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.CreateModalModel @model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.CreateModalModel
@{ @{
Layout = null; Layout = null;
} }
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal"> <abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal> <abp-modal>
<abp-modal-header title="@L["CreateStoreAssetCategory"].Value"></abp-modal-header> <abp-modal-header title="@L["CreateGrantedStore"].Value"></abp-modal-header>
<abp-modal-body> <abp-modal-body>
<abp-form-content /> <abp-form-content />
</abp-modal-body> </abp-modal-body>

28
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/CreateModal.cshtml.cs

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore
{
public class CreateModalModel : BookingPageModel
{
[BindProperty]
public CreateEditGrantedStoreViewModel ViewModel { get; set; }
private readonly IGrantedStoreAppService _service;
public CreateModalModel(IGrantedStoreAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateEditGrantedStoreViewModel, CreateUpdateGrantedStoreDto>(ViewModel);
await _service.CreateAsync(dto);
return NoContent();
}
}
}

4
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/EditModal.cshtml → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/EditModal.cshtml

@ -3,13 +3,13 @@
@using Microsoft.AspNetCore.Mvc.Localization @using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<BookingResource> L @inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.EditModalModel @model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.EditModalModel
@{ @{
Layout = null; Layout = null;
} }
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal"> <abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal> <abp-modal>
<abp-modal-header title="@L["EditStoreAssetCategory"].Value"></abp-modal-header> <abp-modal-header title="@L["EditGrantedStore"].Value"></abp-modal-header>
<abp-modal-body> <abp-modal-body>
<abp-input asp-for="Id" /> <abp-input asp-for="Id" />
<abp-form-content /> <abp-form-content />

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/EditModal.cshtml.cs → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/EditModal.cshtml.cs

@ -1,11 +1,11 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories; using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos; using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.ViewModels; using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore
{ {
public class EditModalModel : BookingPageModel public class EditModalModel : BookingPageModel
{ {
@ -14,11 +14,11 @@ namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAss
public Guid Id { get; set; } public Guid Id { get; set; }
[BindProperty] [BindProperty]
public CreateEditStoreAssetCategoryViewModel ViewModel { get; set; } public CreateEditGrantedStoreViewModel ViewModel { get; set; }
private readonly IStoreAssetCategoryAppService _service; private readonly IGrantedStoreAppService _service;
public EditModalModel(IStoreAssetCategoryAppService service) public EditModalModel(IGrantedStoreAppService service)
{ {
_service = service; _service = service;
} }
@ -26,12 +26,12 @@ namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAss
public virtual async Task OnGetAsync() public virtual async Task OnGetAsync()
{ {
var dto = await _service.GetAsync(Id); var dto = await _service.GetAsync(Id);
ViewModel = ObjectMapper.Map<StoreAssetCategoryDto, CreateEditStoreAssetCategoryViewModel>(dto); ViewModel = ObjectMapper.Map<GrantedStoreDto, CreateEditGrantedStoreViewModel>(dto);
} }
public virtual async Task<IActionResult> OnPostAsync() public virtual async Task<IActionResult> OnPostAsync()
{ {
var dto = ObjectMapper.Map<CreateEditStoreAssetCategoryViewModel, CreateUpdateStoreAssetCategoryDto>(ViewModel); var dto = ObjectMapper.Map<CreateEditGrantedStoreViewModel, CreateUpdateGrantedStoreDto>(ViewModel);
await _service.UpdateAsync(Id, dto); await _service.UpdateAsync(Id, dto);
return NoContent(); return NoContent();
} }

22
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/Index.cshtml → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/Index.cshtml

@ -5,37 +5,37 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Localization @using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Web.Menus @using EasyAbp.EShop.Plugins.Booking.Web.Menus
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory @using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore
@model IndexModel @model IndexModel
@inject IPageLayout PageLayout @inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L @inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization @inject IAuthorizationService Authorization
@{ @{
PageLayout.Content.Title = L["StoreAssetCategory"].Value; PageLayout.Content.Title = L["GrantedStore"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:StoreAssetCategory"].Value); PageLayout.Content.BreadCrumb.Add(L["Menu:GrantedStore"].Value);
PageLayout.Content.MenuItemName = BookingMenus.StoreAssetCategory; PageLayout.Content.MenuItemName = BookingMenus.GrantedStore;
} }
@section scripts @section scripts
{ {
<abp-script src="/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/index.js" /> <abp-script src="/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.js" />
} }
@section styles @section styles
{ {
<abp-style src="/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/index.css"/> <abp-style src="/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.css"/>
} }
<abp-card> <abp-card>
<abp-card-header> <abp-card-header>
<abp-row> <abp-row>
<abp-column size-md="_6"> <abp-column size-md="_6">
<abp-card-title>@L["StoreAssetCategory"]</abp-card-title> <abp-card-title>@L["GrantedStore"]</abp-card-title>
</abp-column> </abp-column>
<abp-column size-md="_6" class="text-end"> <abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(BookingPermissions.StoreAssetCategory.Create)) @if (await Authorization.IsGrantedAsync(BookingPermissions.GrantedStore.Create))
{ {
<abp-button id="NewStoreAssetCategoryButton" <abp-button id="NewGrantedStoreButton"
text="@L["CreateStoreAssetCategory"].Value" text="@L["CreateGrantedStore"].Value"
icon="plus" icon="plus"
button-type="Primary" /> button-type="Primary" />
} }
@ -43,6 +43,6 @@
</abp-row> </abp-row>
</abp-card-header> </abp-card-header>
<abp-card-body> <abp-card-body>
<abp-table striped-rows="true" id="StoreAssetCategoryTable" class="nowrap"/> <abp-table striped-rows="true" id="GrantedStoreTable" class="nowrap"/>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>

2
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/Index.cshtml.cs → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/Index.cshtml.cs

@ -1,6 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore
{ {
public class IndexModel : BookingPageModel public class IndexModel : BookingPageModel
{ {

22
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/ViewModels/CreateEditStoreAssetCategoryViewModel.cs → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/ViewModels/CreateEditGrantedStoreViewModel.cs

@ -4,9 +4,9 @@ using EasyAbp.Abp.TagHelperPlus.EasySelector;
using EasyAbp.BookingService; using EasyAbp.BookingService;
using EasyAbp.EShop.Stores; using EasyAbp.EShop.Stores;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.ViewModels namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels
{ {
public class CreateEditStoreAssetCategoryViewModel public class CreateEditGrantedStoreViewModel
{ {
[EasySelector( [EasySelector(
getListedDataSourceUrl: StoresConsts.GetStoreListedDataSourceUrl + "?onlyManageable=true", getListedDataSourceUrl: StoresConsts.GetStoreListedDataSourceUrl + "?onlyManageable=true",
@ -14,16 +14,28 @@ namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAss
keyPropertyName: "id", keyPropertyName: "id",
textPropertyName: "name", textPropertyName: "name",
moduleName: EShopStoresRemoteServiceConsts.ModuleName)] moduleName: EShopStoresRemoteServiceConsts.ModuleName)]
[Display(Name = "StoreAssetCategoryStoreId")] [Display(Name = "GrantedStoreStoreId")]
public Guid StoreId { get; set; } public Guid StoreId { get; set; }
[EasySelector(
getListedDataSourceUrl: BookingServiceUrls.GetAssetListedDataSourceUrl,
getSingleDataSourceUrl: BookingServiceUrls.GetAssetSingleDataSourceUrl,
keyPropertyName: "id",
textPropertyName: "name",
moduleName: BookingServiceRemoteServiceConsts.ModuleName)]
[Display(Name = "GrantedStoreAssetId")]
public Guid? AssetId { get; set; }
[EasySelector( [EasySelector(
getListedDataSourceUrl: BookingServiceUrls.GetAssetCategoryListedDataSourceUrl, getListedDataSourceUrl: BookingServiceUrls.GetAssetCategoryListedDataSourceUrl,
getSingleDataSourceUrl: BookingServiceUrls.GetAssetCategorySingleDataSourceUrl, getSingleDataSourceUrl: BookingServiceUrls.GetAssetCategorySingleDataSourceUrl,
keyPropertyName: "id", keyPropertyName: "id",
textPropertyName: "name", textPropertyName: "name",
moduleName: BookingServiceRemoteServiceConsts.ModuleName)] moduleName: BookingServiceRemoteServiceConsts.ModuleName)]
[Display(Name = "StoreAssetCategoryAssetCategoryId")] [Display(Name = "GrantedStoreAssetCategoryId")]
public Guid AssetCategoryId { get; set; } public Guid? AssetCategoryId { get; set; }
[Display(Name = "GrantedStoreAllowAll")]
public bool AllowAll { get; set; }
} }
} }

0
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/index.css → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.css

28
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/index.js → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/GrantedStores/GrantedStore/index.js

@ -2,11 +2,11 @@ $(function () {
var l = abp.localization.getResource('EasyAbpEShopPluginsBooking'); var l = abp.localization.getResource('EasyAbpEShopPluginsBooking');
var service = easyAbp.eShop.plugins.booking.storeAssetCategories.storeAssetCategory; var service = easyAbp.eShop.plugins.booking.grantedStores.grantedStore;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/CreateModal'); var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/GrantedStores/GrantedStore/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/EditModal'); var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/GrantedStores/GrantedStore/EditModal');
var dataTable = $('#StoreAssetCategoryTable').DataTable(abp.libs.datatables.normalizeConfiguration({ var dataTable = $('#GrantedStoreTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true, processing: true,
serverSide: true, serverSide: true,
paging: true, paging: true,
@ -22,16 +22,16 @@ $(function () {
[ [
{ {
text: l('Edit'), text: l('Edit'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.StoreAssetCategory.Update'), visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.GrantedStore.Update'),
action: function (data) { action: function (data) {
editModal.open({ id: data.record.id }); editModal.open({ id: data.record.id });
} }
}, },
{ {
text: l('Delete'), text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.StoreAssetCategory.Delete'), visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.GrantedStore.Delete'),
confirmMessage: function (data) { confirmMessage: function (data) {
return l('StoreAssetCategoryDeletionConfirmationMessage', data.record.id); return l('GrantedStoreDeletionConfirmationMessage', data.record.id);
}, },
action: function (data) { action: function (data) {
service.delete(data.record.id) service.delete(data.record.id)
@ -45,13 +45,21 @@ $(function () {
} }
}, },
{ {
title: l('StoreAssetCategoryStoreId'), title: l('GrantedStoreStoreId'),
data: "storeId" data: "storeId"
}, },
{ {
title: l('StoreAssetCategoryAssetCategoryId'), title: l('GrantedStoreAssetId'),
data: "assetId"
},
{
title: l('GrantedStoreAssetCategoryId'),
data: "assetCategoryId" data: "assetCategoryId"
}, },
{
title: l('GrantedStoreAllowAll'),
data: "allowAll"
},
] ]
})); }));
@ -63,7 +71,7 @@ $(function () {
dataTable.ajax.reload(); dataTable.ajax.reload();
}); });
$('#NewStoreAssetCategoryButton').click(function (e) { $('#NewGrantedStoreButton').click(function (e) {
e.preventDefault(); e.preventDefault();
createModal.open(); createModal.open();
}); });

28
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/StoreAssetCategories/StoreAssetCategory/CreateModal.cshtml.cs

@ -1,28 +0,0 @@
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory
{
public class CreateModalModel : BookingPageModel
{
[BindProperty]
public CreateEditStoreAssetCategoryViewModel ViewModel { get; set; }
private readonly IStoreAssetCategoryAppService _service;
public CreateModalModel(IStoreAssetCategoryAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateEditStoreAssetCategoryViewModel, CreateUpdateStoreAssetCategoryDto>(ViewModel);
await _service.CreateAsync(dto);
return NoContent();
}
}
}

28
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/GrantedStores/GrantedStoreAppServiceTests.cs

@ -0,0 +1,28 @@
using Shouldly;
using System.Threading.Tasks;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{
public class GrantedStoreAppServiceTests : BookingApplicationTestBase
{
private readonly IGrantedStoreAppService _grantedStoreAppService;
public GrantedStoreAppServiceTests()
{
_grantedStoreAppService = GetRequiredService<IGrantedStoreAppService>();
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Act
// Assert
}
*/
}
}

28
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/StoreAssetCategories/StoreAssetCategoryAppServiceTests.cs

@ -1,28 +0,0 @@
using Shouldly;
using System.Threading.Tasks;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories
{
public class StoreAssetCategoryAppServiceTests : BookingApplicationTestBase
{
private readonly IStoreAssetCategoryAppService _storeAssetCategoryAppService;
public StoreAssetCategoryAppServiceTests()
{
_storeAssetCategoryAppService = GetRequiredService<IStoreAssetCategoryAppService>();
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Act
// Assert
}
*/
}
}

6
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/StoreAssetCategories/StoreAssetCategoryDomainTests.cs → plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/GrantedStores/GrantedStoreDomainTests.cs

@ -2,11 +2,11 @@ using System.Threading.Tasks;
using Shouldly; using Shouldly;
using Xunit; using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.StoreAssetCategories namespace EasyAbp.EShop.Plugins.Booking.GrantedStores
{ {
public class StoreAssetCategoryDomainTests : BookingDomainTestBase public class GrantedStoreDomainTests : BookingDomainTestBase
{ {
public StoreAssetCategoryDomainTests() public GrantedStoreDomainTests()
{ {
} }

33
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/GrantedStores/GrantedStoreRepositoryTests.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.GrantedStores;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.GrantedStores
{
public class GrantedStoreRepositoryTests : BookingEntityFrameworkCoreTestBase
{
private readonly IGrantedStoreRepository _grantedStoreRepository;
public GrantedStoreRepositoryTests()
{
_grantedStoreRepository = GetRequiredService<IGrantedStoreRepository>();
}
/*
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
*/
}
}

33
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreAssetCategories/StoreAssetCategoryRepositoryTests.cs

@ -1,33 +0,0 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.StoreAssetCategories;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.StoreAssetCategories
{
public class StoreAssetCategoryRepositoryTests : BookingEntityFrameworkCoreTestBase
{
private readonly IStoreAssetCategoryRepository _storeAssetCategoryRepository;
public StoreAssetCategoryRepositoryTests()
{
_storeAssetCategoryRepository = GetRequiredService<IStoreAssetCategoryRepository>();
}
/*
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
*/
}
}

5422
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/20220604201021_RefactoredToGrantedStore.Designer.cs

File diff suppressed because it is too large

64
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/20220604201021_RefactoredToGrantedStore.cs

@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EShopSample.Migrations
{
public partial class RefactoredToGrantedStore : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EasyAbpEShopPluginsBookingStoreAssetCategories");
migrationBuilder.CreateTable(
name: "EasyAbpEShopPluginsBookingGrantedStores",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
StoreId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AssetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AssetCategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AllowAll = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpEShopPluginsBookingGrantedStores", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EasyAbpEShopPluginsBookingGrantedStores");
migrationBuilder.CreateTable(
name: "EasyAbpEShopPluginsBookingStoreAssetCategories",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AssetCategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
StoreId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EasyAbpEShopPluginsBookingStoreAssetCategories", x => x.Id);
});
}
}
}

100
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/Migrations/EShopSampleDbContextModelSnapshot.cs

@ -797,6 +797,59 @@ namespace EShopSample.Migrations
b.ToTable("EasyAbpEShopPluginsBasketsProductUpdates", (string)null); b.ToTable("EasyAbpEShopPluginsBasketsProductUpdates", (string)null);
}); });
modelBuilder.Entity("EasyAbp.EShop.Plugins.Booking.GrantedStores.GrantedStore", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<bool>("AllowAll")
.HasColumnType("bit");
b.Property<Guid?>("AssetCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("AssetId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("StoreId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("EasyAbpEShopPluginsBookingGrantedStores", (string)null);
});
modelBuilder.Entity("EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory", b => modelBuilder.Entity("EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -971,53 +1024,6 @@ namespace EShopSample.Migrations
b.ToTable("EasyAbpEShopPluginsBookingProductAssetPeriods", (string)null); b.ToTable("EasyAbpEShopPluginsBookingProductAssetPeriods", (string)null);
}); });
modelBuilder.Entity("EasyAbp.EShop.Plugins.Booking.StoreAssetCategories.StoreAssetCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AssetCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("StoreId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("EasyAbpEShopPluginsBookingStoreAssetCategories", (string)null);
});
modelBuilder.Entity("EasyAbp.EShop.Plugins.Coupons.Coupons.Coupon", b => modelBuilder.Entity("EasyAbp.EShop.Plugins.Coupons.Coupons.Coupon", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

Loading…
Cancel
Save