Moved all usings to globalusing file

This commit is contained in:
Sumit Ghosh 2021-10-12 17:34:41 +05:30
parent 818995d8b8
commit 666fba815f
77 changed files with 2458 additions and 3026 deletions

View File

@ -1,11 +1,4 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Behaviors
{
public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{ {
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger; private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
@ -20,4 +13,4 @@ namespace Ordering.API.Application.Behaviors
return response; return response;
} }
} }
}

View File

@ -1,16 +1,7 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions; using Microsoft.Extensions.Logging;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Serilog.Context;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Behaviors
{
public class TransactionBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> public class TransactionBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{ {
private readonly ILogger<TransactionBehaviour<TRequest, TResponse>> _logger; private readonly ILogger<TransactionBehaviour<TRequest, TResponse>> _logger;
@ -71,4 +62,3 @@ namespace Ordering.API.Application.Behaviors
} }
} }
} }
}

View File

@ -1,14 +1,5 @@
using FluentValidation; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
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;
namespace Ordering.API.Application.Behaviors
{
public class ValidatorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> public class ValidatorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{ {
private readonly ILogger<ValidatorBehavior<TRequest, TResponse>> _logger; private readonly ILogger<ValidatorBehavior<TRequest, TResponse>> _logger;
@ -43,4 +34,3 @@ namespace Ordering.API.Application.Behaviors
return await next(); return await next();
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class CancelOrderCommand : IRequest<bool> public class CancelOrderCommand : IRequest<bool>
{ {
@ -17,4 +14,3 @@ namespace Ordering.API.Application.Commands
OrderNumber = orderNumber; OrderNumber = orderNumber;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool> public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool>
{ {
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,12 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
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
{
// DDD and CQRS patterns comment: Note that it is recommended to implement immutable Commands // DDD and CQRS patterns comment: Note that it is recommended to implement immutable Commands
// In this case, its immutability is achieved by having all the setters as private // In this case, its immutability is achieved by having all the setters as private
// plus only being able to update the data just once, when creating the object through its constructor. // plus only being able to update the data just once, when creating the object through its constructor.
@ -16,6 +9,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
// http://blog.gauffin.org/2012/06/griffin-container-introducing-command-support/ // http://blog.gauffin.org/2012/06/griffin-container-introducing-command-support/
// https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties // https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
[DataContract] [DataContract]
public class CreateOrderCommand public class CreateOrderCommand
: IRequest<bool> : IRequest<bool>
@ -103,4 +98,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
public string PictureUrl { get; init; } public string PictureUrl { get; init; }
} }
} }
}

View File

@ -1,15 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
{
using Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using global::Ordering.API.Application.IntegrationEvents;
using global::Ordering.API.Application.IntegrationEvents.Events;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
// Regular CommandHandler // Regular CommandHandler
public class CreateOrderCommandHandler public class CreateOrderCommandHandler
@ -79,4 +70,3 @@
return true; // Ignore duplicate requests for creating order. return true; // Ignore duplicate requests for creating order.
} }
} }
}

View File

@ -1,9 +1,6 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Ordering.API.Application.Models; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{
public class CreateOrderDraftCommand : IRequest<OrderDraftDTO> public class CreateOrderDraftCommand : IRequest<OrderDraftDTO>
{ {
@ -17,5 +14,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
Items = items; Items = items;
} }
} }
}

View File

