Browse Source

clean up solution

pull/1585/head
Borja García Rodríguez 4 years ago
parent
commit
2b91170662
243 changed files with 394 additions and 827 deletions
  1. +1
    -1
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs
  2. +1
    -1
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs
  3. +1
    -1
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs
  4. +0
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs
  5. +0
    -3
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs
  6. +1
    -1
      src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs
  7. +0
    -2
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs
  8. +0
    -3
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs
  9. +2
    -2
      src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs
  10. +0
    -1
      src/BuildingBlocks/Devspaces.Support/DevspacesMessageHandler.cs
  11. +0
    -3
      src/BuildingBlocks/Devspaces.Support/HttpClientBuilderDevspacesExtensions.cs
  12. +0
    -3
      src/BuildingBlocks/Devspaces.Support/ServiceCollectionDevspacesExtensions.cs
  13. +1
    -5
      src/BuildingBlocks/EventBus/EventBus/Abstractions/IDynamicIntegrationEventHandler.cs
  14. +0
    -1
      src/BuildingBlocks/EventBus/EventBus/Abstractions/IEventBus.cs
  15. +2
    -2
      src/BuildingBlocks/EventBus/EventBus/Abstractions/IIntegrationEventHandler.cs
  16. +2
    -2
      src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs
  17. +0
    -2
      src/BuildingBlocks/EventBus/EventBus/Extensions/GenericTypeExtensions.cs
  18. +3
    -3
      src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs
  19. +1
    -1
      src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs
  20. +4
    -4
      src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs
  21. +1
    -5
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/EventStateEnum.cs
  22. +2
    -5
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogContext.cs
  23. +4
    -9
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEntry.cs
  24. +0
    -2
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IIntegrationEventLogService.cs
  25. +7
    -11
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
  26. +2
    -8
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs
  27. +0
    -1
      src/Services/Basket/Basket.API/Auth/Server/AuthorizationHeaderParameterOperationFilter.cs
  28. +2
    -3
      src/Services/Basket/Basket.API/Controllers/BasketController.cs
  29. +0
    -1
      src/Services/Basket/Basket.API/Grpc/BasketService.cs
  30. +2
    -2
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs
  31. +1
    -1
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs
  32. +0
    -1
      src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs
  33. +1
    -1
      src/Services/Basket/Basket.API/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs
  34. +1
    -1
      src/Services/Basket/Basket.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs
  35. +1
    -1
      src/Services/Basket/Basket.API/Model/BasketItem.cs
  36. +2
    -1
      src/Services/Basket/Basket.API/Program.cs
  37. +1
    -1
      src/Services/Basket/Basket.API/Services/IdentityService.cs
  38. +18
    -21
      src/Services/Basket/Basket.API/Startup.cs
  39. +3
    -3
      src/Services/Basket/Basket.FunctionalTests/Base/BasketTestStartup.cs
  40. +1
    -1
      src/Services/Basket/Basket.FunctionalTests/BasketScenarios.cs
  41. +2
    -2
      src/Services/Basket/Basket.FunctionalTests/RedisBasketRepositoryTests.cs
  42. +6
    -6
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  43. +1
    -6
      src/Services/Catalog/Catalog.API/Extensions/CatalogItemExtensions.cs
  44. +2
    -5
      src/Services/Catalog/Catalog.API/Extensions/HostExtensions.cs
  45. +3
    -3
      src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs
  46. +5
    -6
      src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs
  47. +4
    -4
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs
  48. +7
    -7
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  49. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20161103152832_Initial.cs
  50. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20161103153420_UpdateTableNames.cs
  51. +2
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170314083211_AddEventTable.cs
  52. +2
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170316012921_RefactoringToIntegrationEventLog.cs
  53. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170316120022_RefactoringEventBusNamespaces.cs
  54. +2
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170322124244_RemoveIntegrationEventLogs.cs
  55. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170509130025_AddStockProductItem.cs
  56. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs
  57. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs
  58. +2
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/IntegrationEventMigrations/20170322145434_IntegrationEventInitial.cs
  59. +2
    -5
      src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs
  60. +6
    -6
      src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs
  61. +2
    -2
      src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs
  62. +1
    -1
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs
  63. +1
    -1
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs
  64. +1
    -2
      src/Services/Catalog/Catalog.API/Startup.cs
  65. +0
    -1
      src/Services/Catalog/Catalog.FunctionalTests/CatalogScenarioBase.cs
  66. +5
    -6
      src/Services/Identity/Identity.API/Controllers/AccountController.cs
  67. +1
    -1
      src/Services/Identity/Identity.API/Controllers/ConsentController.cs
  68. +1
    -1
      src/Services/Identity/Identity.API/Controllers/HomeController.cs
  69. +5
    -5
      src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs
  70. +2
    -3
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  71. +0
    -4
      src/Services/Identity/Identity.API/Devspaces/IdentityDevspacesBuilderExtensions.cs
  72. +2
    -2
      src/Services/Identity/Identity.API/Migrations/20190729091724_InitialMigration.cs
  73. +2
    -2
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.cs
  74. +2
    -2
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.cs
  75. +2
    -2
      src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs
  76. +2
    -2
      src/Services/Identity/Identity.API/Services/EFLoginService.cs
  77. +2
    -2
      src/Services/Identity/Identity.API/Services/ILoginService.cs
  78. +1
    -1
      src/Services/Identity/Identity.API/Services/RedirectService.cs
  79. +1
    -2
      src/Services/Ordering/Ordering.API/Application/Behaviors/LoggingBehavior.cs
  80. +1
    -1
      src/Services/Ordering/Ordering.API/Application/Behaviors/ValidatorBehavior.cs
  81. +0
    -4
      src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommand.cs
  82. +1
    -1
      src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs
  83. +4
    -5
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs
  84. +2
    -8
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderDraftCommand.cs
  85. +1
    -1
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderDraftCommandHandler.cs
  86. +0
    -2
      src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs
  87. +0
    -4
      src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommand.cs
  88. +2
    -2
      src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs
  89. +0
    -4
      src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommand.cs
  90. +2
    -2
      src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs
  91. +0
    -4
      src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommand.cs
  92. +2
    -2
      src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs
  93. +0
    -3
      src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommand.cs
  94. +3
    -3
      src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs
  95. +0
    -4
      src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommand.cs
  96. +2
    -2
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderGracePeriodConfirmed/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs
  97. +4
    -4
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderPaid/OrderStatusChangedToPaidDomainEventHandler.cs
  98. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderShipped/OrderShippedDomainEventHandler.cs
  99. +4
    -12
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/SendEmailToCustomerWhenOrderStartedDomainEventHandler.cs
  100. +0
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs

