Moved all usings to globalusing file
This commit is contained in:
parent
818995d8b8
commit
666fba815f
@ -1,11 +1,4 @@
|
||||
using MediatR;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.API.Application.Behaviors
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
|
||||
public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
|
||||
@ -20,4 +13,4 @@ namespace Ordering.API.Application.Behaviors
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,7 @@
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Ordering.API.Application.Behaviors
|
||||
{
|
||||
public class TransactionBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly ILogger<TransactionBehaviour<TRequest, TResponse>> _logger;
|
||||
@ -71,4 +62,3 @@ namespace Ordering.API.Application.Behaviors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,5 @@
|
||||
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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Behaviors;
|
||||
|
||||
namespace Ordering.API.Application.Behaviors
|
||||
{
|
||||
public class ValidatorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly ILogger<ValidatorBehavior<TRequest, TResponse>> _logger;
|
||||
@ -43,4 +34,3 @@ namespace Ordering.API.Application.Behaviors
|
||||
return await next();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class CancelOrderCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -17,4 +14,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool>
|
||||
{
|
||||
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,5 @@
|
||||
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;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.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
|
||||
// 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/
|
||||
// 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]
|
||||
public class CreateOrderCommand
|
||||
: IRequest<bool>
|
||||
@ -103,4 +98,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
public string PictureUrl { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,6 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
{
|
||||
using 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderCommandHandler
|
||||
@ -79,4 +70,3 @@
|
||||
return true; // Ignore duplicate requests for creating order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
using MediatR;
|
||||
using Ordering.API.Application.Models;
|
||||
using System.Collections.Generic;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
{
|
||||
public class CreateOrderDraftCommand : IRequest<OrderDraftDTO>
|
||||
{
|
||||
|
||||
@ -17,5 +14,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,7 @@
|
||||
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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderDraftCommandHandler
|
||||
@ -64,8 +56,3 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
{
|
||||
public class IdentifiedCommand<T, R> : IRequest<R>
|
||||
where T : IRequest<R>
|
||||
{
|
||||
@ -14,4 +11,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
@ -113,4 +105,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class SetAwaitingValidationOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetAwaitingValidationOrderStatusCommandHandler : IRequestHandler<SetAwaitingValidationOrderStatusCommand, bool>
|
||||
{
|
||||
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class SetPaidOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetPaidOrderStatusCommandHandler : IRequestHandler<SetPaidOrderStatusCommand, bool>
|
||||
{
|
||||
@ -57,4 +49,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class SetStockConfirmedOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetStockConfirmedOrderStatusCommandHandler : IRequestHandler<SetStockConfirmedOrderStatusCommand, bool>
|
||||
{
|
||||
@ -57,4 +49,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class SetStockRejectedOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -19,4 +15,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderStockItems = orderStockItems;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetStockRejectedOrderStatusCommandHandler : IRequestHandler<SetStockRejectedOrderStatusCommand, bool>
|
||||
{
|
||||
@ -58,4 +50,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
public class ShipOrderCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
@ -14,4 +11,3 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class ShipOrderCommandHandler : IRequestHandler<ShipOrderCommand, bool>
|
||||
{
|
||||
@ -54,4 +46,3 @@ namespace Ordering.API.Application.Commands
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVerified;
|
||||
|
||||
namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVerified
|
||||
{
|
||||
public class UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler
|
||||
: INotificationHandler<BuyerAndPaymentMethodVerifiedDomainEvent>
|
||||
{
|
||||
@ -35,4 +27,3 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
|
||||
buyerPaymentMethodVerifiedEvent.OrderId, nameof(buyerPaymentMethodVerifiedEvent.Payment), buyerPaymentMethodVerifiedEvent.Payment.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,7 @@
|
||||
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 Ordering.Domain.Events;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Events;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderCancelled;
|
||||
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderCancelled
|
||||
{
|
||||
public class OrderCancelledDomainEventHandler
|
||||
: INotificationHandler<OrderCancelledDomainEvent>
|
||||
{
|
||||
@ -44,4 +35,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderCancelled
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToCancelledIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,4 @@
|
||||
namespace 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderGracePeriodConfirmed;
|
||||
|
||||
public class OrderStatusChangedToAwaitingValidationDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToAwaitingValidationDomainEvent>
|
||||
@ -49,4 +37,3 @@
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToAwaitingValidationIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,4 @@
|
||||
namespace 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderPaid;
|
||||
|
||||
public class OrderStatusChangedToPaidDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToPaidDomainEvent>
|
||||
@ -54,4 +42,3 @@
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,5 @@
|
||||
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 Ordering.Domain.Events;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderShipped;
|
||||
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
|
||||
{
|
||||
public class OrderShippedDomainEventHandler
|
||||
: INotificationHandler<OrderShippedDomainEvent>
|
||||
{
|
||||
@ -44,4 +33,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToShippedIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
|
||||
|
||||
public class SendEmailToCustomerWhenOrderStartedDomainEventHandler
|
||||
//: IAsyncNotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
@ -13,4 +13,3 @@
|
||||
// //TBD - Send email logic
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
|
||||
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
{
|
||||
public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
|
||||
: INotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
@ -64,4 +53,3 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
buyerUpdated.Id, orderStartedEvent.Order.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,4 @@
|
||||
namespace 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStockConfirmed;
|
||||
|
||||
public class OrderStatusChangedToStockConfirmedDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToStockConfirmedDomainEvent>
|
||||
@ -44,4 +33,3 @@
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToStockConfirmedIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,5 @@
|
||||
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.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
{
|
||||
public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
@ -49,4 +40,3 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,4 @@
|
||||
namespace 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
|
||||
public class OrderPaymentFailedIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>
|
||||
@ -43,4 +33,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,4 @@
|
||||
namespace 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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
|
||||
public class OrderPaymentSucceededIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>
|
||||
@ -43,4 +33,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,4 @@
|
||||
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;
|
||||
namespace Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
|
||||
public class OrderStockConfirmedIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>
|
||||
@ -43,4 +33,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,4 @@
|
||||
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.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
@ -47,4 +36,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,5 @@
|
||||
using MediatR;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
{
|
||||
public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
@ -77,4 +67,3 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -9,4 +7,4 @@
|
||||
public GracePeriodConfirmedIntegrationEvent(int orderId) =>
|
||||
OrderId = orderId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -8,4 +6,3 @@
|
||||
|
||||
public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -8,4 +6,3 @@
|
||||
|
||||
public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -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:
|
||||
// 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.
|
||||
@ -12,4 +10,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
public OrderStartedIntegrationEvent(string userId)
|
||||
=> UserId = userId;
|
||||
}
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -31,4 +28,3 @@
|
||||
Units = units;
|
||||
}
|
||||
}
|
||||
}
|
@ -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 int OrderId { get; }
|
||||
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -21,4 +18,4 @@
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 int OrderId { get; }
|
||||
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -15,4 +13,3 @@
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
@ -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 int OrderId { get; }
|
||||
@ -15,4 +13,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -8,4 +6,3 @@
|
||||
|
||||
public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
@ -28,4 +25,3 @@
|
||||
HasStock = hasStock;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using Ordering.API.Application.Models;
|
||||
using System;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; }
|
||||
@ -59,4 +55,3 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,7 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents
|
||||
{
|
||||
public interface IOrderingIntegrationEventService
|
||||
{
|
||||
Task PublishEventsThroughEventBusAsync(Guid transactionId);
|
||||
Task AddAndSaveEventAsync(IntegrationEvent evt);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
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 Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents
|
||||
{
|
||||
public class OrderingIntegrationEventService : IOrderingIntegrationEventService
|
||||
{
|
||||
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
|
||||
@ -62,4 +51,3 @@ namespace Ordering.API.Application.IntegrationEvents
|
||||
await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace Ordering.API.Application.Models
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
||||
|
||||
public class BasketItem
|
||||
{
|
||||
public string Id { get; init; }
|
||||
@ -10,4 +10,4 @@
|
||||
public int Quantity { get; init; }
|
||||
public string PictureUrl { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 string BuyerId { get; set; }
|
||||
@ -13,4 +11,3 @@ namespace Ordering.API.Application.Models
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||
|
||||
public interface IOrderQueries
|
||||
{
|
||||
@ -12,4 +8,3 @@
|
||||
|
||||
Task<IEnumerable<CardType>> GetCardTypesAsync();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
|
||||
{
|
||||
using Dapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||
|
||||
public class OrderQueries
|
||||
: IOrderQueries
|
||||
@ -102,4 +96,3 @@
|
||||
return order;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
|
||||
{
|
||||
public record Orderitem
|
||||
{
|
||||
public string productname { get; init; }
|
||||
@ -38,4 +35,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Ordering.API.Application.Commands;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
|
||||
|
||||
namespace Ordering.API.Application.Validations
|
||||
{
|
||||
public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand>
|
||||
{
|
||||
public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger)
|
||||
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,7 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
|
||||
|
||||
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
|
||||
|
||||
namespace Ordering.API.Application.Validations
|
||||
{
|
||||
public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
|
||||
{
|
||||
public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger)
|
||||
@ -37,4 +31,3 @@ namespace Ordering.API.Application.Validations
|
||||
return orderItems.Any();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
using Microsoft.Extensions.Logging;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
|
||||
|
||||
namespace Ordering.API.Application.Validations
|
||||
{
|
||||
public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand, bool>>
|
||||
{
|
||||
public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger)
|
||||
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Ordering.API.Application.Commands;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Validations;
|
||||
|
||||
namespace Ordering.API.Application.Validations
|
||||
{
|
||||
public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand>
|
||||
{
|
||||
public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger)
|
||||
@ -13,4 +9,3 @@ namespace Ordering.API.Application.Validations
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
// GET: /<controller>/
|
||||
@ -10,4 +8,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
return new RedirectResult("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,10 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
||||
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||
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]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
@ -150,4 +141,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
return await _mediator.Send(createOrderDraftCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
namespace Ordering.API.Application.Models
|
||||
{
|
||||
public static class BasketItemExtensions
|
||||
{
|
||||
public static IEnumerable<OrderItemDTO> ToOrderItemsDTO(this IEnumerable<BasketItem> basketItems)
|
||||
@ -25,4 +25,3 @@ namespace Ordering.API.Application.Models
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Extensions;
|
||||
|
||||
namespace Ordering.API.Extensions
|
||||
{
|
||||
public static class LinqSelectExtensions
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,5 @@
|
||||
using Google.Protobuf.Collections;
|
||||
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;
|
||||
|
||||
namespace GrpcOrdering
|
||||
{
|
||||
public class OrderingService : OrderingGrpc.OrderingGrpcBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
@ -87,4 +76,3 @@ namespace GrpcOrdering
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.ActionResults
|
||||
{
|
||||
using AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.ActionResults;
|
||||
|
||||
public class InternalServerErrorObjectResult : ObjectResult
|
||||
{
|
||||
@ -11,4 +8,3 @@
|
||||
StatusCode = StatusCodes.Status500InternalServerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth
|
||||
{
|
||||
public class AuthorizationHeaderParameterOperationFilter : IOperationFilter
|
||||
{
|
||||
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
||||
@ -31,4 +25,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,4 @@
|
||||
using Autofac;
|
||||
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
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
|
||||
|
||||
public class ApplicationModule
|
||||
: Autofac.Module
|
||||
@ -47,4 +36,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,5 @@
|
||||
using Autofac;
|
||||
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;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules
|
||||
{
|
||||
public class MediatorModule : Autofac.Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
@ -44,4 +34,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.IO;
|
||||
|
||||
namespace Ordering.API.Infrastructure.Factories
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Factories
|
||||
{
|
||||
public class OrderingDbContextFactory : IDesignTimeDbContextFactory<OrderingContext>
|
||||
{
|
||||
|
@ -1,11 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;
|
||||
|
||||
namespace Ordering.API.Infrastructure.Filters
|
||||
{
|
||||
public class AuthorizeCheckOperationFilter : IOperationFilter
|
||||
{
|
||||
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
||||
@ -33,4 +27,3 @@ namespace Ordering.API.Infrastructure.Filters
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,4 @@
|
||||
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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;
|
||||
|
||||
public class HttpGlobalExceptionFilter : IExceptionFilter
|
||||
{
|
||||
@ -68,4 +58,3 @@
|
||||
public object DeveloperMessage { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,6 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure
|
||||
{
|
||||
using global::Ordering.API.Extensions;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
|
||||
|
||||
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
|
||||
{
|
||||
@ -188,4 +172,3 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
||||
|
||||
public interface IIdentityService
|
||||
{
|
||||
string GetUserIdentity();
|
||||
|
||||
string GetUserName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services
|
||||
{
|
||||
public class IdentityService : IIdentityService
|
||||
{
|
||||
private IHttpContextAccessor _context;
|
||||
@ -23,4 +19,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Servi
|
||||
return _context.HttpContext.User.Identity.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API
|
||||
{
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API;
|
||||
|
||||
public class OrderingSettings
|
||||
{
|
||||
public bool UseCustomizationData { get; set; }
|
||||
@ -12,4 +12,3 @@
|
||||
|
||||
public int CheckUpdateTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,4 @@
|
||||
using Microsoft.AspNetCore;
|
||||
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();
|
||||
var configuration = GetConfiguration();
|
||||
|
||||
Log.Logger = CreateSerilogLogger(configuration);
|
||||
|
||||
|
@ -1,42 +1,5 @@
|
||||
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;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API;
|
||||
|
||||
public class Startup
|
||||
{
|
||||
@ -426,4 +389,3 @@
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user