@ -1,15 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
{
using Domain.AggregatesModel.OrderAggregate;
using global::Ordering.API.Application.Models;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand; using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
// Regular CommandHandler // Regular CommandHandler
public class CreateOrderDraftCommandHandler public class CreateOrderDraftCommandHandler
@ -64,8 +56,3 @@
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{
public class IdentifiedCommand<T, R> : IRequest<R> public class IdentifiedCommand<T, R> : IRequest<R>
where T : IRequest<R> where T : IRequest<R>
{ {
@ -14,4 +11,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
Id = id; Id = id;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
{
/// <summary> /// <summary>
/// Provides a base implementation for handling duplicate request and ensuring idempotent updates, in the cases where /// Provides a base implementation for handling duplicate request and ensuring idempotent updates, in the cases where
/// a requestid sent by client is used to detect duplicate requests. /// a requestid sent by client is used to detect duplicate requests.
@ -113,4 +105,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
} }
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class SetAwaitingValidationOrderStatusCommand : IRequest<bool> public class SetAwaitingValidationOrderStatusCommand : IRequest<bool>
{ {
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
OrderNumber = orderNumber; OrderNumber = orderNumber;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class SetAwaitingValidationOrderStatusCommandHandler : IRequestHandler<SetAwaitingValidationOrderStatusCommand, bool> public class SetAwaitingValidationOrderStatusCommandHandler : IRequestHandler<SetAwaitingValidationOrderStatusCommand, bool>
{ {
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class SetPaidOrderStatusCommand : IRequest<bool> public class SetPaidOrderStatusCommand : IRequest<bool>
{ {
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
OrderNumber = orderNumber; OrderNumber = orderNumber;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class SetPaidOrderStatusCommandHandler : IRequestHandler<SetPaidOrderStatusCommand, bool> public class SetPaidOrderStatusCommandHandler : IRequestHandler<SetPaidOrderStatusCommand, bool>
{ {
@ -57,4 +49,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class SetStockConfirmedOrderStatusCommand : IRequest<bool> public class SetStockConfirmedOrderStatusCommand : IRequest<bool>
{ {
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
OrderNumber = orderNumber; OrderNumber = orderNumber;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class SetStockConfirmedOrderStatusCommandHandler : IRequestHandler<SetStockConfirmedOrderStatusCommand, bool> public class SetStockConfirmedOrderStatusCommandHandler : IRequestHandler<SetStockConfirmedOrderStatusCommand, bool>
{ {
@ -57,4 +49,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,9 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class SetStockRejectedOrderStatusCommand : IRequest<bool> public class SetStockRejectedOrderStatusCommand : IRequest<bool>
{ {
@ -19,4 +15,3 @@ namespace Ordering.API.Application.Commands
OrderStockItems = orderStockItems; OrderStockItems = orderStockItems;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class SetStockRejectedOrderStatusCommandHandler : IRequestHandler<SetStockRejectedOrderStatusCommand, bool> public class SetStockRejectedOrderStatusCommandHandler : IRequestHandler<SetStockRejectedOrderStatusCommand, bool>
{ {
@ -58,4 +50,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,8 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using System.Runtime.Serialization;
namespace Ordering.API.Application.Commands
{
public class ShipOrderCommand : IRequest<bool> public class ShipOrderCommand : IRequest<bool>
{ {
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
OrderNumber = orderNumber; OrderNumber = orderNumber;
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.Commands
{
// Regular CommandHandler // Regular CommandHandler
public class ShipOrderCommandHandler : IRequestHandler<ShipOrderCommand, bool> public class ShipOrderCommandHandler : IRequestHandler<ShipOrderCommand, bool>
{ {
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
return true; // Ignore duplicate requests for processing order. return true; // Ignore duplicate requests for processing order.
} }
} }
}

View File

@ -1,13 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVerified;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.Extensions.Logging;
using Ordering.Domain.Events;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVerified
{
public class UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler public class UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler
: INotificationHandler<BuyerAndPaymentMethodVerifiedDomainEvent> : INotificationHandler<BuyerAndPaymentMethodVerifiedDomainEvent>
{ {
@ -35,4 +27,3 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
buyerPaymentMethodVerifiedEvent.OrderId, nameof(buyerPaymentMethodVerifiedEvent.Payment), buyerPaymentMethodVerifiedEvent.Payment.Id); buyerPaymentMethodVerifiedEvent.OrderId, nameof(buyerPaymentMethodVerifiedEvent.Payment), buyerPaymentMethodVerifiedEvent.Payment.Id);
} }
} }
}

View File

@ -1,16 +1,7 @@
using MediatR; using Microsoft.eShopOnContainers.Services.Ordering.Domain.Events;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderCancelled;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using Ordering.Domain.Events;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.DomainEventHandlers.OrderCancelled
{
public class OrderCancelledDomainEventHandler public class OrderCancelledDomainEventHandler
: INotificationHandler<OrderCancelledDomainEvent> : INotificationHandler<OrderCancelledDomainEvent>
{ {
@ -44,4 +35,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderCancelled
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToCancelledIntegrationEvent); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToCancelledIntegrationEvent);
} }
} }
}

View File

@ -1,16 +1,4 @@
namespace Ordering.API.Application.DomainEventHandlers.OrderGracePeriodConfirmed namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderGracePeriodConfirmed;
{
using Domain.Events;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
public class OrderStatusChangedToAwaitingValidationDomainEventHandler public class OrderStatusChangedToAwaitingValidationDomainEventHandler
: INotificationHandler<OrderStatusChangedToAwaitingValidationDomainEvent> : INotificationHandler<OrderStatusChangedToAwaitingValidationDomainEvent>
@ -49,4 +37,3 @@
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToAwaitingValidationIntegrationEvent); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToAwaitingValidationIntegrationEvent);
} }
} }
}

View File

@ -1,16 +1,4 @@
namespace Ordering.API.Application.DomainEventHandlers.OrderPaid namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderPaid;
{
using Domain.Events;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
public class OrderStatusChangedToPaidDomainEventHandler public class OrderStatusChangedToPaidDomainEventHandler
: INotificationHandler<OrderStatusChangedToPaidDomainEvent> : INotificationHandler<OrderStatusChangedToPaidDomainEvent>
@ -54,4 +42,3 @@
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent);
} }
} }
}

View File

@ -1,16 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderShipped;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using Ordering.Domain.Events;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
{
public class OrderShippedDomainEventHandler public class OrderShippedDomainEventHandler
: INotificationHandler<OrderShippedDomainEvent> : INotificationHandler<OrderShippedDomainEvent>
{ {
@ -44,4 +33,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToShippedIntegrationEvent); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToShippedIntegrationEvent);
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
{
public class SendEmailToCustomerWhenOrderStartedDomainEventHandler public class SendEmailToCustomerWhenOrderStartedDomainEventHandler
//: IAsyncNotificationHandler<OrderStartedDomainEvent> //: IAsyncNotificationHandler<OrderStartedDomainEvent>
{ {
@ -13,4 +13,3 @@
// //TBD - Send email logic // //TBD - Send email logic
//} //}
} }
}

View File

@ -1,16 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using Ordering.Domain.Events;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
{
public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
: INotificationHandler<OrderStartedDomainEvent> : INotificationHandler<OrderStartedDomainEvent>
{ {
@ -64,4 +53,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
buyerUpdated.Id, orderStartedEvent.Order.Id); buyerUpdated.Id, orderStartedEvent.Order.Id);
} }
} }
}