+ 1
- 1
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs View File

@ -42,7 +42,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
public string Buyer { get; set; }
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
}
}

+ 1
- 1
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs View File

@ -5,7 +5,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
public class UpdateBasketItemsRequest
{
public string BasketId { get; set; }
public ICollection<UpdateBasketItemData> Updates { get; set; }


+ 1
- 1
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs View File

@ -2,7 +2,7 @@
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class UpdateBasketRequest
{
public string BuyerId { get; set; }


+ 0
- 2
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs View File

@ -1,8 +1,6 @@
using GrpcBasket;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Threading.Tasks;


+ 0
- 3
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs View File

@ -1,10 +1,7 @@
using GrpcOrdering;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services


+ 1
- 1
src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs View File

@ -20,7 +20,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
public class BasketOperations
{
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
public static string UpdateBasket() => "/api/v1/basket";
}


+ 0
- 2
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs View File

@ -1,8 +1,6 @@
using GrpcBasket;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Threading.Tasks;


+ 0
- 3
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs View File

@ -1,10 +1,7 @@
using GrpcOrdering;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services


+ 2
- 2
src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs View File

@ -44,7 +44,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
.AddUrlGroup(new Uri(Configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
.AddUrlGroup(new Uri(Configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
.AddUrlGroup(new Uri(Configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" });
services.AddCustomMvc(Configuration)
.AddCustomAuthentication(Configuration)
.AddDevspaces()
@ -142,7 +142,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
Version = "v1",
Description = "Shopping Aggregator for Web Clients"
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,


+ 0
- 1
src/BuildingBlocks/Devspaces.Support/DevspacesMessageHandler.cs View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;


+ 0
- 3
src/BuildingBlocks/Devspaces.Support/HttpClientBuilderDevspacesExtensions.cs View File

@ -1,7 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
namespace Devspaces.Support
{


+ 0
- 3
src/BuildingBlocks/Devspaces.Support/ServiceCollectionDevspacesExtensions.cs View File

@ -1,7 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
namespace Devspaces.Support
{


+ 1
- 5
src/BuildingBlocks/EventBus/EventBus/Abstractions/IDynamicIntegrationEventHandler.cs View File

@ -1,8 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
{


+ 0
- 1
src/BuildingBlocks/EventBus/EventBus/Abstractions/IEventBus.cs View File

@ -1,5 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
{


+ 2
- 2
src/BuildingBlocks/EventBus/EventBus/Abstractions/IIntegrationEventHandler.cs View File

@ -3,8 +3,8 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
{
public interface IIntegrationEventHandler<in TIntegrationEvent> : IIntegrationEventHandler
where TIntegrationEvent: IntegrationEvent
public interface IIntegrationEventHandler<in TIntegrationEvent> : IIntegrationEventHandler
where TIntegrationEvent : IntegrationEvent
{
Task Handle(TIntegrationEvent @event);
}


+ 2
- 2
src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs View File

@ -1,5 +1,5 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
{


+ 0
- 2
src/BuildingBlocks/EventBus/EventBus/Extensions/GenericTypeExtensions.cs View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions
{


+ 3
- 3
src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs View File

@ -1,8 +1,8 @@
using System;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
{


+ 1
- 1
src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs View File

@ -7,7 +7,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
public class SubscriptionInfo
{
public bool IsDynamic { get; }
public Type HandlerType{ get; }
public Type HandlerType { get; }
private SubscriptionInfo(bool isDynamic, Type handlerType)
{


+ 4
- 4
src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs View File

@ -4,7 +4,7 @@ using System;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
{
public class DefaultServiceBusPersisterConnection :IServiceBusPersisterConnection
public class DefaultServiceBusPersisterConnection : IServiceBusPersisterConnection
{
private readonly ILogger<DefaultServiceBusPersisterConnection> _logger;
private readonly ServiceBusConnectionStringBuilder _serviceBusConnectionStringBuilder;
@ -16,8 +16,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
ILogger<DefaultServiceBusPersisterConnection> logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ??
_serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ??
throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder));
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
}
@ -26,7 +26,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
public ITopicClient CreateModel()
{
if(_topicClient.IsClosedOrClosing)
if (_topicClient.IsClosedOrClosing)
{
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
}


+ 1
- 5
src/BuildingBlocks/EventBus/IntegrationEventLogEF/EventStateEnum.cs View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
{
public enum EventStateEnum
{


+ 2
- 5
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogContext.cs View File

@ -1,13 +1,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
{
public class IntegrationEventLogContext : DbContext
{
{
public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> options) : base(options)
{
}
@ -15,7 +12,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
{
builder.Entity<IntegrationEventLogEntry>(ConfigureIntegrationEventLogEntry);
}


+ 4
- 9
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEntry.cs View File

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Linq;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
using Microsoft.Extensions.Logging;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using System.Linq;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
{
@ -16,7 +11,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
private IntegrationEventLogEntry() { }
public IntegrationEventLogEntry(IntegrationEvent @event, Guid transactionId)
{
EventId = @event.Id;
EventId = @event.Id;
CreationTime = @event.CreationDate;
EventTypeName = @event.GetType().FullName;
Content = JsonConvert.SerializeObject(@event);


+ 0
- 2
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IIntegrationEventLogService.cs View File

@ -2,8 +2,6 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services


+ 7
- 11
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs View File

@ -1,12 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
@ -15,7 +10,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
{
public class IntegrationEventLogService : IIntegrationEventLogService,IDisposable
public class IntegrationEventLogService : IIntegrationEventLogService, IDisposable
{
private readonly IntegrationEventLogContext _integrationEventLogContext;
private readonly DbConnection _dbConnection;
@ -43,11 +38,12 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
var result = await _integrationEventLogContext.IntegrationEventLogs
.Where(e => e.TransactionId == tid && e.State == EventStateEnum.NotPublished).ToListAsync();
if(result != null && result.Any()){
if (result != null && result.Any())
{
return result.OrderBy(o => o.CreationTime)
.Select(e => e.DeserializeJsonContent(_eventTypes.Find(t=> t.Name == e.EventTypeShortName)));
.Select(e => e.DeserializeJsonContent(_eventTypes.Find(t => t.Name == e.EventTypeShortName)));
}
return new List<IntegrationEventLogEntry>();
}
@ -83,7 +79,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
var eventLogEntry = _integrationEventLogContext.IntegrationEventLogs.Single(ie => ie.EventId == eventId);
eventLogEntry.State = status;
if(status == EventStateEnum.InProgress)
if (status == EventStateEnum.InProgress)
eventLogEntry.TimesSent++;
_integrationEventLogContext.IntegrationEventLogs.Update(eventLogEntry);
@ -100,7 +96,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
_integrationEventLogContext?.Dispose();
}
disposedValue = true;
}
}


+ 2
- 8
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs View File

@ -1,11 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities
@ -16,8 +10,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utili
private ResilientTransaction(DbContext context) =>
_context = context ?? throw new ArgumentNullException(nameof(context));
public static ResilientTransaction New (DbContext context) =>
new ResilientTransaction(context);
public static ResilientTransaction New(DbContext context) =>
new ResilientTransaction(context);
public async Task ExecuteAsync(Func<Task> action)
{


+ 0
- 1
src/Services/Basket/Basket.API/Auth/Server/AuthorizationHeaderParameterOperationFilter.cs View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;


+ 2
- 3
src/Services/Basket/Basket.API/Controllers/BasketController.cs View File

@ -7,7 +7,6 @@ using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.eShopOnContainers.Services.Basket.API.Services;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Threading.Tasks;
@ -47,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
[HttpPost]
[ProducesResponseType(typeof(CustomerBasket), (int)HttpStatusCode.OK)]
public async Task<ActionResult<CustomerBasket>> UpdateBasketAsync([FromBody]CustomerBasket value)
public async Task<ActionResult<CustomerBasket>> UpdateBasketAsync([FromBody] CustomerBasket value)
{
return Ok(await _repository.UpdateBasketAsync(value));
}
@ -56,7 +55,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
[HttpPost]
[ProducesResponseType((int)HttpStatusCode.Accepted)]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public async Task<ActionResult> CheckoutAsync([FromBody]BasketCheckout basketCheckout, [FromHeader(Name = "x-requestid")] string requestId)
public async Task<ActionResult> CheckoutAsync([FromBody] BasketCheckout basketCheckout, [FromHeader(Name = "x-requestid")] string requestId)
{
var userId = _identityService.GetUserIdentity();


+ 0
- 1
src/Services/Basket/Basket.API/Grpc/BasketService.cs View File

@ -4,7 +4,6 @@ using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.Extensions.Logging;
using System.Linq;
using System.Threading.Tasks;
using GrpcBasket;
namespace GrpcBasket
{


+ 2
- 2
src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs View File

@ -44,7 +44,7 @@ namespace Basket.API.Infrastructure.Middlewares
private async Task ProcessConfigRequest(HttpContext context)
{
var enable = context.Request.Query.Keys.Any(k => k == "enable");
var disable = context.Request.Query.Keys.Any(k => k == "disable");
var disable = context.Request.Query.Keys.Any(k => k == "disable");
if (enable && disable)
{
@ -86,7 +86,7 @@ namespace Basket.API.Infrastructure.Middlewares
}
return _mustFail &&
(_options.EndpointPaths.Any(x => x == rpath)
(_options.EndpointPaths.Any(x => x == rpath)
|| _options.EndpointPaths.Count == 0);
}
}


+ 1
- 1
src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs View File

@ -7,6 +7,6 @@ namespace Basket.API.Infrastructure.Middlewares
public string ConfigPath = "/Failing";
public List<string> EndpointPaths { get; set; } = new List<string>();
public List<string> NotFilteredPaths {get; set;} = new List<string>();
public List<string> NotFilteredPaths { get; set; } = new List<string>();
}
}

+ 0
- 1
src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs View File

@ -1,6 +1,5 @@
using Basket.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.Services.Basket.API;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.Extensions.Logging;
using Serilog.Context;


+ 1
- 1
src/Services/Basket/Basket.API/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs View File

@ -10,6 +10,6 @@ namespace Basket.API.IntegrationEvents.Events
public string UserId { get; init; }
public OrderStartedIntegrationEvent(string userId)
=> UserId = userId;
=> UserId = userId;
}
}

+ 1
- 1
src/Services/Basket/Basket.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs View File

@ -6,7 +6,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
// An Event is “something that has happened in the past”, therefore its name has to be
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
{
public int ProductId { get; private init; }
public decimal NewPrice { get; private init; }


+ 1
- 1
src/Services/Basket/Basket.API/Model/BasketItem.cs View File

@ -18,7 +18,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
if (Quantity < 1)
{
results.Add(new ValidationResult("Invalid number of units", new []{ "Quantity" }));
results.Add(new ValidationResult("Invalid number of units", new[] { "Quantity" }));
}
return results;


+ 2
- 1
src/Services/Basket/Basket.API/Program.cs View File

@ -104,7 +104,8 @@ IConfiguration GetConfiguration()
return (port, grpcPort);
}
public class Program {
public class Program
{
public static string Namespace = typeof(Startup).Namespace;
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);

+ 1
- 1
src/Services/Basket/Basket.API/Services/IdentityService.cs View File

@ -6,7 +6,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Services
{
public class IdentityService : IIdentityService
{
private IHttpContextAccessor _context;
private IHttpContextAccessor _context;
public IdentityService(IHttpContextAccessor context)
{


+ 18
- 21
src/Services/Basket/Basket.API/Startup.cs View File

@ -1,9 +1,9 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Basket.API.Infrastructure.Filters;
using Basket.API.Infrastructure.Middlewares;
using Basket.API.IntegrationEvents.EventHandling;
using Basket.API.IntegrationEvents.Events;
using GrpcBasket;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
@ -33,9 +33,6 @@ using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using GrpcBasket;
using Microsoft.AspNetCore.Http.Features;
using Serilog;
namespace Microsoft.eShopOnContainers.Services.Basket.API
{
@ -213,7 +210,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
ConfigureAuth(app);
app.UseStaticFiles();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<BasketService>();
@ -255,22 +252,22 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
private void ConfigureAuthService(IServiceCollection services)
{
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub");
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "basket";
});
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub");
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "basket";
});
}
protected virtual void ConfigureAuth(IApplicationBuilder app)


+ 3
- 3
src/Services/Basket/Basket.FunctionalTests/Base/BasketTestStartup.cs View File

@ -1,9 +1,9 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.eShopOnContainers.Services.Basket.API;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace Basket.FunctionalTests.Base
{
@ -20,7 +20,7 @@ namespace Basket.FunctionalTests.Base
services.Configure<RouteOptions>(Configuration);
return base.ConfigureServices(services);
}
protected override void ConfigureAuth(IApplicationBuilder app)
{
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())


+ 1
- 1
src/Services/Basket/Basket.FunctionalTests/BasketScenarios.cs View File

@ -73,7 +73,7 @@ namespace Basket.FunctionalTests
string BuildCheckout()
{
var checkoutBasket = new
var checkoutBasket = new
{
City = "city",
Street = "street",


+ 2
- 2
src/Services/Basket/Basket.FunctionalTests/RedisBasketRepositoryTests.cs View File

@ -33,7 +33,7 @@ namespace Basket.FunctionalTests
Assert.Single(basket.Items);
}
}
[Fact]
@ -58,7 +58,7 @@ namespace Basket.FunctionalTests
Assert.True(deleteResult);
Assert.Null(result);
}
}
}
RedisBasketRepository BuildBasketRepository(ConnectionMultiplexer connMux)


+ 6
- 6
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -37,7 +37,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(IEnumerable<CatalogItem>), (int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public async Task<IActionResult> ItemsAsync([FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0, string ids = null)
public async Task<IActionResult> ItemsAsync([FromQuery] int pageSize = 10, [FromQuery] int pageIndex = 0, string ids = null)
{
if (!string.IsNullOrEmpty(ids))
{
@ -126,7 +126,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[HttpGet]
[Route("items/withname/{name:minlength(1)}")]
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsWithNameAsync(string name, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsWithNameAsync(string name, [FromQuery] int pageSize = 10, [FromQuery] int pageIndex = 0)
{
var totalItems = await _catalogContext.CatalogItems
.Where(c => c.Name.StartsWith(name))
@ -147,7 +147,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[HttpGet]
[Route("items/type/{catalogTypeId}/brand/{catalogBrandId:int?}")]
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsByTypeIdAndBrandIdAsync(int catalogTypeId, int? catalogBrandId, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsByTypeIdAndBrandIdAsync(int catalogTypeId, int? catalogBrandId, [FromQuery] int pageSize = 10, [FromQuery] int pageIndex = 0)
{
var root = (IQueryable<CatalogItem>)_catalogContext.CatalogItems;
@ -175,7 +175,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[HttpGet]
[Route("items/type/all/brand/{catalogBrandId:int?}")]
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsByBrandIdAsync(int? catalogBrandId, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
public async Task<ActionResult<PaginatedItemsViewModel<CatalogItem>>> ItemsByBrandIdAsync(int? catalogBrandId, [FromQuery] int pageSize = 10, [FromQuery] int pageIndex = 0)
{
var root = (IQueryable<CatalogItem>)_catalogContext.CatalogItems;
@ -220,7 +220,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[HttpPut]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
[ProducesResponseType((int)HttpStatusCode.Created)]
public async Task<ActionResult> UpdateProductAsync([FromBody]CatalogItem productToUpdate)
public async Task<ActionResult> UpdateProductAsync([FromBody] CatalogItem productToUpdate)
{
var catalogItem = await _catalogContext.CatalogItems.SingleOrDefaultAsync(i => i.Id == productToUpdate.Id);
@ -259,7 +259,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[Route("items")]
[HttpPost]
[ProducesResponseType((int)HttpStatusCode.Created)]
public async Task<ActionResult> CreateProductAsync([FromBody]CatalogItem product)
public async Task<ActionResult> CreateProductAsync([FromBody] CatalogItem product)
{
var item = new CatalogItem
{


+ 1
- 6
src/Services/Catalog/Catalog.API/Extensions/CatalogItemExtensions.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
{
public static class CatalogItemExtensions
{


+ 2
- 5
src/Services/Catalog/Catalog.API/Extensions/HostExtensions.cs View File

@ -1,13 +1,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Polly;
using System;
using System.Data.SqlClient;
namespace Catalog.API.Extensions


+ 3
- 3
src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs View File

@ -1,11 +1,11 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Polly;
using System;
using System.Data.SqlClient;
using Microsoft.AspNetCore.Hosting;
namespace Catalog.API.Extensions
{


+ 5
- 6
src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs View File

@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CatalogApi;
using CatalogApi;
using Grpc.Core;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
using Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static CatalogApi.Catalog;
namespace Catalog.API.Grpc


+ 4
- 4
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs View File

@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
using Microsoft.EntityFrameworkCore;
using EntityConfigurations;
using Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Model;
public class CatalogContext : DbContext
{
@ -19,7 +19,7 @@
builder.ApplyConfiguration(new CatalogBrandEntityTypeConfiguration());
builder.ApplyConfiguration(new CatalogTypeEntityTypeConfiguration());
builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration());
}
}
}
@ -27,7 +27,7 @@
{
public CatalogContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>()
var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>()
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;Integrated Security=true");
return new CatalogContext(optionsBuilder.Options);


+ 7
- 7
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -19,7 +19,7 @@
public class CatalogContextSeed
{
public async Task SeedAsync(CatalogContext context,IWebHostEnvironment env,IOptions<CatalogSettings> settings,ILogger<CatalogContextSeed> logger)
public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger)
{
var policy = CreatePolicy(logger, nameof(CatalogContextSeed));
@ -73,7 +73,7 @@
try
{
string[] requiredHeaders = { "catalogbrand" };
csvheaders = GetHeaders( csvFileCatalogBrands, requiredHeaders );
csvheaders = GetHeaders(csvFileCatalogBrands, requiredHeaders);
}
catch (Exception ex)
{
@ -128,7 +128,7 @@
try
{
string[] requiredHeaders = { "catalogtype" };
csvheaders = GetHeaders( csvFileCatalogTypes, requiredHeaders );
csvheaders = GetHeaders(csvFileCatalogTypes, requiredHeaders);
}
catch (Exception ex)
{
@ -183,7 +183,7 @@
{
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "picturefilename" };
string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" };
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders);
}
catch (Exception ex)
{
@ -196,7 +196,7 @@
return File.ReadAllLines(csvFileCatalogItems)
.Skip(1) // skip header row
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") )
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"))
.SelectTry(column => CreateCatalogItem(column, csvheaders, catalogTypeIdLookup, catalogBrandIdLookup))
.OnCaughtException(ex => { logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
.Where(x => x != null);
@ -243,7 +243,7 @@
string availableStockString = column[availableStockIndex].Trim('"').Trim();
if (!String.IsNullOrEmpty(availableStockString))
{
if ( int.TryParse(availableStockString, out int availableStock))
if (int.TryParse(availableStockString, out int availableStock))
{
catalogItem.AvailableStock = availableStock;
}
@ -370,7 +370,7 @@
}
}
private AsyncRetryPolicy CreatePolicy( ILogger<CatalogContextSeed> logger, string prefix,int retries = 3)
private AsyncRetryPolicy CreatePolicy(ILogger<CatalogContextSeed> logger, string prefix, int retries = 3)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20161103152832_Initial.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20161103153420_UpdateTableNames.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{


+ 2
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170314083211_AddEventTable.cs View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Catalog.API.Infrastructure.Migrations
{


+ 2
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170316012921_RefactoringToIntegrationEventLog.cs View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Catalog.API.Infrastructure.Migrations
{


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170316120022_RefactoringEventBusNamespaces.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{


+ 2
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170322124244_RemoveIntegrationEventLogs.cs View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Catalog.API.Infrastructure.Migrations
{


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170509130025_AddStockProductItem.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Catalog.API.Infrastructure.Migrations
{


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs View File

@ -1,8 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
namespace Catalog.API.Infrastructure.Migrations


+ 2
- 3
src/Services/Catalog/Catalog.API/Infrastructure/IntegrationEventMigrations/20170322145434_IntegrationEventInitial.cs View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Catalog.API.Migrations
{


+ 2
- 5
src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs View File

@ -1,20 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities;
using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System;
using System.Data.Common;
using System.Threading.Tasks;
namespace Catalog.API.IntegrationEvents
{
public class CatalogIntegrationEventService : ICatalogIntegrationEventService,IDisposable
public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable
{
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
private readonly IEventBus _eventBus;
@ -75,7 +72,7 @@ namespace Catalog.API.IntegrationEvents
{
(_eventLogService as IDisposable)?.Dispose();
}
disposedValue = true;
}
}


+ 6
- 6
src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs View File

@ -1,17 +1,17 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
{
using BuildingBlocks.EventBus.Abstractions;
using System.Threading.Tasks;
using BuildingBlocks.EventBus.Events;
using Infrastructure;
using System.Collections.Generic;
using System.Linq;
using global::Catalog.API.IntegrationEvents;
using Infrastructure;
using IntegrationEvents.Events;
using Serilog.Context;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{
private readonly CatalogContext _catalogContext;


+ 2
- 2
src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs View File

@ -1,13 +1,13 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
{
using BuildingBlocks.EventBus.Abstractions;
using System.Threading.Tasks;
using Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System.Threading.Tasks;
public class OrderStatusChangedToPaidIntegrationEventHandler :
public class OrderStatusChangedToPaidIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{
private readonly CatalogContext _catalogContext;


+ 1
- 1
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
{
using System.Collections.Generic;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{


+ 1
- 1
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs View File

@ -6,7 +6,7 @@
// An Event is “something that has happened in the past”, therefore its name has to be past tense
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
{
public int ProductId { get; private init; }
public decimal NewPrice { get; private init; }


+ 1
- 2
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
@ -82,7 +81,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1");
});
app.UseRouting();
app.UseCors("CorsPolicy");
app.UseEndpoints(endpoints =>


+ 0
- 1
src/Services/Catalog/Catalog.FunctionalTests/CatalogScenarioBase.cs View File

@ -1,4 +1,3 @@
using Autofac.Extensions.DependencyInjection;
using Catalog.API.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;


+ 5
- 6
src/Services/Identity/Identity.API/Controllers/AccountController.cs View File

@ -1,9 +1,4 @@
using System;
using System.Linq;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using IdentityModel;
using IdentityModel;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Services;
@ -17,6 +12,10 @@ using Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
using Microsoft.eShopOnContainers.Services.Identity.API.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
{


+ 1
- 1
src/Services/Identity/Identity.API/Controllers/ConsentController.cs View File

@ -19,7 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
private readonly IResourceStore _resourceStore;
private readonly IIdentityServerInteractionService _interaction;
public ConsentController(
ILogger<ConsentController> logger,
IIdentityServerInteractionService interaction,


+ 1
- 1
src/Services/Identity/Identity.API/Controllers/HomeController.cs View File

@ -14,7 +14,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
private readonly IOptionsSnapshot<AppSettings> _settings;
private readonly IRedirectService _redirectSvc;
public HomeController(IIdentityServerInteractionService interaction, IOptionsSnapshot<AppSettings> settings,IRedirectService redirectSvc)
public HomeController(IIdentityServerInteractionService interaction, IOptionsSnapshot<AppSettings> settings, IRedirectService redirectSvc)
{
_interaction = interaction;
_settings = settings;


+ 5
- 5
src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs View File

@ -20,8 +20,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{
private readonly IPasswordHasher<ApplicationUser> _passwordHasher = new PasswordHasher<ApplicationUser>();
public async Task SeedAsync(ApplicationDbContext context,IWebHostEnvironment env,
ILogger<ApplicationDbContextSeed> logger, IOptions<AppSettings> settings,int? retry = 0)
public async Task SeedAsync(ApplicationDbContext context, IWebHostEnvironment env,
ILogger<ApplicationDbContextSeed> logger, IOptions<AppSettings> settings, int? retry = 0)
{
int retryForAvaiability = retry.Value;
@ -50,10 +50,10 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
if (retryForAvaiability < 10)
{
retryForAvaiability++;
logger.LogError(ex, "EXCEPTION ERROR while migrating {DbContextName}", nameof(ApplicationDbContext));
await SeedAsync(context,env,logger,settings, retryForAvaiability);
await SeedAsync(context, env, logger, settings, retryForAvaiability);
}
}
}
@ -87,7 +87,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
List<ApplicationUser> users = File.ReadAllLines(csvFileUsers)
.Skip(1) // skip header column
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") )
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"))
.SelectTry(column => CreateApplicationUser(column, csvheaders))
.OnCaughtException(ex => { logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
.Where(x => x != null)


+ 2
- 3
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -4,7 +4,6 @@ using IdentityServer4.EntityFramework.Mappers;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Identity.API.Configuration;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -13,9 +12,9 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{
public class ConfigurationDbContextSeed
{
public async Task SeedAsync(ConfigurationDbContext context,IConfiguration configuration)
public async Task SeedAsync(ConfigurationDbContext context, IConfiguration configuration)
{
//callbacks urls from config:
var clientUrls = new Dictionary<string, string>();


+ 0
- 4
src/Services/Identity/Identity.API/Devspaces/IdentityDevspacesBuilderExtensions.cs View File

@ -1,8 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Devspaces
{


+ 2
- 2
src/Services/Identity/Identity.API/Migrations/20190729091724_InitialMigration.cs View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Identity.API.Migrations
{


+ 2
- 2
src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.cs View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Identity.API.Migrations.ConfigurationDb
{


+ 2
- 2
src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.cs View File

@ -1,5 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Identity.API.Migrations.PersistedGrantDb
{


+ 2
- 2
src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using IdentityServer4.Models;
using System.Collections.Generic;
using System.Linq;
using IdentityServer4.Models;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{


+ 2
- 2
src/Services/Identity/Identity.API/Services/EFLoginService.cs View File

@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{


+ 2
- 2
src/Services/Identity/Identity.API/Services/ILoginService.cs View File

@ -1,5 +1,5 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{


+ 1
- 1
src/Services/Identity/Identity.API/Services/RedirectService.cs View File

@ -19,7 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
splitKey = "signin-oidc";
else
splitKey = "scope";
results = Regex.Split(result, splitKey);
if (results.Length < 2)
return "";


+ 1
- 2
src/Services/Ordering/Ordering.API/Application/Behaviors/LoggingBehavior.cs View File

@ -1,9 +1,8 @@
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
namespace Ordering.API.Application.Behaviors
{


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/Behaviors/ValidatorBehavior.cs View File

@ -1,11 +1,11 @@
using FluentValidation;
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.Domain.Exceptions;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
namespace Ordering.API.Application.Behaviors
{


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommand.cs View File

@ -1,9 +1,5 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs View File

@ -27,7 +27,7 @@ namespace Ordering.API.Application.Commands
public async Task<bool> Handle(CancelOrderCommand command, CancellationToken cancellationToken)
{
var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber);
if(orderToUpdate == null)
if (orderToUpdate == null)
{
return false;
}


+ 4
- 5
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs View File

@ -1,10 +1,9 @@
using System;
using MediatR;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Collections;
using MediatR;
using Ordering.API.Application.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{


+ 2
- 8
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderDraftCommand.cs View File

@ -1,18 +1,12 @@
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Ordering.API.Application.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{
public class CreateOrderDraftCommand : IRequest<OrderDraftDTO>
public class CreateOrderDraftCommand : IRequest<OrderDraftDTO>
{
public string BuyerId { get; private set; }
public IEnumerable<BasketItem> Items { get; private set; }


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderDraftCommandHandler.cs View File

@ -20,7 +20,7 @@
private readonly IMediator _mediator;
// Using DI to inject infrastructure persistence Repositories
public CreateOrderDraftCommandHandler(IMediator mediator, IIdentityService identityService)
public CreateOrderDraftCommandHandler(IMediator mediator, IIdentityService identityService)
{
_identityService = identityService ?? throw new ArgumentNullException(nameof(identityService));
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));


+ 0
- 2
src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs View File

@ -2,9 +2,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Behaviors;
using Ordering.API.Application.Commands;
using System;
using System.Threading;
using System.Threading.Tasks;


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommand.cs View File

@ -1,9 +1,5 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs View File

@ -10,7 +10,7 @@ namespace Ordering.API.Application.Commands
{
// Regular CommandHandler
public class SetAwaitingValidationOrderStatusCommandHandler : IRequestHandler<SetAwaitingValidationOrderStatusCommand, bool>
{
{
private readonly IOrderRepository _orderRepository;
public SetAwaitingValidationOrderStatusCommandHandler(IOrderRepository orderRepository)
@ -27,7 +27,7 @@ namespace Ordering.API.Application.Commands
public async Task<bool> Handle(SetAwaitingValidationOrderStatusCommand command, CancellationToken cancellationToken)
{
var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber);
if(orderToUpdate == null)
if (orderToUpdate == null)
{
return false;
}


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommand.cs View File

@ -1,9 +1,5 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs View File

@ -10,7 +10,7 @@ namespace Ordering.API.Application.Commands
{
// Regular CommandHandler
public class SetPaidOrderStatusCommandHandler : IRequestHandler<SetPaidOrderStatusCommand, bool>
{
{
private readonly IOrderRepository _orderRepository;
public SetPaidOrderStatusCommandHandler(IOrderRepository orderRepository)
@ -30,7 +30,7 @@ namespace Ordering.API.Application.Commands
await Task.Delay(10000, cancellationToken);
var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber);
if(orderToUpdate == null)
if (orderToUpdate == null)
{
return false;
}


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommand.cs View File

@ -1,9 +1,5 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs View File

@ -10,7 +10,7 @@ namespace Ordering.API.Application.Commands
{
// Regular CommandHandler
public class SetStockConfirmedOrderStatusCommandHandler : IRequestHandler<SetStockConfirmedOrderStatusCommand, bool>
{
{
private readonly IOrderRepository _orderRepository;
public SetStockConfirmedOrderStatusCommandHandler(IOrderRepository orderRepository)
@ -30,7 +30,7 @@ namespace Ordering.API.Application.Commands
await Task.Delay(10000, cancellationToken);
var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber);
if(orderToUpdate == null)
if (orderToUpdate == null)
{
return false;
}


+ 0
- 3
src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommand.cs View File

@ -1,9 +1,6 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 3
- 3
src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs View File

@ -10,7 +10,7 @@ namespace Ordering.API.Application.Commands
{
// Regular CommandHandler
public class SetStockRejectedOrderStatusCommandHandler : IRequestHandler<SetStockRejectedOrderStatusCommand, bool>
{
{
private readonly IOrderRepository _orderRepository;
public SetStockRejectedOrderStatusCommandHandler(IOrderRepository orderRepository)
@ -30,10 +30,10 @@ namespace Ordering.API.Application.Commands
await Task.Delay(10000, cancellationToken);
var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber);
if(orderToUpdate == null)
if (orderToUpdate == null)
{
return false;
}
}
orderToUpdate.SetCancelledStatusWhenStockIsRejected(command.OrderStockItems);


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommand.cs View File

@ -1,9 +1,5 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{


+ 2
- 2
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderGracePeriodConfirmed/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs View File

@ -28,7 +28,7 @@
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_buyerRepository = buyerRepository;
_orderingIntegrationEventService = orderingIntegrationEventService;
_orderingIntegrationEventService = orderingIntegrationEventService;
}
public async Task Handle(OrderStatusChangedToAwaitingValidationDomainEvent orderStatusChangedToAwaitingValidationDomainEvent, CancellationToken cancellationToken)
@ -48,5 +48,5 @@
order.Id, order.OrderStatus.Name, buyer.Name, orderStockList);
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToAwaitingValidationIntegrationEvent);
}
}
}
}

+ 4
- 4
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderPaid/OrderStatusChangedToPaidDomainEventHandler.cs View File

@ -19,7 +19,7 @@
private readonly ILoggerFactory _logger;
private readonly IBuyerRepository _buyerRepository;
private readonly IOrderingIntegrationEventService _orderingIntegrationEventService;
public OrderStatusChangedToPaidDomainEventHandler(
IOrderRepository orderRepository, ILoggerFactory logger,
@ -30,7 +30,7 @@
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository));
_orderingIntegrationEventService = orderingIntegrationEventService ?? throw new ArgumentNullException(nameof(orderingIntegrationEventService));
_orderingIntegrationEventService = orderingIntegrationEventService ?? throw new ArgumentNullException(nameof(orderingIntegrationEventService));
}
public async Task Handle(OrderStatusChangedToPaidDomainEvent orderStatusChangedToPaidDomainEvent, CancellationToken cancellationToken)
@ -51,7 +51,7 @@
buyer.Name,
orderStockList);
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent);
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent);
}
}
}
}

+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderShipped/OrderShippedDomainEventHandler.cs View File

@ -20,7 +20,7 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
private readonly ILoggerFactory _logger;
public OrderShippedDomainEventHandler(
IOrderRepository orderRepository,
IOrderRepository orderRepository,
ILoggerFactory logger,
IBuyerRepository buyerRepository,
IOrderingIntegrationEventService orderingIntegrationEventService)


+ 4
- 12
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/SendEmailToCustomerWhenOrderStartedDomainEventHandler.cs View File

@ -1,19 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediatR;
using Ordering.Domain.Events;
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
{
public class SendEmailToCustomerWhenOrderStartedDomainEventHandler
//: IAsyncNotificationHandler<OrderStartedDomainEvent>
{
//: IAsyncNotificationHandler<OrderStartedDomainEvent>
{
public SendEmailToCustomerWhenOrderStartedDomainEventHandler()
{
}
//public async Task Handle(OrderStartedDomainEvent orderNotification)


+ 0
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs View File

@ -1,5 +1,4 @@
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.Extensions.Logging;


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save