Skip to content

Commit 3f61eb0

Browse files
author
ericuss
committed
fix grpc call from mobile bff to basket.api and add ordering, in ordering controller
1 parent 016089f commit 3f61eb0

20 files changed

Lines changed: 350 additions & 54 deletions

docker-compose.override.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ services:
115115
- Serilog__MinimumLevel__Override__Ordering.API=Verbose
116116
ports:
117117
- "5102:80"
118+
- "5581:5001"
118119

119120
ordering.backgroundtasks:
120121
environment:
@@ -284,14 +285,16 @@ services:
284285
- urls__catalog=http://catalog.api
285286
- urls__orders=http://ordering.api
286287
- urls__identity=http://identity.api
288+
- urls__grpcBasket=http://10.0.75.1:5580
289+
- urls__grpcOrdering=http://10.0.75.1:5581
287290
- CatalogUrlHC=http://catalog.api/hc
288291
- OrderingUrlHC=http://ordering.api/hc
289292
- IdentityUrlHC=http://identity.api/hc
290293
- BasketUrlHC=http://basket.api/hc
291294
- MarketingUrlHC=http://marketing.api/hc
292295
- PaymentUrlHC=http://payment.api/hc
293296
- LocationUrlHC=http://locations.api/hc
294-
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
297+
- IdentityUrlExternal=http://10.0.75.1:5105
295298
ports:
296299
- "5120:80"
297300

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ public class OrdersOperations
2727
public string Basket { get; set; }
2828
public string Catalog { get; set; }
2929
public string Orders { get; set; }
30+
public string GrpcBasket { get; set; }
31+
public string GrpcOrdering { get; set; }
3032
}
3133
}

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/OrderController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
1313
public class OrderController : ControllerBase
1414
{
1515
private readonly IBasketService _basketService;
16-
private readonly IOrderApiClient _orderClient;
16+
private readonly IOrderingService _orderingService;
1717

18-
public OrderController(IBasketService basketService, IOrderApiClient orderClient)
18+
public OrderController(IBasketService basketService, IOrderingService orderingService)
1919
{
2020
_basketService = basketService;
21-
_orderClient = orderClient;
21+
_orderingService = orderingService;
2222
}
2323

2424
[Route("draft/{basketId}")]
@@ -39,7 +39,7 @@ public async Task<ActionResult<OrderData>> GetOrderDraftAsync(string basketId)
3939
return BadRequest($"No basket found for id {basketId}");
4040
}
4141

42-
return await _orderClient.GetOrderDraftFromBasketAsync(basket);
42+
return await _orderingService.GetOrderDraftAsync(basket);
4343
}
4444
}
4545
}

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Infrastructure/HttpClientAuthorizationDelegatingHandler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
4040
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
4141
}
4242

43-
_logger.LogInformation("@@@@@@@@@@@@@@@@@ {@request}", request);
44-
4543
return await base.SendAsync(request, cancellationToken);
4644
}
4745

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReference Include="Grpc.AspNetCore.Server.ClientFactory" Version="$(Grpc_AspNetCore_Server_ClientFactory)" />
2121
<PackageReference Include="Google.Protobuf" Version="$(Google_Protobuf)" />
2222
<PackageReference Include="Grpc.Core" Version="1.22.0" />
23-
<PackageReference Include="Grpc.Tools" Version="$(Grpc_Tools)" PrivateAssets="All" />
23+
<PackageReference Include="Grpc.Tools" Version="$(Grpc_Tools)" PrivateAssets="All" />
2424
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" />
2525
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="$(Microsoft_Extensions_Diagnostics_HealthChecks)" />
2626
<PackageReference Include="Serilog.AspNetCore" Version="$(Serilog_AspNetCore)" />
@@ -34,10 +34,11 @@
3434
<ItemGroup>
3535
<ProjectReference Include="..\..\..\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj" />
3636
</ItemGroup>
37-
37+
3838
<ItemGroup>
3939
<Protobuf Include="..\..\..\Services\Basket\Basket.API\Proto\basket.proto" GrpcServices="Client" />
4040
<Protobuf Include="..\..\..\Services\Catalog\Catalog.API\Proto\catalog.proto" GrpcServices="Client" />
41+
<Protobuf Include="..\..\..\Services\Ordering\Ordering.API\Proto\ordering.proto" GrpcServices="Client" />
4142
</ItemGroup>
4243

4344
</Project>

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class BasketData
66
{
77
public string BuyerId { get; set; }
88

9-
public List<BasketDataItem> Items { get; set; }
9+
public List<BasketDataItem> Items { get; set; } = new List<BasketDataItem>();
1010

1111
public BasketData()
1212
{
@@ -16,7 +16,6 @@ public BasketData()
1616
public BasketData(string buyerId)
1717
{
1818
BuyerId = buyerId;
19-
Items = new List<BasketDataItem>();
2019
}
2120
}
2221

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
53

64
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
75
{
@@ -28,6 +26,6 @@ public class OrderData
2826

2927
public string Buyer { get; set; }
3028

31-
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
29+
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
3230
}
3331
}

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
6-
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
1+
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
72
{
83
public class OrderItemData
94
{

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
using System.Collections.Generic;
52

63
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
74
{

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
using System.Collections.Generic;
52

63
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
74
{

0 commit comments

Comments
 (0)