View File

@ -1,15 +1,4 @@
namespace Ordering.API.Application.DomainEventHandlers.OrderStockConfirmed namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStockConfirmed;
{
using Domain.Events;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents;
using Ordering.API.Application.IntegrationEvents.Events;
using System;
using System.Threading;
using System.Threading.Tasks;
public class OrderStatusChangedToStockConfirmedDomainEventHandler public class OrderStatusChangedToStockConfirmedDomainEventHandler
: INotificationHandler<OrderStatusChangedToStockConfirmedDomainEvent> : INotificationHandler<OrderStatusChangedToStockConfirmedDomainEvent>
@ -44,4 +33,3 @@
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToStockConfirmedIntegrationEvent); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToStockConfirmedIntegrationEvent);
} }
} }
}

View File

@ -1,14 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using Ordering.API.Application.IntegrationEvents.Events;
using Serilog.Context;
using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents.EventHandling
{
public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent> public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>
{ {
private readonly IMediator _mediator; private readonly IMediator _mediator;
@ -49,4 +40,3 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
} }
} }
} }
}

View File

@ -1,14 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.EventHandling namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
{
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using Ordering.API.Application.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
public class OrderPaymentFailedIntegrationEventHandler : public class OrderPaymentFailedIntegrationEventHandler :
IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent> IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>
@ -43,4 +33,3 @@
} }
} }
} }
}

