Skip to content

Commit 0ee173c

Browse files
committed
naming changes
1 parent 63cba2c commit 0ee173c

25 files changed

Lines changed: 75 additions & 88 deletions

src/Services/Catalog/Catalog.API/IntegrationCommands/CommandHandlers/ConfirmOrderStockCommandMsgHandler.cs renamed to src/Services/Catalog/Catalog.API/IntegrationCommands/CommandHandlers/ConfirmOrderStockCommandHandler.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
using Commands;
1313
using IntegrationEvents.Events;
1414

15-
public class ConfirmOrderStockCommandMsgHandler : IIntegrationEventHandler<ConfirmOrderStockCommandMsg>
15+
public class ConfirmOrderStockCommandHandler : IIntegrationEventHandler<ConfirmOrderStockCommand>
1616
{
1717
private readonly CatalogContext _catalogContext;
1818
private readonly ICatalogIntegrationEventService _catalogIntegrationEventService;
1919

20-
public ConfirmOrderStockCommandMsgHandler(CatalogContext catalogContext,
20+
public ConfirmOrderStockCommandHandler(CatalogContext catalogContext,
2121
ICatalogIntegrationEventService catalogIntegrationEventService)
2222
{
2323
_catalogContext = catalogContext;
2424
_catalogIntegrationEventService = catalogIntegrationEventService;
2525
}
2626

27-
public async Task Handle(ConfirmOrderStockCommandMsg @event)
27+
public async Task Handle(ConfirmOrderStockCommand command)
2828
{
2929
var confirmedOrderStockItems = new List<ConfirmedOrderStockItem>();
3030

31-
foreach (var orderStockItem in @event.OrderStockItems)
31+
foreach (var orderStockItem in command.OrderStockItems)
3232
{
3333
var catalogItem = _catalogContext.CatalogItems.Find(orderStockItem.ProductId);
3434
CheckValidcatalogItemId(catalogItem);
@@ -39,9 +39,9 @@ public async Task Handle(ConfirmOrderStockCommandMsg @event)
3939
confirmedOrderStockItems.Add(confirmedOrderStockItem);
4040
}
4141

42-
var confirmedIntegrationEvent = confirmedOrderStockItems.Any(c => !c.Confirmed)
43-
? (IntegrationEvent) new OrderStockNotConfirmedIntegrationEvent(@event.OrderId, confirmedOrderStockItems)
44-
: new OrderStockConfirmedIntegrationEvent(@event.OrderId);
42+
var confirmedIntegrationEvent = confirmedOrderStockItems.Any(c => !c.HasStock)
43+
? (IntegrationEvent) new OrderStockNotConfirmedIntegrationEvent(command.OrderId, confirmedOrderStockItems)
44+
: new OrderStockConfirmedIntegrationEvent(command.OrderId);
4545

4646
await _catalogIntegrationEventService.SaveEventAndCatalogContextChangesAsync(confirmedIntegrationEvent);
4747
await _catalogIntegrationEventService.PublishThroughEventBusAsync(confirmedIntegrationEvent);

src/Services/Catalog/Catalog.API/IntegrationCommands/CommandHandlers/DecrementOrderStockCommandMsgHandler.cs renamed to src/Services/Catalog/Catalog.API/IntegrationCommands/CommandHandlers/DecrementOrderStockCommandHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
using Infrastructure;
66
using Commands;
77

8-
public class DecrementOrderStockCommandMsgHandler : IIntegrationEventHandler<DecrementOrderStockCommandMsg>
8+
public class DecrementOrderStockCommandHandler : IIntegrationEventHandler<DecrementOrderStockCommand>
99
{
1010
private readonly CatalogContext _catalogContext;
1111

12-
public DecrementOrderStockCommandMsgHandler(CatalogContext catalogContext)
12+
public DecrementOrderStockCommandHandler(CatalogContext catalogContext)
1313
{
1414
_catalogContext = catalogContext;
1515
}
1616

17-
public async Task Handle(DecrementOrderStockCommandMsg @event)
17+
public async Task Handle(DecrementOrderStockCommand command)
1818
{
1919
//we're not blocking stock/inventory
20-
foreach (var orderStockItem in @event.OrderStockItems)
20+
foreach (var orderStockItem in command.OrderStockItems)
2121
{
2222
var catalogItem = _catalogContext.CatalogItems.Find(orderStockItem.ProductId);
2323

src/Services/Catalog/Catalog.API/IntegrationCommands/Commands/ConfirmOrderStockCommandMsg.cs renamed to src/Services/Catalog/Catalog.API/IntegrationCommands/Commands/ConfirmOrderStockCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using BuildingBlocks.EventBus.Events;
44
using System.Collections.Generic;
55

6-
public class ConfirmOrderStockCommandMsg : IntegrationEvent
6+
public class ConfirmOrderStockCommand : IntegrationEvent
77
{
88
public int OrderId { get; }
99
public IEnumerable<OrderStockItem> OrderStockItems { get; }
1010

11-
public ConfirmOrderStockCommandMsg(int orderId,
11+
public ConfirmOrderStockCommand(int orderId,
1212
IEnumerable<OrderStockItem> orderStockItems)
1313
{
1414
OrderId = orderId;

src/Services/Catalog/Catalog.API/IntegrationCommands/Commands/DecrementOrderStockCommandMsg.cs renamed to src/Services/Catalog/Catalog.API/IntegrationCommands/Commands/DecrementOrderStockCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using System.Collections.Generic;
44
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
55

6-
public class DecrementOrderStockCommandMsg : IntegrationEvent
6+
public class DecrementOrderStockCommand : IntegrationEvent
77
{
88
public int OrderId { get; }
99
public IEnumerable<OrderStockItem> OrderStockItems { get; }
1010

11-
public DecrementOrderStockCommandMsg(int orderId,
11+
public DecrementOrderStockCommand(int orderId,
1212
IEnumerable<OrderStockItem> orderStockItems)
1313
{
1414
OrderId = orderId;

src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockNotConfirmedIntegrationEvent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public OrderStockNotConfirmedIntegrationEvent(int orderId,
2020
public class ConfirmedOrderStockItem
2121
{
2222
public int ProductId { get; }
23-
public bool Confirmed { get; }
23+
public bool HasStock { get; }
2424

25-
public ConfirmedOrderStockItem(int productId, bool confirmed)
25+
public ConfirmedOrderStockItem(int productId, bool hasStock)
2626
{
2727
ProductId = productId;
28-
Confirmed = confirmed;
28+
HasStock = hasStock;
2929
}
3030
}
3131
}

src/Services/Catalog/Catalog.API/Startup.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ private void RegisterServiceBus(IServiceCollection services)
190190
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
191191
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
192192

193-
services.AddTransient<IIntegrationEventHandler<ConfirmOrderStockCommandMsg>,
194-
ConfirmOrderStockCommandMsgHandler>();
195-
services.AddTransient<IIntegrationEventHandler<DecrementOrderStockCommandMsg>,
196-
DecrementOrderStockCommandMsgHandler>();
193+
services.AddTransient<IIntegrationEventHandler<ConfirmOrderStockCommand>,
194+
ConfirmOrderStockCommandHandler>();
195+
services.AddTransient<IIntegrationEventHandler<DecrementOrderStockCommand>,
196+
DecrementOrderStockCommandHandler>();
197197

198198
}
199199

200200
private void ConfigureEventBus(IApplicationBuilder app)
201201
{
202202
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
203203

204-
eventBus.Subscribe<ConfirmOrderStockCommandMsg, IIntegrationEventHandler<ConfirmOrderStockCommandMsg>>();
205-
eventBus.Subscribe<DecrementOrderStockCommandMsg, IIntegrationEventHandler<DecrementOrderStockCommandMsg>>();
204+
eventBus.Subscribe<ConfirmOrderStockCommand, IIntegrationEventHandler<ConfirmOrderStockCommand>>();
205+
eventBus.Subscribe<DecrementOrderStockCommand, IIntegrationEventHandler<DecrementOrderStockCommand>>();
206206
}
207207
}
208208
}

src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderGracePeriodConfirmed/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public async Task Handle(OrderStatusChangedToAwaitingValidationDomainEvent order
3535
var orderStockList = orderStatusChangedToAwaitingValidationDomainEvent.OrderItems
3636
.Select(orderItem => new OrderStockItem(orderItem.ProductId, orderItem.GetUnits()));
3737

38-
var confirmOrderStockEvent = new ConfirmOrderStockCommandMsg(orderStatusChangedToAwaitingValidationDomainEvent.OrderId,
38+
var confirmOrderStockCommand = new ConfirmOrderStockCommand(orderStatusChangedToAwaitingValidationDomainEvent.OrderId,
3939
orderStockList);
40-
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(confirmOrderStockEvent);
41-
await _orderingIntegrationEventService.PublishThroughEventBusAsync(confirmOrderStockEvent);
40+
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(confirmOrderStockCommand);
41+
await _orderingIntegrationEventService.PublishThroughEventBusAsync(confirmOrderStockCommand);
4242
}
4343
}
4444
}

src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderPaid/OrderStatusChangedToPaidDomainEventHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public async Task Handle(OrderStatusChangedToPaidDomainEvent orderStatusChangedT
3535
var orderStockList = orderStatusChangedToPaidDomainEvent.OrderItems
3636
.Select(orderItem => new OrderStockItem(orderItem.ProductId, orderItem.GetUnits()));
3737

38-
var decrementOrderStockCommandMsg = new DecrementOrderStockCommandMsg(orderStatusChangedToPaidDomainEvent.OrderId,
38+
var decrementOrderStockCommand = new DecrementOrderStockCommand(orderStatusChangedToPaidDomainEvent.OrderId,
3939
orderStockList);
40-
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(decrementOrderStockCommandMsg);
41-
await _orderingIntegrationEventService.PublishThroughEventBusAsync(decrementOrderStockCommandMsg);
40+
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(decrementOrderStockCommand);
41+
await _orderingIntegrationEventService.PublishThroughEventBusAsync(decrementOrderStockCommand);
4242
}
4343
}
4444
}

src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStockConfirmed/OrderStatusChangedToStockConfirmedDomainEventHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public async Task Handle(OrderStatusChangedToStockConfirmedDomainEvent orderStat
3131
.LogTrace($"Order with Id: {orderStatusChangedToStockConfirmedDomainEvent.OrderId} has been successfully updated with " +
3232
$"a status order id: {OrderStatus.StockConfirmed.Id}");
3333

34-
var payOrderCommandMsg = new PayOrderCommandMsg(orderStatusChangedToStockConfirmedDomainEvent.OrderId);
35-
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(payOrderCommandMsg);
36-
await _orderingIntegrationEventService.PublishThroughEventBusAsync(payOrderCommandMsg);
34+
var payOrderCommand = new PayOrderCommand(orderStatusChangedToStockConfirmedDomainEvent.OrderId);
35+
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(payOrderCommand);
36+
await _orderingIntegrationEventService.PublishThroughEventBusAsync(payOrderCommand);
3737
}
3838
}
3939
}

src/Services/Ordering/Ordering.API/Application/IntegrationCommands/Commands/ConfirmGracePeriodCommandMsg.cs renamed to src/Services/Ordering/Ordering.API/Application/IntegrationCommands/Commands/ConfirmGracePeriodCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Ordering.API.Application.IntegrationCommands.Commands
44
{
5-
public class ConfirmGracePeriodCommandMsg : IntegrationEvent
5+
public class ConfirmGracePeriodCommand : IntegrationEvent
66
{
77
public int OrderId { get; }
88

9-
public ConfirmGracePeriodCommandMsg(int orderId) =>
9+
public ConfirmGracePeriodCommand(int orderId) =>
1010
OrderId = orderId;
1111
}
1212
}

0 commit comments

Comments
 (0)