Moved namespaces to globalusing shopping aggregator
This commit is contained in:
		
							parent
							
								
									7b1764261e
								
							
						
					
					
						commit
						a12fbcaf09
					
				| @ -1,11 +1,8 @@ | |||||||
| using System.Collections.Generic; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config | public class UrlsConfig | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|     public class UrlsConfig |  | ||||||
|     { |  | ||||||
| 
 |  | ||||||
|     public class CatalogOperations |     public class CatalogOperations | ||||||
|     { |     { | ||||||
|         // grpc call under REST must go trough port 80 |         // grpc call under REST must go trough port 80 | ||||||
| @ -40,6 +37,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config | |||||||
|     public string GrpcCatalog { get; set; } |     public string GrpcCatalog { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string GrpcOrdering { get; set; } |     public string GrpcOrdering { get; set; } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,19 +1,10 @@ | |||||||
| using Microsoft.AspNetCore.Authorization; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers; | ||||||
| using Microsoft.AspNetCore.Mvc; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; |  | ||||||
| using System; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Net; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | [Route("api/v1/[controller]")]
 | ||||||
|  | [Authorize] | ||||||
|  | [ApiController] | ||||||
|  | public class BasketController : ControllerBase | ||||||
| { | { | ||||||
|     [Route("api/v1/[controller]")]
 |  | ||||||
|     [Authorize] |  | ||||||
|     [ApiController] |  | ||||||
|     public class BasketController : ControllerBase |  | ||||||
|     { |  | ||||||
|     private readonly ICatalogService _catalog; |     private readonly ICatalogService _catalog; | ||||||
|     private readonly IBasketService _basket; |     private readonly IBasketService _basket; | ||||||
| 
 | 
 | ||||||
| @ -160,5 +151,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | |||||||
| 
 | 
 | ||||||
|         return Ok(); |         return Ok(); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,14 +1,11 @@ | |||||||
| using Microsoft.AspNetCore.Mvc; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | [Route("")] | ||||||
|  | public class HomeController : Controller | ||||||
| { | { | ||||||
|     [Route("")] |  | ||||||
|     public class HomeController : Controller |  | ||||||
|     { |  | ||||||
|     [HttpGet()] |     [HttpGet()] | ||||||
|     public IActionResult Index() |     public IActionResult Index() | ||||||
|     { |     { | ||||||
|         return new RedirectResult("~/swagger"); |         return new RedirectResult("~/swagger"); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,17 +1,10 @@ | |||||||
| using Microsoft.AspNetCore.Authorization; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers; | ||||||
| using Microsoft.AspNetCore.Mvc; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; |  | ||||||
| using System.Net; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | [Route("api/v1/[controller]")]
 | ||||||
|  | [Authorize] | ||||||
|  | [ApiController] | ||||||
|  | public class OrderController : ControllerBase | ||||||
| { | { | ||||||
|     [Route("api/v1/[controller]")]
 |  | ||||||
|     [Authorize] |  | ||||||
|     [ApiController] |  | ||||||
|     public class OrderController : ControllerBase |  | ||||||
|     { |  | ||||||
|     private readonly IBasketService _basketService; |     private readonly IBasketService _basketService; | ||||||
|     private readonly IOrderingService _orderingService; |     private readonly IOrderingService _orderingService; | ||||||
|     public OrderController(IBasketService basketService, IOrderingService orderingService) |     public OrderController(IBasketService basketService, IOrderingService orderingService) | ||||||
| @ -40,5 +33,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | |||||||
| 
 | 
 | ||||||
|         return await _orderingService.GetOrderDraftAsync(basket); |         return await _orderingService.GetOrderDraftAsync(basket); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,10 +1,4 @@ | |||||||
| using Microsoft.AspNetCore.Authorization; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters | ||||||
| using Microsoft.OpenApi.Models; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerGen; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters |  | ||||||
| { | { | ||||||
|     namespace Basket.API.Infrastructure.Filters |     namespace Basket.API.Infrastructure.Filters | ||||||
|     { |     { | ||||||
| @ -36,4 +30,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
| @ -1,12 +1,7 @@ | |||||||
| using Grpc.Core; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure; | ||||||
| using Grpc.Core.Interceptors; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure | public class GrpcExceptionInterceptor : Interceptor | ||||||
| { | { | ||||||
|     public class GrpcExceptionInterceptor : Interceptor |  | ||||||
|     { |  | ||||||
|     private readonly ILogger<GrpcExceptionInterceptor> _logger; |     private readonly ILogger<GrpcExceptionInterceptor> _logger; | ||||||
| 
 | 
 | ||||||
|     public GrpcExceptionInterceptor(ILogger<GrpcExceptionInterceptor> logger) |     public GrpcExceptionInterceptor(ILogger<GrpcExceptionInterceptor> logger) | ||||||
| @ -37,5 +32,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure | |||||||
|             return default; |             return default; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,16 +1,8 @@ | |||||||
| using Microsoft.AspNetCore.Authentication; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure; | ||||||
| using Microsoft.AspNetCore.Http; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Net.Http; |  | ||||||
| using System.Net.Http.Headers; |  | ||||||
| using System.Threading; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure | public class HttpClientAuthorizationDelegatingHandler | ||||||
| { |  | ||||||
|     public class HttpClientAuthorizationDelegatingHandler |  | ||||||
|         : DelegatingHandler |         : DelegatingHandler | ||||||
|     { | { | ||||||
|     private readonly IHttpContextAccessor _httpContextAccessor; |     private readonly IHttpContextAccessor _httpContextAccessor; | ||||||
| 
 | 
 | ||||||
|     public HttpClientAuthorizationDelegatingHandler(IHttpContextAccessor httpContextAccessor) |     public HttpClientAuthorizationDelegatingHandler(IHttpContextAccessor httpContextAccessor) | ||||||
| @ -45,5 +37,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure | |||||||
|         return await _httpContextAccessor.HttpContext |         return await _httpContextAccessor.HttpContext | ||||||
|             .GetTokenAsync(ACCESS_TOKEN); |             .GetTokenAsync(ACCESS_TOKEN); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| { |  | ||||||
| 
 | 
 | ||||||
|     public class AddBasketItemRequest | public class AddBasketItemRequest | ||||||
|     { | { | ||||||
|     public int CatalogItemId { get; set; } |     public int CatalogItemId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string BasketId { get; set; } |     public string BasketId { get; set; } | ||||||
| @ -13,6 +12,5 @@ | |||||||
|     { |     { | ||||||
|         Quantity = 1; |         Quantity = 1; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,10 +1,7 @@ | |||||||
| using System.Collections.Generic; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | public class BasketData | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     public class BasketData |  | ||||||
|     { |  | ||||||
|     public string BuyerId { get; set; } |     public string BuyerId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public List<BasketDataItem> Items { get; set; } = new List<BasketDataItem>(); |     public List<BasketDataItem> Items { get; set; } = new List<BasketDataItem>(); | ||||||
| @ -17,6 +14,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | |||||||
|     { |     { | ||||||
|         BuyerId = buyerId; |         BuyerId = buyerId; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| { |  | ||||||
| 
 | 
 | ||||||
|     public class BasketDataItem | public class BasketDataItem | ||||||
|     { | { | ||||||
|     public string Id { get; set; } |     public string Id { get; set; } | ||||||
| 
 | 
 | ||||||
|     public int ProductId { get; set; } |     public int ProductId { get; set; } | ||||||
| @ -16,6 +15,4 @@ | |||||||
|     public int Quantity { get; set; } |     public int Quantity { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string PictureUrl { get; set; } |     public string PictureUrl { get; set; } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| { |  | ||||||
| 
 | 
 | ||||||
|     public class CatalogItem | public class CatalogItem | ||||||
|     { | { | ||||||
|     public int Id { get; set; } |     public int Id { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string Name { get; set; } |     public string Name { get; set; } | ||||||
| @ -10,6 +9,6 @@ | |||||||
|     public decimal Price { get; set; } |     public decimal Price { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string PictureUri { get; set; } |     public string PictureUri { get; set; } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,11 +1,7 @@ | |||||||
| using System; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| using System.Collections.Generic; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | public class OrderData | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     public class OrderData |  | ||||||
|     { |  | ||||||
|     public string OrderNumber { get; set; } |     public string OrderNumber { get; set; } | ||||||
| 
 | 
 | ||||||
|     public DateTime Date { get; set; } |     public DateTime Date { get; set; } | ||||||
| @ -43,6 +39,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | |||||||
|     public string Buyer { get; set; } |     public string Buyer { get; set; } | ||||||
| 
 | 
 | ||||||
|     public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>(); |     public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>(); | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| { |  | ||||||
| 
 | 
 | ||||||
|     public class OrderItemData | public class OrderItemData | ||||||
|     { | { | ||||||
|     public int ProductId { get; set; } |     public int ProductId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string ProductName { get; set; } |     public string ProductName { get; set; } | ||||||
| @ -14,6 +13,4 @@ | |||||||
|     public int Units { get; set; } |     public int Units { get; set; } | ||||||
| 
 | 
 | ||||||
|     public string PictureUrl { get; set; } |     public string PictureUrl { get; set; } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| { |  | ||||||
| 
 | 
 | ||||||
|     public class UpdateBasketItemData | public class UpdateBasketItemData | ||||||
|     { | { | ||||||
|     public string BasketItemId { get; set; } |     public string BasketItemId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public int NewQty { get; set; } |     public int NewQty { get; set; } | ||||||
| @ -11,6 +10,4 @@ | |||||||
|     { |     { | ||||||
|         NewQty = 0; |         NewQty = 0; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,10 +1,7 @@ | |||||||
| using System.Collections.Generic; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | public class UpdateBasketItemsRequest | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     public class UpdateBasketItemsRequest |  | ||||||
|     { |  | ||||||
|     public string BasketId { get; set; } |     public string BasketId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public ICollection<UpdateBasketItemData> Updates { get; set; } |     public ICollection<UpdateBasketItemData> Updates { get; set; } | ||||||
| @ -13,6 +10,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | |||||||
|     { |     { | ||||||
|         Updates = new List<UpdateBasketItemData>(); |         Updates = new List<UpdateBasketItemData>(); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,13 +1,8 @@ | |||||||
| using System.Collections.Generic; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | public class UpdateBasketRequest | ||||||
| { | { | ||||||
| 
 |  | ||||||
|     public class UpdateBasketRequest |  | ||||||
|     { |  | ||||||
|     public string BuyerId { get; set; } |     public string BuyerId { get; set; } | ||||||
| 
 | 
 | ||||||
|     public IEnumerable<UpdateBasketRequestItemData> Items { get; set; } |     public IEnumerable<UpdateBasketRequestItemData> Items { get; set; } | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,11 +1,10 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | ||||||
|  | 
 | ||||||
|  | public class UpdateBasketRequestItemData | ||||||
| { | { | ||||||
|     public class UpdateBasketRequestItemData |  | ||||||
|     { |  | ||||||
|     public string Id { get; set; }          // Basket id |     public string Id { get; set; }          // Basket id | ||||||
| 
 | 
 | ||||||
|     public int ProductId { get; set; }      // Catalog item id |     public int ProductId { get; set; }      // Catalog item id | ||||||
| 
 | 
 | ||||||
|     public int Quantity { get; set; }       // Quantity |     public int Quantity { get; set; }       // Quantity | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,9 +1,4 @@ | |||||||
| using Microsoft.AspNetCore; | BuildWebHost(args).Run(); | ||||||
| using Microsoft.AspNetCore.Hosting; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator; |  | ||||||
| using Serilog; |  | ||||||
| 
 |  | ||||||
| BuildWebHost(args).Run(); |  | ||||||
| 
 | 
 | ||||||
| IWebHost BuildWebHost(string[] args) => | IWebHost BuildWebHost(string[] args) => | ||||||
|     WebHost |     WebHost | ||||||
|  | |||||||
| @ -1,13 +1,7 @@ | |||||||
| using GrpcBasket; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public class BasketService : IBasketService | ||||||
| { | { | ||||||
|     public class BasketService : IBasketService |  | ||||||
|     { |  | ||||||
|     private readonly Basket.BasketClient _basketClient; |     private readonly Basket.BasketClient _basketClient; | ||||||
|     private readonly ILogger<BasketService> _logger; |     private readonly ILogger<BasketService> _logger; | ||||||
| 
 | 
 | ||||||
| @ -99,5 +93,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | |||||||
| 
 | 
 | ||||||
|         return map; |         return map; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,14 +1,7 @@ | |||||||
| using CatalogApi; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public class CatalogService : ICatalogService | ||||||
| { | { | ||||||
|     public class CatalogService : ICatalogService |  | ||||||
|     { |  | ||||||
|     private readonly Catalog.CatalogClient _client; |     private readonly Catalog.CatalogClient _client; | ||||||
|     private readonly ILogger<CatalogService> _logger; |     private readonly ILogger<CatalogService> _logger; | ||||||
| 
 | 
 | ||||||
| @ -48,5 +41,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | |||||||
|             Price = (decimal)catalogItemResponse.Price |             Price = (decimal)catalogItemResponse.Price | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,12 +1,8 @@ | |||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public interface IBasketService | ||||||
| { | { | ||||||
|     public interface IBasketService |  | ||||||
|     { |  | ||||||
|     Task<BasketData> GetById(string id); |     Task<BasketData> GetById(string id); | ||||||
| 
 | 
 | ||||||
|     Task UpdateAsync(BasketData currentBasket); |     Task UpdateAsync(BasketData currentBasket); | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,13 +1,8 @@ | |||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public interface ICatalogService | ||||||
| { | { | ||||||
|     public interface ICatalogService |  | ||||||
|     { |  | ||||||
|     Task<CatalogItem> GetCatalogItemAsync(int id); |     Task<CatalogItem> GetCatalogItemAsync(int id); | ||||||
| 
 | 
 | ||||||
|     Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids); |     Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids); | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,10 +1,6 @@ | |||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public interface IOrderApiClient | ||||||
| { | { | ||||||
|     public interface IOrderApiClient |  | ||||||
|     { |  | ||||||
|     Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket); |     Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket); | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,10 +1,6 @@ | |||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public interface IOrderingService | ||||||
| { | { | ||||||
|     public interface IOrderingService |  | ||||||
|     { |  | ||||||
|     Task<OrderData> GetOrderDraftAsync(BasketData basketData); |     Task<OrderData> GetOrderDraftAsync(BasketData basketData); | ||||||
|     } |  | ||||||
| } | } | ||||||
| @ -1,15 +1,7 @@ | |||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using System.Net.Http; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| using System.Text.Json; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public class OrderApiClient : IOrderApiClient | ||||||
| { | { | ||||||
|     public class OrderApiClient : IOrderApiClient |  | ||||||
|     { |  | ||||||
|     private readonly HttpClient _apiClient; |     private readonly HttpClient _apiClient; | ||||||
|     private readonly ILogger<OrderApiClient> _logger; |     private readonly ILogger<OrderApiClient> _logger; | ||||||
|     private readonly UrlsConfig _urls; |     private readonly UrlsConfig _urls; | ||||||
| @ -36,5 +28,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | |||||||
|             PropertyNameCaseInsensitive = true |             PropertyNameCaseInsensitive = true | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,13 +1,7 @@ | |||||||
| using GrpcOrdering; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | public class OrderingService : IOrderingService | ||||||
| { | { | ||||||
|     public class OrderingService : IOrderingService |  | ||||||
|     { |  | ||||||
|     private readonly OrderingGrpc.OrderingGrpcClient _orderingGrpcClient; |     private readonly OrderingGrpc.OrderingGrpcClient _orderingGrpcClient; | ||||||
|     private readonly ILogger<OrderingService> _logger; |     private readonly ILogger<OrderingService> _logger; | ||||||
| 
 | 
 | ||||||
| @ -75,5 +69,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services | |||||||
|         return command; |         return command; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,32 +1,7 @@ | |||||||
| using CatalogApi; | namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator; | ||||||
| using Devspaces.Support; |  | ||||||
| using GrpcBasket; |  | ||||||
| using GrpcOrdering; |  | ||||||
| using HealthChecks.UI.Client; |  | ||||||
| using Microsoft.AspNetCore.Authentication.JwtBearer; |  | ||||||
| using Microsoft.AspNetCore.Builder; |  | ||||||
| using Microsoft.AspNetCore.Diagnostics.HealthChecks; |  | ||||||
| using Microsoft.AspNetCore.Hosting; |  | ||||||
| using Microsoft.AspNetCore.Http; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure; |  | ||||||
| using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; |  | ||||||
| using Microsoft.Extensions.Configuration; |  | ||||||
| using Microsoft.Extensions.DependencyInjection; |  | ||||||
| using Microsoft.Extensions.Diagnostics.HealthChecks; |  | ||||||
| using Microsoft.Extensions.Hosting; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Microsoft.OpenApi.Models; |  | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.IdentityModel.Tokens.Jwt; |  | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator | public class Startup | ||||||
| { | { | ||||||
|     public class Startup |  | ||||||
|     { |  | ||||||
|     public Startup(IConfiguration configuration) |     public Startup(IConfiguration configuration) | ||||||
|     { |     { | ||||||
|         Configuration = configuration; |         Configuration = configuration; | ||||||
| @ -99,10 +74,10 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator | |||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     } | } | ||||||
| 
 | 
 | ||||||
|     public static class ServiceCollectionExtensions | public static class ServiceCollectionExtensions | ||||||
|     { | { | ||||||
|     public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration) |     public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration) | ||||||
|     { |     { | ||||||
|         JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); |         JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); | ||||||
| @ -221,5 +196,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator | |||||||
| 
 | 
 | ||||||
|         return services; |         return services; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user