Moved all usings to globalusing file
This commit is contained in:
parent
818995d8b8
commit
666fba815f
@ -1,13 +1,6 @@
|
||||
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>
|
||||
{
|
||||
public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
|
||||
public LoggingBehavior(ILogger<LoggingBehavior<TRequest, TResponse>> logger) => _logger = logger;
|
||||
|
||||
@ -19,5 +12,5 @@ namespace Ordering.API.Application.Behaviors
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,9 @@
|
||||
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;
|
||||
|
||||
namespace Ordering.API.Application.Behaviors
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
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 OrderingContext _dbContext;
|
||||
private readonly IOrderingIntegrationEventService _orderingIntegrationEventService;
|
||||
@ -70,5 +61,4 @@ namespace Ordering.API.Application.Behaviors
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,7 @@
|
||||
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>
|
||||
{
|
||||
public class ValidatorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly ILogger<ValidatorBehavior<TRequest, TResponse>> _logger;
|
||||
private readonly IValidator<TRequest>[] _validators;
|
||||
|
||||
@ -42,5 +33,4 @@ namespace Ordering.API.Application.Behaviors
|
||||
|
||||
return await next();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
public class CancelOrderCommand : IRequest<bool>
|
||||
{
|
||||
public class CancelOrderCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; set; }
|
||||
@ -16,5 +13,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public CancelOrderCommandHandler(IOrderRepository orderRepository)
|
||||
@ -35,12 +27,12 @@ namespace Ordering.API.Application.Commands
|
||||
orderToUpdate.SetCancelledStatus();
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class CancelOrderIdentifiedCommandHandler : IdentifiedCommandHandler<CancelOrderCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class CancelOrderIdentifiedCommandHandler : IdentifiedCommandHandler<CancelOrderCommand, bool>
|
||||
{
|
||||
public CancelOrderIdentifiedCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -53,5 +45,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,20 @@
|
||||
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.
|
||||
// References on Immutable Commands:
|
||||
// http://cqrs.nu/Faq
|
||||
// https://docs.spine3.org/motivation/immutability.html
|
||||
// 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
|
||||
// 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.
|
||||
// References on Immutable Commands:
|
||||
// http://cqrs.nu/Faq
|
||||
// https://docs.spine3.org/motivation/immutability.html
|
||||
// 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
|
||||
|
||||
[DataContract]
|
||||
public class CreateOrderCommand
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
||||
|
||||
[DataContract]
|
||||
public class CreateOrderCommand
|
||||
: IRequest<bool>
|
||||
{
|
||||
{
|
||||
[DataMember]
|
||||
private readonly List<OrderItemDTO> _orderItems;
|
||||
|
||||
@ -102,5 +97,5 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
|
||||
public string PictureUrl { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,11 @@
|
||||
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;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderCommandHandler
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderCommandHandler
|
||||
: IRequestHandler<CreateOrderCommand, bool>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IIdentityService _identityService;
|
||||
private readonly IMediator _mediator;
|
||||
@ -60,12 +51,12 @@
|
||||
return await _orderRepository.UnitOfWork
|
||||
.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class CreateOrderIdentifiedCommandHandler : IdentifiedCommandHandler<CreateOrderCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class CreateOrderIdentifiedCommandHandler : IdentifiedCommandHandler<CreateOrderCommand, bool>
|
||||
{
|
||||
public CreateOrderIdentifiedCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -78,5 +69,4 @@
|
||||
{
|
||||
return true; // Ignore duplicate requests for creating order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
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>
|
||||
{
|
||||
public class CreateOrderDraftCommand : IRequest<OrderDraftDTO>
|
||||
{
|
||||
|
||||
public string BuyerId { get; private set; }
|
||||
|
||||
@ -16,6 +13,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
BuyerId = buyerId;
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,12 @@
|
||||
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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderDraftCommandHandler
|
||||
using static Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands.CreateOrderCommand;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
// Regular CommandHandler
|
||||
public class CreateOrderDraftCommandHandler
|
||||
: IRequestHandler<CreateOrderDraftCommand, OrderDraftDTO>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IIdentityService _identityService;
|
||||
private readonly IMediator _mediator;
|
||||
@ -38,11 +30,11 @@
|
||||
|
||||
return Task.FromResult(OrderDraftDTO.FromOrder(order));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public record OrderDraftDTO
|
||||
{
|
||||
public record OrderDraftDTO
|
||||
{
|
||||
public IEnumerable<OrderItemDTO> OrderItems { get; init; }
|
||||
public decimal Total { get; init; }
|
||||
|
||||
@ -63,9 +55,4 @@
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
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>
|
||||
public class IdentifiedCommand<T, R> : IRequest<R>
|
||||
where T : IRequest<R>
|
||||
{
|
||||
{
|
||||
public T Command { get; }
|
||||
public Guid Id { get; }
|
||||
public IdentifiedCommand(T command, Guid id)
|
||||
@ -13,5 +10,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
Command = command;
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,14 @@
|
||||
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.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the command handler that performs the operation if request is not duplicated</typeparam>
|
||||
/// <typeparam name="R">Return value of the inner command handler</typeparam>
|
||||
public class IdentifiedCommandHandler<T, R> : IRequestHandler<IdentifiedCommand<T, R>, R>
|
||||
/// <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.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the command handler that performs the operation if request is not duplicated</typeparam>
|
||||
/// <typeparam name="R">Return value of the inner command handler</typeparam>
|
||||
public class IdentifiedCommandHandler<T, R> : IRequestHandler<IdentifiedCommand<T, R>, R>
|
||||
where T : IRequest<R>
|
||||
{
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IRequestManager _requestManager;
|
||||
private readonly ILogger<IdentifiedCommandHandler<T, R>> _logger;
|
||||
@ -112,5 +104,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
public class SetAwaitingValidationOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
public class SetAwaitingValidationOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
@ -13,5 +10,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetAwaitingValidationOrderStatusCommandHandler : IRequestHandler<SetAwaitingValidationOrderStatusCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public SetAwaitingValidationOrderStatusCommandHandler(IOrderRepository orderRepository)
|
||||
@ -35,12 +27,12 @@ namespace Ordering.API.Application.Commands
|
||||
orderToUpdate.SetAwaitingValidationStatus();
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class SetAwaitingValidationIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler<SetAwaitingValidationOrderStatusCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class SetAwaitingValidationIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler<SetAwaitingValidationOrderStatusCommand, bool>
|
||||
{
|
||||
public SetAwaitingValidationIdentifiedOrderStatusCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -53,5 +45,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
public class SetPaidOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
public class SetPaidOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
@ -13,5 +10,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetPaidOrderStatusCommandHandler : IRequestHandler<SetPaidOrderStatusCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public SetPaidOrderStatusCommandHandler(IOrderRepository orderRepository)
|
||||
@ -38,12 +30,12 @@ namespace Ordering.API.Application.Commands
|
||||
orderToUpdate.SetPaidStatus();
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class SetPaidIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler<SetPaidOrderStatusCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class SetPaidIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler<SetPaidOrderStatusCommand, bool>
|
||||
{
|
||||
public SetPaidIdentifiedOrderStatusCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -56,5 +48,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
public class SetStockConfirmedOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
public class SetStockConfirmedOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
@ -13,5 +10,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetStockConfirmedOrderStatusCommandHandler : IRequestHandler<SetStockConfirmedOrderStatusCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public SetStockConfirmedOrderStatusCommandHandler(IOrderRepository orderRepository)
|
||||
@ -38,12 +30,12 @@ namespace Ordering.API.Application.Commands
|
||||
orderToUpdate.SetStockConfirmedStatus();
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class SetStockConfirmedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler<SetStockConfirmedOrderStatusCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class SetStockConfirmedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler<SetStockConfirmedOrderStatusCommand, bool>
|
||||
{
|
||||
public SetStockConfirmedOrderStatusIdenfifiedCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -56,5 +48,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,7 @@
|
||||
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>
|
||||
{
|
||||
public class SetStockRejectedOrderStatusCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
@ -18,5 +14,4 @@ namespace Ordering.API.Application.Commands
|
||||
OrderNumber = orderNumber;
|
||||
OrderStockItems = orderStockItems;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class SetStockRejectedOrderStatusCommandHandler : IRequestHandler<SetStockRejectedOrderStatusCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public SetStockRejectedOrderStatusCommandHandler(IOrderRepository orderRepository)
|
||||
@ -39,12 +31,12 @@ namespace Ordering.API.Application.Commands
|
||||
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class SetStockRejectedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler<SetStockRejectedOrderStatusCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class SetStockRejectedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler<SetStockRejectedOrderStatusCommand, bool>
|
||||
{
|
||||
public SetStockRejectedOrderStatusIdenfifiedCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -57,5 +49,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
|
||||
namespace Ordering.API.Application.Commands
|
||||
public class ShipOrderCommand : IRequest<bool>
|
||||
{
|
||||
public class ShipOrderCommand : IRequest<bool>
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public int OrderNumber { get; private set; }
|
||||
@ -13,5 +10,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,8 @@
|
||||
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>
|
||||
{
|
||||
// Regular CommandHandler
|
||||
public class ShipOrderCommandHandler : IRequestHandler<ShipOrderCommand, bool>
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
|
||||
public ShipOrderCommandHandler(IOrderRepository orderRepository)
|
||||
@ -35,12 +27,12 @@ namespace Ordering.API.Application.Commands
|
||||
orderToUpdate.SetShippedStatus();
|
||||
return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use for Idempotency in Command process
|
||||
public class ShipOrderIdentifiedCommandHandler : IdentifiedCommandHandler<ShipOrderCommand, bool>
|
||||
{
|
||||
// Use for Idempotency in Command process
|
||||
public class ShipOrderIdentifiedCommandHandler : IdentifiedCommandHandler<ShipOrderCommand, bool>
|
||||
{
|
||||
public ShipOrderIdentifiedCommandHandler(
|
||||
IMediator mediator,
|
||||
IRequestManager requestManager,
|
||||
@ -53,5 +45,4 @@ namespace Ordering.API.Application.Commands
|
||||
{
|
||||
return true; // Ignore duplicate requests for processing order.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,8 @@
|
||||
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
|
||||
public class UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler
|
||||
: INotificationHandler<BuyerAndPaymentMethodVerifiedDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ILoggerFactory _logger;
|
||||
|
||||
@ -34,5 +26,4 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
|
||||
.LogTrace("Order with Id: {OrderId} has been successfully updated with a payment method {PaymentMethod} ({Id})",
|
||||
buyerPaymentMethodVerifiedEvent.OrderId, nameof(buyerPaymentMethodVerifiedEvent.Payment), buyerPaymentMethodVerifiedEvent.Payment.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,10 @@
|
||||
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 Ordering.API.Application.DomainEventHandlers.OrderCancelled
|
||||
{
|
||||
public class OrderCancelledDomainEventHandler
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderCancelled;
|
||||
|
||||
public class OrderCancelledDomainEventHandler
|
||||
: INotificationHandler<OrderCancelledDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
private readonly ILoggerFactory _logger;
|
||||
@ -43,5 +34,4 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderCancelled
|
||||
var orderStatusChangedToCancelledIntegrationEvent = new OrderStatusChangedToCancelledIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToCancelledIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,8 @@
|
||||
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
|
||||
public class OrderStatusChangedToAwaitingValidationDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToAwaitingValidationDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ILoggerFactory _logger;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
@ -48,5 +36,4 @@
|
||||
order.Id, order.OrderStatus.Name, buyer.Name, orderStockList);
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToAwaitingValidationIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +1,8 @@
|
||||
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
|
||||
public class OrderStatusChangedToPaidDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToPaidDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ILoggerFactory _logger;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
@ -53,5 +41,4 @@
|
||||
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToPaidIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,8 @@
|
||||
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
|
||||
public class OrderShippedDomainEventHandler
|
||||
: INotificationHandler<OrderShippedDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
private readonly IOrderingIntegrationEventService _orderingIntegrationEventService;
|
||||
@ -43,5 +32,4 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderShipped
|
||||
var orderStatusChangedToShippedIntegrationEvent = new OrderStatusChangedToShippedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToShippedIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
|
||||
|
||||
public class SendEmailToCustomerWhenOrderStartedDomainEventHandler
|
||||
//: IAsyncNotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
public class SendEmailToCustomerWhenOrderStartedDomainEventHandler
|
||||
//: IAsyncNotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
public SendEmailToCustomerWhenOrderStartedDomainEventHandler()
|
||||
{
|
||||
|
||||
@ -12,5 +12,4 @@
|
||||
//{
|
||||
// //TBD - Send email logic
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,8 @@
|
||||
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
|
||||
public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
|
||||
: INotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly ILoggerFactory _logger;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
private readonly IIdentityService _identityService;
|
||||
@ -63,5 +52,4 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
.LogTrace("Buyer {BuyerId} and related payment method were validated or updated for orderId: {OrderId}.",
|
||||
buyerUpdated.Id, orderStartedEvent.Order.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,8 @@
|
||||
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
|
||||
public class OrderStatusChangedToStockConfirmedDomainEventHandler
|
||||
: INotificationHandler<OrderStatusChangedToStockConfirmedDomainEvent>
|
||||
{
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
private readonly ILoggerFactory _logger;
|
||||
@ -43,5 +32,4 @@
|
||||
var orderStatusChangedToStockConfirmedIntegrationEvent = new OrderStatusChangedToStockConfirmedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToStockConfirmedIntegrationEvent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,7 @@
|
||||
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>
|
||||
{
|
||||
public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<GracePeriodConfirmedIntegrationEventHandler> _logger;
|
||||
|
||||
@ -48,5 +39,4 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
await _mediator.Send(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,8 @@
|
||||
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 :
|
||||
public class OrderPaymentFailedIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>
|
||||
{
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<OrderPaymentFailedIntegrationEventHandler> _logger;
|
||||
|
||||
@ -42,5 +32,4 @@
|
||||
await _mediator.Send(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,8 @@
|
||||
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 :
|
||||
public class OrderPaymentSucceededIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>
|
||||
{
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<OrderPaymentSucceededIntegrationEventHandler> _logger;
|
||||
|
||||
@ -42,5 +32,4 @@
|
||||
await _mediator.Send(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,8 @@
|
||||
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 :
|
||||
public class OrderStockConfirmedIntegrationEventHandler :
|
||||
IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>
|
||||
{
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<OrderStockConfirmedIntegrationEventHandler> _logger;
|
||||
|
||||
@ -42,5 +32,4 @@
|
||||
await _mediator.Send(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,6 @@
|
||||
namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||
public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>
|
||||
{
|
||||
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>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<OrderStockRejectedIntegrationEventHandler> _logger;
|
||||
|
||||
@ -46,5 +35,4 @@
|
||||
await _mediator.Send(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,7 @@
|
||||
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>
|
||||
{
|
||||
public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<UserCheckoutAcceptedIntegrationEventHandler> _logger;
|
||||
|
||||
@ -76,5 +66,4 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
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
|
||||
{
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
public GracePeriodConfirmedIntegrationEvent(int orderId) =>
|
||||
OrderId = orderId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
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
|
||||
{
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
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
|
||||
{
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
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.
|
||||
public record OrderStartedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
// 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.
|
||||
public record OrderStartedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; init; }
|
||||
|
||||
public OrderStartedIntegrationEvent(string userId)
|
||||
=> UserId = userId;
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
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
|
||||
{
|
||||
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -18,10 +15,10 @@
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record OrderStockItem
|
||||
{
|
||||
public record OrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public int Units { get; }
|
||||
|
||||
@ -30,5 +27,4 @@
|
||||
ProductId = productId;
|
||||
Units = units;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
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 string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -14,5 +12,4 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
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
|
||||
{
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -20,5 +17,5 @@
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
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 string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -14,5 +12,4 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
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
|
||||
{
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -14,5 +12,4 @@
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
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 string OrderStatus { get; }
|
||||
public string BuyerName { get; }
|
||||
@ -14,5 +12,4 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
OrderStatus = orderStatus;
|
||||
BuyerName = buyerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
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
|
||||
{
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId;
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
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
|
||||
{
|
||||
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
public List<ConfirmedOrderStockItem> OrderStockItems { get; }
|
||||
@ -15,10 +12,10 @@
|
||||
OrderId = orderId;
|
||||
OrderStockItems = orderStockItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record ConfirmedOrderStockItem
|
||||
{
|
||||
public record ConfirmedOrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public bool HasStock { get; }
|
||||
|
||||
@ -27,5 +24,4 @@
|
||||
ProductId = productId;
|
||||
HasStock = hasStock;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
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 record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; }
|
||||
|
||||
public string UserName { get; }
|
||||
@ -58,5 +54,4 @@ namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
UserName = userName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
public interface IOrderingIntegrationEventService
|
||||
{
|
||||
Task PublishEventsThroughEventBusAsync(Guid transactionId);
|
||||
Task AddAndSaveEventAsync(IntegrationEvent evt);
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,7 @@
|
||||
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
|
||||
{
|
||||
public class OrderingIntegrationEventService : IOrderingIntegrationEventService
|
||||
{
|
||||
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
|
||||
private readonly IEventBus _eventBus;
|
||||
private readonly OrderingContext _orderingContext;
|
||||
@ -61,5 +50,4 @@ namespace Ordering.API.Application.IntegrationEvents
|
||||
|
||||
await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 int ProductId { get; init; }
|
||||
public string ProductName { get; init; }
|
||||
@ -9,5 +9,5 @@
|
||||
public decimal OldUnitPrice { get; init; }
|
||||
public int Quantity { get; init; }
|
||||
public string PictureUrl { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
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 List<BasketItem> Items { get; set; }
|
||||
|
||||
@ -12,5 +10,4 @@ namespace Ordering.API.Application.Models
|
||||
BuyerId = buyerId;
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,10 @@
|
||||
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
|
||||
{
|
||||
public interface IOrderQueries
|
||||
{
|
||||
Task<Order> GetOrderAsync(int id);
|
||||
|
||||
Task<IEnumerable<OrderSummary>> GetOrdersFromUserAsync(Guid userId);
|
||||
|
||||
Task<IEnumerable<CardType>> GetCardTypesAsync();
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
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
|
||||
public class OrderQueries
|
||||
: IOrderQueries
|
||||
{
|
||||
{
|
||||
private string _connectionString = string.Empty;
|
||||
|
||||
public OrderQueries(string constr)
|
||||
@ -101,5 +95,4 @@
|
||||
|
||||
return order;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
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 record Orderitem
|
||||
{
|
||||
public string productname { get; init; }
|
||||
public int units { get; init; }
|
||||
public double unitprice { get; init; }
|
||||
public string pictureurl { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
public record Order
|
||||
{
|
||||
public record Order
|
||||
{
|
||||
public int ordernumber { get; init; }
|
||||
public DateTime date { get; init; }
|
||||
public string status { get; init; }
|
||||
@ -23,19 +20,18 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries
|
||||
public string country { get; init; }
|
||||
public List<Orderitem> orderitems { get; set; }
|
||||
public decimal total { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public record OrderSummary
|
||||
{
|
||||
public record OrderSummary
|
||||
{
|
||||
public int ordernumber { get; init; }
|
||||
public DateTime date { get; init; }
|
||||
public string status { get; init; }
|
||||
public double total { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
public record CardType
|
||||
{
|
||||
public record CardType
|
||||
{
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; }
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,11 @@
|
||||
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 class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand>
|
||||
{
|
||||
public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger)
|
||||
{
|
||||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found");
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,9 @@
|
||||
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 class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
|
||||
{
|
||||
public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger)
|
||||
{
|
||||
RuleFor(command => command.City).NotEmpty();
|
||||
@ -36,5 +30,4 @@ namespace Ordering.API.Application.Validations
|
||||
{
|
||||
return orderItems.Any();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
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 class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand, bool>>
|
||||
{
|
||||
public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger)
|
||||
{
|
||||
RuleFor(command => command.Id).NotEmpty();
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,11 @@
|
||||
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 class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand>
|
||||
{
|
||||
public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger)
|
||||
{
|
||||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found");
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
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>/
|
||||
public IActionResult Index()
|
||||
{
|
||||
return new RedirectResult("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,15 @@
|
||||
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]
|
||||
public class OrdersController : ControllerBase
|
||||
{
|
||||
[Route("api/v1/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class OrdersController : ControllerBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IOrderQueries _orderQueries;
|
||||
private readonly IIdentityService _identityService;
|
||||
@ -149,5 +140,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
|
||||
return await _mediator.Send(createOrderDraftCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
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 class BasketItemExtensions
|
||||
{
|
||||
public static IEnumerable<OrderItemDTO> ToOrderItemsDTO(this IEnumerable<BasketItem> basketItems)
|
||||
{
|
||||
foreach (var item in basketItems)
|
||||
@ -24,5 +24,4 @@ namespace Ordering.API.Application.Models
|
||||
Units = item.Quantity
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,7 @@
|
||||
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 class LinqSelectExtensions
|
||||
{
|
||||
public static IEnumerable<SelectTryResult<TSource, TResult>> SelectTry<TSource, TResult>(this IEnumerable<TSource> enumerable, Func<TSource, TResult> selector)
|
||||
{
|
||||
foreach (TSource element in enumerable)
|
||||
@ -46,5 +42,4 @@ namespace Ordering.API.Extensions
|
||||
public TResult Result { get; private set; }
|
||||
public Exception CaughtException { get; private set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,7 @@
|
||||
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
|
||||
{
|
||||
public class OrderingService : OrderingGrpc.OrderingGrpcBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly ILogger<OrderingService> _logger;
|
||||
|
||||
@ -86,5 +75,4 @@ namespace GrpcOrdering
|
||||
PictureUrl = x.PictureUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,10 @@
|
||||
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
|
||||
{
|
||||
public class InternalServerErrorObjectResult : ObjectResult
|
||||
{
|
||||
public InternalServerErrorObjectResult(object error)
|
||||
: base(error)
|
||||
{
|
||||
StatusCode = StatusCodes.Status500InternalServerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,7 @@
|
||||
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 class AuthorizationHeaderParameterOperationFilter : IOperationFilter
|
||||
{
|
||||
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
||||
{
|
||||
var filterPipeline = context.ApiDescription.ActionDescriptor.FilterDescriptors;
|
||||
@ -30,5 +24,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,8 @@
|
||||
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
|
||||
public class ApplicationModule
|
||||
: Autofac.Module
|
||||
{
|
||||
{
|
||||
|
||||
public string QueriesConnectionString { get; }
|
||||
|
||||
@ -46,5 +35,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
.AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,7 @@
|
||||
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
|
||||
{
|
||||
public class MediatorModule : Autofac.Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterAssemblyTypes(typeof(IMediator).GetTypeInfo().Assembly)
|
||||
@ -43,5 +33,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
builder.RegisterGeneric(typeof(TransactionBehaviour<,>)).As(typeof(IPipelineBehavior<,>));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,13 +1,7 @@
|
||||
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 class AuthorizeCheckOperationFilter : IOperationFilter
|
||||
{
|
||||
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
@ -32,5 +26,4 @@ namespace Ordering.API.Infrastructure.Filters
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,7 @@
|
||||
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
|
||||
{
|
||||
public class HttpGlobalExceptionFilter : IExceptionFilter
|
||||
{
|
||||
private readonly IWebHostEnvironment env;
|
||||
private readonly ILogger<HttpGlobalExceptionFilter> logger;
|
||||
|
||||
@ -67,5 +57,4 @@
|
||||
|
||||
public object DeveloperMessage { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,9 @@
|
||||
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.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;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
|
||||
|
||||
public class OrderingContextSeed
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
|
||||
public class OrderingContextSeed
|
||||
{
|
||||
public async Task SeedAsync(OrderingContext context, IWebHostEnvironment env, IOptions<OrderingSettings> settings, ILogger<OrderingContextSeed> logger)
|
||||
{
|
||||
var policy = CreatePolicy(logger, nameof(OrderingContextSeed));
|
||||
@ -187,5 +171,4 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 GetUserName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
|
||||
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
|
||||
{
|
||||
public class IdentityService : IIdentityService
|
||||
{
|
||||
private IHttpContextAccessor _context;
|
||||
|
||||
public IdentityService(IHttpContextAccessor context)
|
||||
@ -22,5 +18,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Servi
|
||||
{
|
||||
return _context.HttpContext.User.Identity.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API;
|
||||
|
||||
public class OrderingSettings
|
||||
{
|
||||
public class OrderingSettings
|
||||
{
|
||||
public bool UseCustomizationData { get; set; }
|
||||
|
||||
public string ConnectionString { get; set; }
|
||||
@ -11,5 +11,4 @@
|
||||
public int GracePeriodTime { get; set; }
|
||||
|
||||
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,45 +1,8 @@
|
||||
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
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
@ -151,10 +114,10 @@
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class CustomExtensionsMethods
|
||||
{
|
||||
static class CustomExtensionsMethods
|
||||
{
|
||||
public static IServiceCollection AddApplicationInsights(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddApplicationInsightsTelemetry(configuration);
|
||||
@ -425,5 +388,4 @@
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user