View File

@ -1,14 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.EventHandling namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
{
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using Ordering.API.Application.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
public class OrderPaymentSucceededIntegrationEventHandler : public class OrderPaymentSucceededIntegrationEventHandler :
IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent> IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>
@ -43,4 +33,3 @@
} }
} }
} }
}

View File

@ -1,14 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.EventHandling namespace Ordering.API.Application.IntegrationEvents.EventHandling;
{
using Events;
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using Serilog.Context;
using System;
using System.Threading.Tasks;
public class OrderStockConfirmedIntegrationEventHandler : public class OrderStockConfirmedIntegrationEventHandler :
IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent> IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>
@ -43,4 +33,3 @@
} }
} }
} }
}

View File

@ -1,15 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.EventHandling namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
{
using Events;
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using Serilog.Context;
using System.Linq;
using System.Threading.Tasks;
public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandler<OrderStockRejectedIntegrationEvent> public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>
{ {
private readonly IMediator _mediator; private readonly IMediator _mediator;
@ -47,4 +36,3 @@
} }
} }
} }
}

View File

@ -1,15 +1,5 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents.EventHandling
{
public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent> public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>
{ {
private readonly IMediator _mediator; private readonly IMediator _mediator;
@ -77,4 +67,3 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
} }
} }
} }
}

View File

@ -1,6 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
{ {
@ -9,4 +7,4 @@
public GracePeriodConfirmedIntegrationEvent(int orderId) => public GracePeriodConfirmedIntegrationEvent(int orderId) =>
OrderId = orderId; OrderId = orderId;
} }
}

View File

@ -1,6 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
{ {
@ -8,4 +6,3 @@
public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId; public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId;
} }
}

View File

@ -1,6 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
{ {
@ -8,4 +6,3 @@
public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId; public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId;
} }
}

View File

@ -1,7 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
namespace Ordering.API.Application.IntegrationEvents.Events
{
// Integration Events notes: // Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be // 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. // An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
@ -12,4 +10,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
public OrderStartedIntegrationEvent(string userId) public OrderStartedIntegrationEvent(string userId)
=> UserId = userId; => UserId = userId;
} }
}

View File

@ -1,7 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{ {
@ -31,4 +28,3 @@
Units = units; Units = units;
} }
} }
}

View File

@ -1,7 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
{ {
public int OrderId { get; } public int OrderId { get; }
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
BuyerName = buyerName; BuyerName = buyerName;
} }
} }
}

View File

@ -1,7 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{ {
@ -21,4 +18,4 @@
BuyerName = buyerName; BuyerName = buyerName;
} }
} }
}

View File

@ -1,7 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{ {
public int OrderId { get; } public int OrderId { get; }
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
BuyerName = buyerName; BuyerName = buyerName;
} }
} }
}

View File

@ -1,6 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{ {
@ -15,4 +13,3 @@
BuyerName = buyerName; BuyerName = buyerName;
} }
} }
}

View File

@ -1,7 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
{ {
public int OrderId { get; } public int OrderId { get; }
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
BuyerName = buyerName; BuyerName = buyerName;
} }
} }
}

View File

@ -1,6 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{ {
@ -8,4 +6,3 @@
public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId; public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId;
} }
}

View File

@ -1,7 +1,4 @@
namespace Ordering.API.Application.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public record OrderStockRejectedIntegrationEvent : IntegrationEvent public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{ {
@ -28,4 +25,3 @@
HasStock = hasStock; HasStock = hasStock;
} }
} }
}

View File

@ -1,9 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
using Ordering.API.Application.Models;
using System;
namespace Ordering.API.Application.IntegrationEvents.Events
{
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
{ {
public string UserId { get; } public string UserId { get; }
@ -59,4 +55,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
} }
} }
}

View File

@ -1,12 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
using System;
using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents
{
public interface IOrderingIntegrationEventService public interface IOrderingIntegrationEventService
{ {
Task PublishEventsThroughEventBusAsync(Guid transactionId); Task PublishEventsThroughEventBusAsync(Guid transactionId);
Task AddAndSaveEventAsync(IntegrationEvent evt); Task AddAndSaveEventAsync(IntegrationEvent evt);
} }
}

View File

@ -1,16 +1,5 @@
using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Logging;
using System;
using System.Data.Common;
using System.Threading.Tasks;
namespace Ordering.API.Application.IntegrationEvents
{
public class OrderingIntegrationEventService : IOrderingIntegrationEventService public class OrderingIntegrationEventService : IOrderingIntegrationEventService
{ {
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory; private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
@ -62,4 +51,3 @@ namespace Ordering.API.Application.IntegrationEvents
await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction()); await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction());
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace Ordering.API.Application.Models namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
{
public class BasketItem public class BasketItem
{ {
public string Id { get; init; } public string Id { get; init; }
@ -10,4 +10,4 @@
public int Quantity { get; init; } public int Quantity { get; init; }
public string PictureUrl { get; init; } public string PictureUrl { get; init; }
} }
}

View File

@ -1,7 +1,5 @@
using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
namespace Ordering.API.Application.Models
{
public class CustomerBasket public class CustomerBasket
{ {
public string BuyerId { get; set; } public string BuyerId { get; set; }
@ -13,4 +11,3 @@ namespace Ordering.API.Application.Models
Items = items; Items = items;
} }
} }
}

View File

@ -1,8 +1,4 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
public interface IOrderQueries public interface IOrderQueries
{ {
@ -12,4 +8,3 @@
Task<IEnumerable<CardType>> GetCardTypesAsync(); Task<IEnumerable<CardType>> GetCardTypesAsync();
} }
}

View File

@ -1,10 +1,4 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
{
using Dapper;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Threading.Tasks;
public class OrderQueries public class OrderQueries
: IOrderQueries : IOrderQueries
@ -102,4 +96,3 @@
return order; return order;
} }
} }
}

View File

@ -1,8 +1,5 @@
using System; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
{
public record Orderitem public record Orderitem
{ {
public string productname { get; init; } public string productname { get; init; }
@ -38,4 +35,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
public int Id { get; init; } public int Id { get; init; }
public string Name { get; init; } public string Name { get; init; }
} }
}

View File

@ -1,9 +1,5 @@
using FluentValidation; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
namespace Ordering.API.Application.Validations
{
public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand> public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand>
{ {
public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger) public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger)
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
} }
} }
}

View File

@ -1,13 +1,7 @@
using FluentValidation; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand; using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
namespace Ordering.API.Application.Validations
{
public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand> public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
{ {
public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger) public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger)
@ -37,4 +31,3 @@ namespace Ordering.API.Application.Validations
return orderItems.Any(); return orderItems.Any();
} }
} }
}

View File

@ -1,9 +1,5 @@
using FluentValidation; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.Extensions.Logging;
namespace Ordering.API.Application.Validations
{
public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand, bool>> public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand, bool>>
{ {
public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger) public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger)
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
} }
} }
}

View File

@ -1,9 +1,5 @@
using FluentValidation; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
namespace Ordering.API.Application.Validations
{
public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand> public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand>
{ {
public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger) public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger)
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
} }
} }
}

View File

@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Mvc; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
{
public class HomeController : Controller public class HomeController : Controller
{ {
// GET: /<controller>/ // GET: /<controller>/
@ -10,4 +8,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
return new RedirectResult("~/swagger"); return new RedirectResult("~/swagger");
} }
} }
}

View File

@ -1,19 +1,10 @@
using MediatR; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services; using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using Microsoft.Extensions.Logging;
using Ordering.API.Application.Commands;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
{
[Route("api/v1/[controller]")] [Route("api/v1/[controller]")]
[Authorize] [Authorize]
[ApiController] [ApiController]
@ -150,4 +141,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
return await _mediator.Send(createOrderDraftCommand); return await _mediator.Send(createOrderDraftCommand);
} }
} }
}

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
using System.Collections.Generic;
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand; using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
namespace Ordering.API.Application.Models
{
public static class BasketItemExtensions public static class BasketItemExtensions
{ {
public static IEnumerable<OrderItemDTO> ToOrderItemsDTO(this IEnumerable<BasketItem> basketItems) public static IEnumerable<OrderItemDTO> ToOrderItemsDTO(this IEnumerable<BasketItem> basketItems)
@ -25,4 +25,3 @@ namespace Ordering.API.Application.Models
}; };
} }
} }
}

View File

@ -1,9 +1,5 @@
using System; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Extensions;
using System.Collections.Generic;
using System.Linq;
namespace Ordering.API.Extensions
{
public static class LinqSelectExtensions public static class LinqSelectExtensions
{ {
public static IEnumerable<SelectTryResult<TSource, TResult>> SelectTry<TSource, TResult>(this IEnumerable<TSource> enumerable, Func<TSource, TResult> selector) public static IEnumerable<SelectTryResult<TSource, TResult>> SelectTry<TSource, TResult>(this IEnumerable<TSource> enumerable, Func<TSource, TResult> selector)
@ -47,4 +43,3 @@ namespace Ordering.API.Extensions
public Exception CaughtException { get; private set; } public Exception CaughtException { get; private set; }
} }
} }
}

View File

@ -1,16 +1,5 @@
using Google.Protobuf.Collections; namespace GrpcOrdering;
using Grpc.Core;
using MediatR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ApiModels = Ordering.API.Application.Models;
using AppCommand = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
namespace GrpcOrdering
{
public class OrderingService : OrderingGrpc.OrderingGrpcBase public class OrderingService : OrderingGrpc.OrderingGrpcBase
{ {
private readonly IMediator _mediator; private readonly IMediator _mediator;
@ -87,4 +76,3 @@ namespace GrpcOrdering
}); });
} }
} }
}

View File

@ -1,7 +1,4 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.ActionResults namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.ActionResults;
{
using AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
public class InternalServerErrorObjectResult : ObjectResult public class InternalServerErrorObjectResult : ObjectResult
{ {
@ -11,4 +8,3 @@
StatusCode = StatusCodes.Status500InternalServerError; StatusCode = StatusCodes.Status500InternalServerError;
} }
} }
}

View File

@ -1,11 +1,5 @@
using Microsoft.AspNetCore.Mvc.Authorization; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth
{
public class AuthorizationHeaderParameterOperationFilter : IOperationFilter public class AuthorizationHeaderParameterOperationFilter : IOperationFilter
{ {
public void Apply(OpenApiOperation operation, OperationFilterContext context) public void Apply(OpenApiOperation operation, OperationFilterContext context)
@ -31,4 +25,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth
} }
} }
}

View File

@ -1,15 +1,4 @@
using Autofac; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
using System.Reflection;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules
{
public class ApplicationModule public class ApplicationModule
: Autofac.Module : Autofac.Module
@ -47,4 +36,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
} }
} }
}

View File

@ -1,15 +1,5 @@
using Autofac; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
using FluentValidation;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Ordering.API.Application.Behaviors;
using Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
using Ordering.API.Application.Validations;
using System.Linq;
using System.Reflection;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules
{
public class MediatorModule : Autofac.Module public class MediatorModule : Autofac.Module
{ {
protected override void Load(ContainerBuilder builder) protected override void Load(ContainerBuilder builder)
@ -44,4 +34,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
} }
} }
}

View File

@ -1,10 +1,4 @@
using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Factories
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace Ordering.API.Infrastructure.Factories
{ {
public class OrderingDbContextFactory : IDesignTimeDbContextFactory<OrderingContext> public class OrderingDbContextFactory : IDesignTimeDbContextFactory<OrderingContext>
{ {

View File

@ -1,11 +1,5 @@
using Microsoft.AspNetCore.Authorization; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Ordering.API.Infrastructure.Filters
{
public class AuthorizeCheckOperationFilter : IOperationFilter public class AuthorizeCheckOperationFilter : IOperationFilter
{ {
public void Apply(OpenApiOperation operation, OperationFilterContext context) public void Apply(OpenApiOperation operation, OperationFilterContext context)
@ -33,4 +27,3 @@ namespace Ordering.API.Infrastructure.Filters
}; };
} }
} }
}

View File

@ -1,14 +1,4 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;
{
using AspNetCore.Mvc;
using global::Ordering.Domain.Exceptions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.ActionResults;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Net;
public class HttpGlobalExceptionFilter : IExceptionFilter public class HttpGlobalExceptionFilter : IExceptionFilter
{ {
@ -68,4 +58,3 @@
public object DeveloperMessage { get; set; } public object DeveloperMessage { get; set; }
} }
} }
}

View File

@ -1,22 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
{
using global::Ordering.API.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Ordering.Infrastructure;
using Polly;
using Polly.Retry;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public class OrderingContextSeed public class OrderingContextSeed
{ {
@ -188,4 +172,3 @@
); );
} }
} }
}

View File

@ -1,9 +1,9 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
{
public interface IIdentityService public interface IIdentityService
{ {
string GetUserIdentity(); string GetUserIdentity();
string GetUserName(); string GetUserName();
} }
}

View File

@ -1,9 +1,5 @@
 namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
using Microsoft.AspNetCore.Http;
using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services
{
public class IdentityService : IIdentityService public class IdentityService : IIdentityService
{ {
private IHttpContextAccessor _context; private IHttpContextAccessor _context;
@ -23,4 +19,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Servi
return _context.HttpContext.User.Identity.Name; return _context.HttpContext.User.Identity.Name;
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API namespace Microsoft.eShopOnContainers.Services.Ordering.API;
{
public class OrderingSettings public class OrderingSettings
{ {
public bool UseCustomizationData { get; set; } public bool UseCustomizationData { get; set; }
@ -12,4 +12,3 @@
public int CheckUpdateTime { get; set; } public int CheckUpdateTime { get; set; }
} }
}

View File

@ -1,22 +1,4 @@
using Microsoft.AspNetCore; var configuration = GetConfiguration();
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Ordering.API;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Serilog;
using System;
using System.IO;
using System.Net;
using Azure.Identity;
using Azure.Core;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration); Log.Logger = CreateSerilogLogger(configuration);

View File

@ -1,42 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API 
{ namespace Microsoft.eShopOnContainers.Services.Ordering.API;
using AspNetCore.Http;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using global::Ordering.API.Application.IntegrationEvents;
using global::Ordering.API.Application.IntegrationEvents.Events;
using global::Ordering.API.Infrastructure.Filters;
using GrpcOrdering;
using HealthChecks.UI.Client;
using Infrastructure.AutofacModules;
using Infrastructure.Filters;
using Infrastructure.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using Ordering.Infrastructure;
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Reflection;
public class Startup public class Startup
{ {
@ -426,4 +389,3 @@
return services; return services;
} }
} }
}