committed by
GitHub
125 changed files with 548 additions and 1403 deletions
@ -1,6 +1,6 @@ |
|||||
// This file is part of BasketClientProxy, you can customize it here
|
// This file is part of BasketClientProxy, you can customize it here
|
||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||
namespace EShopOnAbp.BasketService.ClientProxies; |
namespace EShopOnAbp.BasketService.Services.ClientProxies; |
||||
|
|
||||
public partial class BasketClientProxy |
public partial class BasketClientProxy |
||||
{ |
{ |
||||
@ -1,21 +0,0 @@ |
|||||
using Volo.Abp.Application; |
|
||||
using Volo.Abp.Authorization; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.ObjectExtending; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceDomainSharedModule), |
|
||||
typeof(AbpDddApplicationContractsModule), |
|
||||
typeof(AbpAuthorizationModule), |
|
||||
typeof(AbpObjectExtendingModule) |
|
||||
)] |
|
||||
public class BasketServiceApplicationContractsModule : AbpModule |
|
||||
{ |
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
BasketServiceDtoExtensions.Configure(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,27 +0,0 @@ |
|||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public static class BasketServiceDtoExtensions |
|
||||
{ |
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|
||||
|
|
||||
public static void Configure() |
|
||||
{ |
|
||||
OneTimeRunner.Run(() => |
|
||||
{ |
|
||||
/* You can add extension properties to DTOs |
|
||||
* defined in the depended modules. |
|
||||
* |
|
||||
* Example: |
|
||||
* |
|
||||
* ObjectExtensionManager.Instance |
|
||||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title"); |
|
||||
* |
|
||||
* See the documentation for more: |
|
||||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
|
||||
*/ |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain.Shared\EShopOnAbp.BasketService.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="5.1.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Authorization" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
using EShopOnAbp.BasketService.Localization; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
/* Inherit your application services from this class. |
|
||||
*/ |
|
||||
public abstract class BasketServiceAppService : ApplicationService |
|
||||
{ |
|
||||
protected BasketServiceAppService() |
|
||||
{ |
|
||||
LocalizationResource = typeof(BasketServiceResource); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using AutoMapper; |
|
||||
using EShopOnAbp.CatalogService.Grpc; |
|
||||
using EShopOnAbp.CatalogService.Products; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public class BasketServiceApplicationAutoMapperProfile : Profile |
|
||||
{ |
|
||||
public BasketServiceApplicationAutoMapperProfile() |
|
||||
{ |
|
||||
CreateMap<ProductEto, ProductDto>(); |
|
||||
CreateMap<ProductResponse, ProductDto>(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,41 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using EShopOnAbp.CatalogService; |
|
||||
using EShopOnAbp.CatalogService.Grpc; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Microsoft.Extensions.Options; |
|
||||
using Volo.Abp.Application; |
|
||||
using Volo.Abp.AutoMapper; |
|
||||
using Volo.Abp.Http.Client; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceDomainModule), |
|
||||
typeof(BasketServiceApplicationContractsModule), |
|
||||
typeof(AbpDddApplicationModule), |
|
||||
typeof(AbpAutoMapperModule), |
|
||||
typeof(CatalogServiceHttpApiClientModule) |
|
||||
)] |
|
||||
public class BasketServiceApplicationModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
var configuration = context.Services.GetConfiguration(); |
|
||||
Configure<AbpAutoMapperOptions>(options => |
|
||||
{ |
|
||||
options.AddMaps<BasketServiceApplicationModule>(); |
|
||||
}); |
|
||||
|
|
||||
context.Services.AddGrpcClient<ProductPublic.ProductPublicClient>((services, options) => |
|
||||
{ |
|
||||
var remoteServiceOptions = services.GetRequiredService<IOptionsMonitor<AbpRemoteServiceOptions>>().CurrentValue; |
|
||||
var catalogServiceConfiguration = remoteServiceOptions.RemoteServices.GetConfigurationOrDefault("Catalog"); |
|
||||
var catalogGrpcUrl = catalogServiceConfiguration.GetOrDefault("GrpcUrl"); |
|
||||
|
|
||||
options.Address = new Uri(catalogGrpcUrl); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,31 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net6.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain\EShopOnAbp.BasketService.Domain.csproj" /> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|
||||
<ProjectReference Include="..\..\..\catalog\src\EShopOnAbp.CatalogService.HttpApi.Client\EShopOnAbp.CatalogService.HttpApi.Client.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.1.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Google.Protobuf" Version="3.19.3" /> |
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.42.0" /> |
|
||||
<PackageReference Include="Grpc.Tools" Version="2.42.0" PrivateAssets="All" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Protobuf Include="..\..\..\catalog\src\EShopOnAbp.CatalogService.Application.Contracts\Protos\product.proto" GrpcServices="Client" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,2 +0,0 @@ |
|||||
using System.Runtime.CompilerServices; |
|
||||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.Application.Tests")] |
|
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace EShopOnAbp.BasketService; |
||||
|
|
||||
|
public static class BasketServiceConstants |
||||
|
{ |
||||
|
public static readonly string RemoteServiceName = "Basket"; |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
using EShopOnAbp.BasketService.Localization; |
||||
|
using EShopOnAbp.CatalogService; |
||||
|
using Volo.Abp.Application; |
||||
|
using Volo.Abp.Authorization; |
||||
|
|
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Localization.ExceptionHandling; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Validation; |
||||
|
using Volo.Abp.Validation.Localization; |
||||
|
|
||||
|
namespace EShopOnAbp.BasketService; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(CatalogServiceApplicationContractsModule), |
||||
|
typeof(AbpDddApplicationContractsModule), |
||||
|
typeof(AbpAuthorizationModule), |
||||
|
typeof(AbpValidationModule) |
||||
|
)] |
||||
|
public class BasketServiceContractsModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Add<BasketServiceResource>("en") |
||||
|
.AddBaseTypes(typeof(AbpValidationResource)) |
||||
|
.AddVirtualJson("/Localization/BasketService"); |
||||
|
|
||||
|
options.DefaultResourceType = typeof(BasketServiceResource); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpExceptionLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.MapCodeNamespace("BasketService", typeof(BasketServiceResource)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace EShopOnAbp.BasketService; |
||||
|
|
||||
|
public static class BasketServiceDomainErrorCodes |
||||
|
{ |
||||
|
/* You can add your business exception error codes here, as constants */ |
||||
|
public const string ProductNotFound = "ProductNotFound"; |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Authorization" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Validation" Version="5.1.2" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\..\catalog\src\EShopOnAbp.CatalogService.Application.Contracts\EShopOnAbp.CatalogService.Application.Contracts.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="**\*generate-proxy.json" /> |
||||
|
<Content Remove="**\*generate-proxy.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="Localization\BasketService\*.json" /> |
||||
|
<Content Remove="Localization\BasketService\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class AddProductDto : IHasAnonymousId |
public class AddProductDto : IHasAnonymousId |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class BasketDto |
public class BasketDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System; |
using System; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class BasketItemDto |
public class BasketItemDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System; |
using System; |
||||
|
|
||||
namespace EShopOnAbp.BasketService |
namespace EShopOnAbp.BasketService.Services |
||||
{ |
{ |
||||
public interface IHasAnonymousId |
public interface IHasAnonymousId |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System; |
using System; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class RemoveProductDto : IHasAnonymousId |
public class RemoveProductDto : IHasAnonymousId |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System; |
using System; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class BasketProductUpdatedEto |
public class BasketProductUpdatedEto |
||||
{ |
{ |
||||
@ -1,4 +1,4 @@ |
|||||
namespace EShopOnAbp.BasketService.Permissions |
namespace EShopOnAbp.BasketService.Services.Permissions |
||||
{ |
{ |
||||
public static class BasketServicePermissions |
public static class BasketServicePermissions |
||||
{ |
{ |
||||
@ -1,8 +0,0 @@ |
|||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public static class BasketServiceDomainErrorCodes |
|
||||
{ |
|
||||
/* You can add your business exception error codes here, as constants */ |
|
||||
public const string ProductNotFound = "ProductNotFound"; |
|
||||
} |
|
||||
} |
|
||||
@ -1,47 +0,0 @@ |
|||||
using EShopOnAbp.BasketService.Localization; |
|
||||
using EShopOnAbp.OrderingService; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Localization.ExceptionHandling; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.Validation; |
|
||||
using Volo.Abp.Validation.Localization; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpValidationModule), |
|
||||
typeof(OrderingServiceDomainSharedModule) |
|
||||
)] |
|
||||
public class BasketServiceDomainSharedModule : AbpModule |
|
||||
{ |
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
BasketServiceGlobalFeatureConfigurator.Configure(); |
|
||||
BasketServiceModuleExtensionConfigurator.Configure(); |
|
||||
} |
|
||||
|
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<AbpVirtualFileSystemOptions>(options => |
|
||||
{ |
|
||||
options.FileSets.AddEmbedded<BasketServiceDomainSharedModule>(); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Resources |
|
||||
.Add<BasketServiceResource>("en") |
|
||||
.AddBaseTypes(typeof(AbpValidationResource)) |
|
||||
.AddVirtualJson("/Localization/BasketService"); |
|
||||
|
|
||||
options.DefaultResourceType = typeof(BasketServiceResource); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpExceptionLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.MapCodeNamespace("BasketService", typeof(BasketServiceResource)); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public static class BasketServiceGlobalFeatureConfigurator |
|
||||
{ |
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|
||||
|
|
||||
public static void Configure() |
|
||||
{ |
|
||||
OneTimeRunner.Run(() => |
|
||||
{ |
|
||||
/* You can configure (enable/disable) global features of the used modules here. |
|
||||
* |
|
||||
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! |
|
||||
* |
|
||||
* Please refer to the documentation to lear more about the Global Features System: |
|
||||
* https://docs.abp.io/en/abp/latest/Global-Features
|
|
||||
*/ |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,69 +0,0 @@ |
|||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public static class BasketServiceModuleExtensionConfigurator |
|
||||
{ |
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|
||||
|
|
||||
public static void Configure() |
|
||||
{ |
|
||||
OneTimeRunner.Run(() => |
|
||||
{ |
|
||||
ConfigureExistingProperties(); |
|
||||
ConfigureExtraProperties(); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
private static void ConfigureExistingProperties() |
|
||||
{ |
|
||||
/* You can change max lengths for properties of the |
|
||||
* entities defined in the modules used by your application. |
|
||||
* |
|
||||
* Example: Change user and role name max lengths |
|
||||
|
|
||||
IdentityUserConsts.MaxNameLength = 99; |
|
||||
IdentityRoleConsts.MaxNameLength = 99; |
|
||||
|
|
||||
* Notice: It is not suggested to change property lengths |
|
||||
* unless you really need it. Go with the standard values wherever possible. |
|
||||
* |
|
||||
* If you are using EF Core, you will need to run the add-migration command after your changes. |
|
||||
*/ |
|
||||
} |
|
||||
|
|
||||
private static void ConfigureExtraProperties() |
|
||||
{ |
|
||||
/* You can configure extra properties for the |
|
||||
* entities defined in the modules used by your application. |
|
||||
* |
|
||||
* This class can be used to define these extra properties |
|
||||
* with a high level, easy to use API. |
|
||||
* |
|
||||
* Example: Add a new property to the user entity of the identity module |
|
||||
|
|
||||
ObjectExtensionManager.Instance.Modules() |
|
||||
.ConfigureIdentity(identity => |
|
||||
{ |
|
||||
identity.ConfigureUser(user => |
|
||||
{ |
|
||||
user.AddOrUpdateProperty<string>( //property type: string
|
|
||||
"SocialSecurityNumber", //property name
|
|
||||
property => |
|
||||
{ |
|
||||
//validation rules
|
|
||||
property.Attributes.Add(new RequiredAttribute()); |
|
||||
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); |
|
||||
|
|
||||
//...other configurations for this property
|
|
||||
} |
|
||||
); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
||||
* See the documentation for more: |
|
||||
* https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
|
|
||||
*/ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Validation" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\..\ordering\src\EShopOnAbp.OrderingService.Domain.Shared\EShopOnAbp.OrderingService.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="Localization\BasketService\*.json" /> |
|
||||
<Content Remove="Localization\BasketService\*.json" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,35 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.Extensions.Caching.Distributed; |
|
||||
using Volo.Abp.Caching; |
|
||||
using Volo.Abp.Domain; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceDomainSharedModule), |
|
||||
typeof(AbpDddDomainModule), |
|
||||
typeof(AbpCachingModule) |
|
||||
)] |
|
||||
public class BasketServiceDomainModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<AbpDistributedCacheOptions>(options => |
|
||||
{ |
|
||||
options.CacheConfigurators.Add(cacheName => |
|
||||
{ |
|
||||
if (cacheName == CacheNameAttribute.GetCacheName(typeof(Basket))) |
|
||||
{ |
|
||||
return new DistributedCacheEntryOptions |
|
||||
{ |
|
||||
SlidingExpiration = TimeSpan.FromDays(7) |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
return null; |
|
||||
}); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Domain.Shared\EShopOnAbp.BasketService.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="5.1.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Caching" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,3 +0,0 @@ |
|||||
using System.Runtime.CompilerServices; |
|
||||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.Domain.Tests")] |
|
||||
[assembly:InternalsVisibleToAttribute("EShopOnAbp.BasketService.TestBase")] |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService.Settings |
|
||||
{ |
|
||||
public class BasketServiceSettingDefinitionProvider : SettingDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(ISettingDefinitionContext context) |
|
||||
{ |
|
||||
//Define your own settings here. Example:
|
|
||||
//context.Add(new SettingDefinition(BasketServiceSettings.MySetting1));
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
namespace EShopOnAbp.BasketService.Settings |
|
||||
{ |
|
||||
public static class BasketServiceSettings |
|
||||
{ |
|
||||
private const string Prefix = "BasketService"; |
|
||||
|
|
||||
//Add your own setting names here. Example:
|
|
||||
//public const string MySetting1 = Prefix + ".MySetting1";
|
|
||||
} |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Http.Client; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceApplicationContractsModule), |
|
||||
typeof(AbpHttpClientModule) |
|
||||
)] |
|
||||
public class BasketServiceHttpApiClientModule : AbpModule |
|
||||
{ |
|
||||
public const string RemoteServiceName = "Basket"; |
|
||||
|
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddStaticHttpClientProxies( |
|
||||
typeof(BasketServiceApplicationContractsModule).Assembly, |
|
||||
RemoteServiceName |
|
||||
); |
|
||||
|
|
||||
Configure<AbpVirtualFileSystemOptions>(options => |
|
||||
{ |
|
||||
options.FileSets.AddEmbedded<BasketServiceHttpApiClientModule>(); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Http.Client" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="**\*generate-proxy.json" /> |
|
||||
<Content Remove="**\*generate-proxy.json" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,108 +0,0 @@ |
|||||
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|
||||
using EShopOnAbp.Shared.Hosting.Microservices; |
|
||||
using Microsoft.AspNetCore.Builder; |
|
||||
using Microsoft.AspNetCore.Cors; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Microsoft.Extensions.Hosting; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Microsoft.Extensions.Configuration; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
using Volo.Abp.AspNetCore.Mvc.AntiForgery; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceHttpApiModule), |
|
||||
typeof(BasketServiceApplicationModule), |
|
||||
typeof(EShopOnAbpSharedHostingMicroservicesModule) |
|
||||
)] |
|
||||
public class BasketServiceHttpApiHostModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true; |
|
||||
|
|
||||
var configuration = context.Services.GetConfiguration(); |
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
||||
|
|
||||
JwtBearerConfigurationHelper.Configure(context, "BasketService"); |
|
||||
|
|
||||
SwaggerWithAuthConfigurationHelper.Configure( |
|
||||
context: context, |
|
||||
authority: configuration["AuthServer:Authority"], |
|
||||
scopes: new |
|
||||
Dictionary<string, string> /* Requested scopes for authorization code request and descriptions for swagger UI only */ |
|
||||
{ |
|
||||
{"BasketService", "Basket Service API"} |
|
||||
}, |
|
||||
apiTitle: "Basket Service API" |
|
||||
); |
|
||||
|
|
||||
context.Services.AddCors(options => |
|
||||
{ |
|
||||
options.AddDefaultPolicy(builder => |
|
||||
{ |
|
||||
builder |
|
||||
.WithOrigins( |
|
||||
configuration["App:CorsOrigins"] |
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
|
||||
.Select(o => o.Trim().RemovePostFix("/")) |
|
||||
.ToArray() |
|
||||
) |
|
||||
.WithAbpExposedHeaders() |
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|
||||
.AllowAnyHeader() |
|
||||
.AllowAnyMethod() |
|
||||
.AllowCredentials(); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpAspNetCoreMvcOptions>(options => |
|
||||
{ |
|
||||
options.ConventionalControllers.Create( |
|
||||
typeof(BasketServiceApplicationModule).Assembly, opts => |
|
||||
{ |
|
||||
opts.RootPath = "basket"; |
|
||||
opts.RemoteServiceName = "Basket"; |
|
||||
}); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; }); |
|
||||
} |
|
||||
|
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
||||
{ |
|
||||
var app = context.GetApplicationBuilder(); |
|
||||
var env = context.GetEnvironment(); |
|
||||
|
|
||||
if (env.IsDevelopment()) |
|
||||
{ |
|
||||
app.UseDeveloperExceptionPage(); |
|
||||
} |
|
||||
|
|
||||
app.UseCorrelationId(); |
|
||||
app.UseCors(); |
|
||||
app.UseAbpRequestLocalization(); |
|
||||
app.UseStaticFiles(); |
|
||||
app.UseRouting(); |
|
||||
app.UseAuthentication(); |
|
||||
app.UseAbpClaimsMap(); |
|
||||
app.UseAuthorization(); |
|
||||
app.UseSwagger(); |
|
||||
app.UseSwaggerUI(options => |
|
||||
{ |
|
||||
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
|
||||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Basket Service API"); |
|
||||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |
|
||||
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); |
|
||||
}); |
|
||||
app.UseAbpSerilogEnrichers(); |
|
||||
app.UseAuditing(); |
|
||||
app.UseUnitOfWork(); |
|
||||
app.UseConfiguredEndpoints(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService.Controllers |
|
||||
{ |
|
||||
public class HomeController : AbpController |
|
||||
{ |
|
||||
public ActionResult Index() |
|
||||
{ |
|
||||
return Redirect("~/swagger"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net6.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences> |
|
||||
<UserSecretsId>EShopOnAbp.BasketService-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application\EShopOnAbp.BasketService.Application.csproj" /> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.HttpApi\EShopOnAbp.BasketService.HttpApi.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting.Microservices\EShopOnAbp.Shared.Hosting.Microservices.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Compile Remove="Logs\**" /> |
|
||||
<Content Remove="Logs\**" /> |
|
||||
<EmbeddedResource Remove="Logs\**" /> |
|
||||
<None Remove="Logs\**" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,2 +0,0 @@ |
|||||
{ |
|
||||
} |
|
||||
@ -1,2 +0,0 @@ |
|||||
{ |
|
||||
} |
|
||||
@ -1 +0,0 @@ |
|||||
{"KeyId":"5eb863b25811a7099f9bc925c0fdf680","Parameters":{"D":"gqn7NAeMkug4twJJHFz/qPseDzQCx7R+6Maj649xrG4vPsMANV9mfR78Er2SuHUS0ZihM2MQEILI5Sf41Uuubv8swCNSE3Dw7GQrBIbTAJ7BZKbQMVgtGkMDtHrtri6d9cOi3EOTSJINICk9r80M49oBMOZihEKascfBSIUYVQvWLEMYfryEiDeFUPbobr10OxF5tZ1unvEKgZe190BdNKWQuFhJelcgsZumjEYNsOz5DHrK73WLhfTy01DmsTKx8i1XVnLtq6W89MqAhMZP9QO9Vj8lR0ANnmdOsY6hJfwUbXiI36t4V9rAZvXR5ESorjb4mnXzT6QPuOfy1fbdSQ==","DP":"ItYIpEqw6aDjDc/swDifUe0Dq6yl4yim3UyQ4B9NBPQR5M6b7D3vbCnvwql4zJK4s+0N4lRViBtkF+20Td1yc2v8S+THCYZCVxCf2e9Q7Ff/sKecJ9/JmdzHkztCfs0xb+4X3CPEQP+JIYtMGmwOLQgE5XgmUYKr0ahZDhYTCwE=","DQ":"v35mgxfyF/nwnWwWlR9cF3mg0v7SyPfKkwdxGaVnGH6G8nPWpPlO+zueflA5QDXEwGtk/1k3PAzI/OLUwJiKBubx/UMhsqt5+/bKTrFDNHxLANCvGNZggMZIzFZBYRucuXRZbiBe5qpCkKkniUct7w6jd/V1mnsESiJZ7btcxU0=","Exponent":"AQAB","InverseQ":"Vbg2a+wtaYvhTV8AzqJsVvaz0kfC4HFbmwEgA8+BAbS3GEoS3RHFSfB3DHndpnNihIg72DctDNLmV2GMMiTu18uyI+7AUaYNR836fByxptfyhPtSQfw4kINZ3V0GWKJGzzZ5NAOct4/FpRl8xliHetayCfUIuK9jwk0z9i6V6bA=","Modulus":"xlzmN1sBi2V1971MsPD5MTND9dAGncIzYqxa3H+9jx1mNDivY6JgKijUWm5a3D2Y1UPMB3kx6qUf3iH6pZHjq5bk938qRhxrPy9muW55U03HTiW4V5/ga0+OqXj5Tj4lz+29OiQHPErxLRgfXT+WBgrGb75ElzkHajKpJnPgzAZuarlUCwupJNQlav/crwOFrgkhGsnaOW13M8htiSLZozw5lxkbhYIei7YTTQZ3l6rVH1dPL8CvzRJJOTwbnU8k0sUmWiuOhrLzuinlr6uuOTocAVgbj943/witVFtN5B0yhetxEVgFCwxRDTOO1EKVHFtCiAyZBUOlK4gwZ+SbGQ==","P":"7dFfbAkZSdx/ieSMYJHoY1DKC4dLg80RObEEmuJ72MaVJLTtFuBPoRpYOrMUNuupIyPjZZsW8fHRlPRhKW7xFv+Q2aDudh1UaJzFZs3xYKoiXTU/j0B3TB3nrifVLMqsS+8kHOWOojwA4dMjI6GCYCpKmYVvMOE1cuJrQ9EYxoM=","Q":"1YdN8mLchLVoTEwD34Pi3T2U7EjjBDgDCzhjl7x5FBG73TyKMz1n7/KXkXcJ2rqIAsnLqCWpYUeRcWl+IQEQxFKoMwkvmQ33lRkOE0SBZ+FnUAMivRyxOD5qM9z4ccqx0ga4ZRgb1lR85f7VYtMSfIosOuSFxWAbV1e29utxhTM="}} |
|
||||
@ -1,32 +0,0 @@ |
|||||
using EShopOnAbp.BasketService.Localization; |
|
||||
using Localization.Resources.AbpUi; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(BasketServiceApplicationContractsModule), |
|
||||
typeof(AbpAspNetCoreMvcModule) |
|
||||
)] |
|
||||
public class BasketServiceHttpApiModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
ConfigureLocalization(); |
|
||||
} |
|
||||
|
|
||||
private void ConfigureLocalization() |
|
||||
{ |
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Resources |
|
||||
.Get<BasketServiceResource>() |
|
||||
.AddBaseTypes( |
|
||||
typeof(AbpUiResource) |
|
||||
); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using EShopOnAbp.BasketService.Localization; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService.Controllers |
|
||||
{ |
|
||||
/* Inherit your controllers from this class. |
|
||||
*/ |
|
||||
public abstract class BasketServiceController : AbpControllerBase |
|
||||
{ |
|
||||
protected BasketServiceController() |
|
||||
{ |
|
||||
LocalizationResource = typeof(BasketServiceResource); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net6.0</TargetFramework> |
|
||||
<RootNamespace>EShopOnAbp.BasketService</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\EShopOnAbp.BasketService.Application.Contracts\EShopOnAbp.BasketService.Application.Contracts.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="5.1.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -0,0 +1,14 @@ |
|||||
|
using AutoMapper; |
||||
|
using EShopOnAbp.CatalogService.Grpc; |
||||
|
using EShopOnAbp.CatalogService.Products; |
||||
|
|
||||
|
namespace EShopOnAbp.BasketService; |
||||
|
|
||||
|
public class BasketServiceApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
public BasketServiceApplicationAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ProductEto, ProductDto>(); |
||||
|
CreateMap<ProductResponse, ProductDto>(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,190 @@ |
|||||
|
using EShopOnAbp.BasketService.Entities; |
||||
|
using EShopOnAbp.CatalogService.Grpc; |
||||
|
using EShopOnAbp.Shared.Hosting.AspNetCore; |
||||
|
using EShopOnAbp.Shared.Hosting.Microservices; |
||||
|
using Microsoft.AspNetCore.Cors; |
||||
|
using Microsoft.Extensions.Caching.Distributed; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc.AntiForgery; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.Domain; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace EShopOnAbp.BasketService |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpAspNetCoreMvcModule), |
||||
|
typeof(AbpHttpClientModule), |
||||
|
typeof(AbpAutoMapperModule), |
||||
|
typeof(AbpCachingModule), |
||||
|
typeof(AbpDddApplicationModule), |
||||
|
typeof(AbpDddDomainModule), |
||||
|
typeof(BasketServiceContractsModule), |
||||
|
typeof(EShopOnAbpSharedHostingMicroservicesModule) |
||||
|
)] |
||||
|
public class BasketServiceModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
||||
|
|
||||
|
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = hostingEnvironment.IsDevelopment(); |
||||
|
|
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
ConfigureAutoMapper(); |
||||
|
ConfigureAspNetCoreRouting(context); |
||||
|
ConfigureGrpc(context); |
||||
|
ConfigureDistributedCache(); |
||||
|
ConfigureVirtualFileSystem(); |
||||
|
ConfigureAuthentication(context, configuration); |
||||
|
ConfigureSwagger(context, configuration); |
||||
|
ConfigureAutoApiControllers(); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureAspNetCoreRouting(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpAspNetCoreMvcOptions>(options => |
||||
|
{ |
||||
|
options.ConventionalControllers.Create(typeof(BasketServiceModule).Assembly, opts => |
||||
|
{ |
||||
|
opts.RootPath = "basket"; |
||||
|
opts.RemoteServiceName = BasketServiceConstants.RemoteServiceName; |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
||||
|
{ |
||||
|
var app = context.GetApplicationBuilder(); |
||||
|
var env = context.GetEnvironment(); |
||||
|
|
||||
|
if (env.IsDevelopment()) |
||||
|
{ |
||||
|
app.UseDeveloperExceptionPage(); |
||||
|
} |
||||
|
|
||||
|
app.UseCorrelationId(); |
||||
|
app.UseCors(); |
||||
|
app.UseAbpRequestLocalization(); |
||||
|
app.UseStaticFiles(); |
||||
|
app.UseRouting(); |
||||
|
app.UseAuthentication(); |
||||
|
app.UseAbpClaimsMap(); |
||||
|
app.UseAuthorization(); |
||||
|
app.UseSwagger(); |
||||
|
app.UseSwaggerUI(options => |
||||
|
{ |
||||
|
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
||||
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Basket Service API"); |
||||
|
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |
||||
|
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); |
||||
|
}); |
||||
|
app.UseAbpSerilogEnrichers(); |
||||
|
app.UseAuditing(); |
||||
|
app.UseUnitOfWork(); |
||||
|
app.UseConfiguredEndpoints(); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) |
||||
|
{ |
||||
|
SwaggerWithAuthConfigurationHelper.Configure( |
||||
|
context: context, |
||||
|
authority: configuration["AuthServer:Authority"], |
||||
|
scopes: new |
||||
|
Dictionary<string, string> /* Requested scopes for authorization code request and descriptions for swagger UI only */ |
||||
|
{ |
||||
|
{"BasketService", "Basket Service API"} |
||||
|
}, |
||||
|
apiTitle: "Basket Service API" |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) |
||||
|
{ |
||||
|
JwtBearerConfigurationHelper.Configure(context, "BasketService"); |
||||
|
|
||||
|
context.Services.AddCors(options => |
||||
|
{ |
||||
|
options.AddDefaultPolicy(builder => |
||||
|
{ |
||||
|
builder |
||||
|
.WithOrigins( |
||||
|
configuration["App:CorsOrigins"] |
||||
|
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
||||
|
.Select(o => o.Trim().RemovePostFix("/")) |
||||
|
.ToArray() |
||||
|
) |
||||
|
.WithAbpExposedHeaders() |
||||
|
.SetIsOriginAllowedToAllowWildcardSubdomains() |
||||
|
.AllowAnyHeader() |
||||
|
.AllowAnyMethod() |
||||
|
.AllowCredentials(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; }); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureAutoApiControllers() |
||||
|
{ |
||||
|
Configure<AbpAspNetCoreMvcOptions>(options => |
||||
|
{ |
||||
|
options.ConventionalControllers.Create(typeof(BasketServiceModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureGrpc(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddGrpcClient<ProductPublic.ProductPublicClient>((services, options) => |
||||
|
{ |
||||
|
var remoteServiceOptions = services.GetRequiredService<IOptionsMonitor<AbpRemoteServiceOptions>>().CurrentValue; |
||||
|
var catalogServiceConfiguration = remoteServiceOptions.RemoteServices.GetConfigurationOrDefault("Catalog"); |
||||
|
var catalogGrpcUrl = catalogServiceConfiguration.GetOrDefault("GrpcUrl"); |
||||
|
|
||||
|
options.Address = new Uri(catalogGrpcUrl); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureAutoMapper() |
||||
|
{ |
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddMaps<BasketServiceModule>(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureDistributedCache() |
||||
|
{ |
||||
|
Configure<AbpDistributedCacheOptions>(options => |
||||
|
{ |
||||
|
options.CacheConfigurators.Add(cacheName => |
||||
|
{ |
||||
|
if (cacheName == CacheNameAttribute.GetCacheName(typeof(Basket))) |
||||
|
{ |
||||
|
return new DistributedCacheEntryOptions |
||||
|
{ |
||||
|
SlidingExpiration = TimeSpan.FromDays(7) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureVirtualFileSystem() |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<BasketServiceModule>(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace EShopOnAbp.BasketService.Controllers; |
||||
|
|
||||
|
public class HomeController : AbpController |
||||
|
{ |
||||
|
public ActionResult Index() |
||||
|
{ |
||||
|
return Redirect("~/swagger"); |
||||
|
} |
||||
|
} |
||||
@ -1,4 +1,4 @@ |
|||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 |
FROM mcr.microsoft.com/dotnet/aspnet:6.0 |
||||
COPY bin/Release/net6.0/publish/ app/ |
COPY bin/Release/net6.0/publish/ app/ |
||||
WORKDIR /app |
WORKDIR /app |
||||
ENTRYPOINT ["dotnet", "EShopOnAbp.BasketService.HttpApi.Host.dll"] |
ENTRYPOINT ["dotnet", "EShopOnAbp.BasketService.dll"] |
||||
@ -0,0 +1,46 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<Nullable>enable</Nullable> |
||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Google.Protobuf" Version="3.19.3" /> |
||||
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.42.0" /> |
||||
|
<PackageReference Include="Grpc.Tools" Version="2.42.0" PrivateAssets="All" /> |
||||
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0" /> |
||||
|
|
||||
|
<PackageReference Include="Volo.Abp.Http.Client" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Caching" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="5.1.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Application" Version="5.1.2" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\EShopOnAbp.BasketService.Contracts\EShopOnAbp.BasketService.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting.Microservices\EShopOnAbp.Shared.Hosting.Microservices.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="**\*generate-proxy.json" /> |
||||
|
<Content Remove="**\*generate-proxy.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Protobuf Include="..\..\..\catalog\src\EShopOnAbp.CatalogService.Application.Contracts\Protos\product.proto" GrpcServices="Client" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Compile Remove="Logs\**" /> |
||||
|
<Content Remove="Logs\**" /> |
||||
|
<EmbeddedResource Remove="Logs\**" /> |
||||
|
<None Remove="Logs\**" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -1,9 +1,6 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Volo.Abp.Domain.Entities; |
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Entities; |
||||
|
|
||||
public class Basket : AggregateRoot<Guid> |
public class Basket : AggregateRoot<Guid> |
||||
{ |
{ |
||||
@ -1,6 +1,4 @@ |
|||||
using System; |
namespace EShopOnAbp.BasketService.Entities; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
|
||||
|
|
||||
public class BasketItem |
public class BasketItem |
||||
{ |
{ |
||||
@ -1,8 +1,6 @@ |
|||||
using System; |
using Volo.Abp.Caching; |
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Caching; |
|
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Entities; |
||||
|
|
||||
public class BasketRepository : IBasketRepository |
public class BasketRepository : IBasketRepository |
||||
{ |
{ |
||||
@ -1,8 +1,6 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories; |
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Entities; |
||||
|
|
||||
public interface IBasketRepository : IRepository |
public interface IBasketRepository : IRepository |
||||
{ |
{ |
||||
@ -1,10 +1,9 @@ |
|||||
using EShopOnAbp.OrderingService.Orders; |
using EShopOnAbp.OrderingService.Orders; |
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.EventBus.Distributed; |
using Volo.Abp.EventBus.Distributed; |
||||
using Volo.Abp.Uow; |
using Volo.Abp.Uow; |
||||
|
|
||||
namespace EShopOnAbp.BasketService.Orders |
namespace EShopOnAbp.BasketService.Entities.Orders |
||||
{ |
{ |
||||
public class OrderPlacedEventHandler : IDistributedEventHandler<OrderPlacedEto>, ITransientDependency |
public class OrderPlacedEventHandler : IDistributedEventHandler<OrderPlacedEto>, ITransientDependency |
||||
{ |
{ |
||||
@ -1,27 +1,27 @@ |
|||||
{ |
{ |
||||
"iisSettings": { |
"iisSettings": { |
||||
"windowsAuthentication": false, |
"windowsAuthentication": false, |
||||
"anonymousAuthentication": true, |
"anonymousAuthentication": true, |
||||
"iisExpress": { |
"iisExpress": { |
||||
"applicationUrl": "https://localhost:44355", |
"applicationUrl": "https://localhost:44355" |
||||
"sslPort": 44355 |
|
||||
} |
} |
||||
}, |
}, |
||||
"profiles": { |
"profiles": { |
||||
"IIS Express": { |
"EShopOnAbp.BasketService": { |
||||
"commandName": "IISExpress", |
"commandName": "Project", |
||||
|
"dotnetRunMessages": true, |
||||
"launchBrowser": true, |
"launchBrowser": true, |
||||
|
"applicationUrl": "https://localhost:44355", |
||||
"environmentVariables": { |
"environmentVariables": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
} |
} |
||||
}, |
}, |
||||
"EShopOnAbp.BasketService.HttpApi.Host": { |
"IIS Express": { |
||||
"commandName": "Project", |
"commandName": "IISExpress", |
||||
"launchBrowser": true, |
"launchBrowser": true, |
||||
"applicationUrl": "https://localhost:44355", |
|
||||
"environmentVariables": { |
"environmentVariables": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,13 +1,11 @@ |
|||||
using System; |
using EShopOnAbp.CatalogService.Products; |
||||
using System.Threading.Tasks; |
|
||||
using EShopOnAbp.CatalogService.Products; |
|
||||
using Volo.Abp.Caching; |
using Volo.Abp.Caching; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.Domain.Entities.Events.Distributed; |
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
using Volo.Abp.EventBus.Distributed; |
using Volo.Abp.EventBus.Distributed; |
||||
using Volo.Abp.ObjectMapping; |
using Volo.Abp.ObjectMapping; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class BasketProductEventHandler : IDistributedEventHandler<EntityUpdatedEto<ProductEto>>, ITransientDependency |
public class BasketProductEventHandler : IDistributedEventHandler<EntityUpdatedEto<ProductEto>>, ITransientDependency |
||||
{ |
{ |
||||
@ -1,14 +1,11 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using EShopOnAbp.CatalogService.Grpc; |
using EShopOnAbp.CatalogService.Grpc; |
||||
using EShopOnAbp.CatalogService.Products; |
using EShopOnAbp.CatalogService.Products; |
||||
using Microsoft.Extensions.Logging; |
|
||||
using Volo.Abp; |
using Volo.Abp; |
||||
using Volo.Abp.ObjectMapping; |
|
||||
using Volo.Abp.Caching; |
using Volo.Abp.Caching; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
|
||||
namespace EShopOnAbp.BasketService; |
namespace EShopOnAbp.BasketService.Services; |
||||
|
|
||||
public class BasketProductService : IBasketProductService, ITransientDependency |
public class BasketProductService : IBasketProductService, ITransientDependency |
||||
{ |
{ |
||||
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"Logging": { |
||||
|
"LogLevel": { |
||||
|
"Default": "Information", |
||||
|
"Microsoft.AspNetCore": "Warning" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,7 +0,0 @@ |
|||||
namespace EShopOnAbp.BasketService |
|
||||
{ |
|
||||
public abstract class BasketServiceApplicationTestBase : BasketServiceTestBase<BasketServiceApplicationTestModule> |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue