integration events updated to record types
This commit is contained in:
parent
1857cc1c9e
commit
6fc60480c1
@ -3,7 +3,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
|
||||
{
|
||||
public class IntegrationEvent
|
||||
public record IntegrationEvent
|
||||
{
|
||||
public IntegrationEvent()
|
||||
{
|
||||
@ -19,9 +19,9 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
|
||||
}
|
||||
|
||||
[JsonProperty]
|
||||
public Guid Id { get; private set; }
|
||||
public Guid Id { get; private init; }
|
||||
|
||||
[JsonProperty]
|
||||
public DateTime CreationDate { get; private set; }
|
||||
public DateTime CreationDate { get; private init; }
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ namespace Basket.API.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 class OrderStartedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStartedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public string UserId { get; init; }
|
||||
|
||||
public OrderStartedIntegrationEvent(string userId)
|
||||
=> UserId = userId;
|
||||
|
@ -5,13 +5,13 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
|
||||
// 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 class ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int ProductId { get; private init; }
|
||||
|
||||
public decimal NewPrice { get; private set; }
|
||||
public decimal NewPrice { get; private init; }
|
||||
|
||||
public decimal OldPrice { get; private set; }
|
||||
public decimal OldPrice { get; private init; }
|
||||
|
||||
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
|
||||
{
|
||||
|
@ -4,37 +4,37 @@ using System;
|
||||
|
||||
namespace Basket.API.IntegrationEvents.Events
|
||||
{
|
||||
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; }
|
||||
|
||||
public string UserName { get; }
|
||||
|
||||
public int OrderNumber { get; set; }
|
||||
public int OrderNumber { get; init; }
|
||||
|
||||
public string City { get; set; }
|
||||
public string City { get; init; }
|
||||
|
||||
public string Street { get; set; }
|
||||
public string Street { get; init; }
|
||||
|
||||
public string State { get; set; }
|
||||
public string State { get; init; }
|
||||
|
||||
public string Country { get; set; }
|
||||
public string Country { get; init; }
|
||||
|
||||
public string ZipCode { get; set; }
|
||||
public string ZipCode { get; init; }
|
||||
|
||||
public string CardNumber { get; set; }
|
||||
public string CardNumber { get; init; }
|
||||
|
||||
public string CardHolderName { get; set; }
|
||||
public string CardHolderName { get; init; }
|
||||
|
||||
public DateTime CardExpiration { get; set; }
|
||||
public DateTime CardExpiration { get; init; }
|
||||
|
||||
public string CardSecurityNumber { get; set; }
|
||||
public string CardSecurityNumber { get; init; }
|
||||
|
||||
public int CardTypeId { get; set; }
|
||||
public int CardTypeId { get; init; }
|
||||
|
||||
public string Buyer { get; set; }
|
||||
public string Buyer { get; init; }
|
||||
|
||||
public Guid RequestId { get; set; }
|
||||
public Guid RequestId { get; init; }
|
||||
|
||||
public CustomerBasket Basket { get; }
|
||||
|
||||
|
@ -2,29 +2,29 @@
|
||||
|
||||
namespace Basket.API.Model
|
||||
{
|
||||
public record BasketCheckout
|
||||
public class BasketCheckout
|
||||
{
|
||||
public string City { get; init; }
|
||||
public string City { get; set; }
|
||||
|
||||
public string Street { get; init; }
|
||||
public string Street { get; set; }
|
||||
|
||||
public string State { get; init; }
|
||||
public string State { get; set; }
|
||||
|
||||
public string Country { get; init; }
|
||||
public string Country { get; set; }
|
||||
|
||||
public string ZipCode { get; init; }
|
||||
public string ZipCode { get; set; }
|
||||
|
||||
public string CardNumber { get; init; }
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
public string CardHolderName { get; init; }
|
||||
public string CardHolderName { get; set; }
|
||||
|
||||
public DateTime CardExpiration { get; init; }
|
||||
public DateTime CardExpiration { get; set; }
|
||||
|
||||
public string CardSecurityNumber { get; init; }
|
||||
public string CardSecurityNumber { get; set; }
|
||||
|
||||
public int CardTypeId { get; init; }
|
||||
public int CardTypeId { get; set; }
|
||||
|
||||
public string Buyer { get; init; }
|
||||
public string Buyer { get; set; }
|
||||
|
||||
public Guid RequestId { get; set; }
|
||||
}
|
||||
|
@ -3,15 +3,15 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
|
||||
{
|
||||
public record BasketItem : IValidatableObject
|
||||
public class BasketItem : IValidatableObject
|
||||
{
|
||||
public string Id { get; init; }
|
||||
public int ProductId { get; init; }
|
||||
public string ProductName { get; init; }
|
||||
public string Id { get; set; }
|
||||
public int ProductId { get; set; }
|
||||
public string ProductName { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
public decimal OldUnitPrice { get; set; }
|
||||
public int Quantity { get; init; }
|
||||
public string PictureUrl { get; init; }
|
||||
public int Quantity { get; set; }
|
||||
public string PictureUrl { get; set; }
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var results = new List<ValidationResult>();
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
|
||||
{
|
||||
public record CustomerBasket
|
||||
public class CustomerBasket
|
||||
{
|
||||
public string BuyerId { get; init; }
|
||||
public string BuyerId { get; set; }
|
||||
|
||||
public List<BasketItem> Items { get; set; } = new List<BasketItem>();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
using BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public IEnumerable<OrderStockItem> OrderStockItems { get; }
|
||||
@ -16,7 +16,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public class OrderStockItem
|
||||
public record OrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public int Units { get; }
|
||||
|
@ -3,7 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public IEnumerable<OrderStockItem> OrderStockItems { get; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
using BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfirmedOrderStockItem
|
||||
public record ConfirmedOrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public bool HasStock { get; }
|
||||
|
@ -5,13 +5,13 @@
|
||||
// Integration Events notes:
|
||||
// An Event is “something that has happened in the past”, therefore its name has to be past tense
|
||||
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.
|
||||
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int ProductId { get; private init; }
|
||||
|
||||
public decimal NewPrice { get; private set; }
|
||||
public decimal NewPrice { get; private init; }
|
||||
|
||||
public decimal OldPrice { get; private set; }
|
||||
public decimal OldPrice { get; private init; }
|
||||
|
||||
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -9,7 +9,7 @@ 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 class OrderStartedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStartedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public class OrderStockItem
|
||||
public record OrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public int Units { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -3,7 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfirmedOrderStockItem
|
||||
public record ConfirmedOrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public bool HasStock { get; }
|
||||
|
@ -4,7 +4,7 @@ using System;
|
||||
|
||||
namespace Ordering.API.Application.IntegrationEvents.Events
|
||||
{
|
||||
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public string UserId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record GracePeriodConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents
|
||||
{
|
||||
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.SignalrHub.IntegrationEvents.Events
|
||||
{
|
||||
public class OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public string OrderStatus { get; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
public class OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Webhooks.API.IntegrationEvents
|
||||
{
|
||||
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; }
|
||||
public IEnumerable<OrderStockItem> OrderStockItems { get; }
|
||||
@ -19,7 +19,7 @@ namespace Webhooks.API.IntegrationEvents
|
||||
}
|
||||
}
|
||||
|
||||
public class OrderStockItem
|
||||
public record OrderStockItem
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public int Units { get; }
|
||||
|
@ -1,16 +1,12 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Webhooks.API.IntegrationEvents
|
||||
{
|
||||
public class OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int OrderId { get; private set; }
|
||||
public string OrderStatus { get; private set; }
|
||||
public string BuyerName { get; private set; }
|
||||
public int OrderId { get; private init; }
|
||||
public string OrderStatus { get; private init; }
|
||||
public string BuyerName { get; private init; }
|
||||
|
||||
public OrderStatusChangedToShippedIntegrationEvent(int orderId, string orderStatus, string buyerName)
|
||||
{
|
||||
|
@ -1,18 +1,14 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Webhooks.API.IntegrationEvents
|
||||
{
|
||||
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int ProductId { get; private init; }
|
||||
|
||||
public decimal NewPrice { get; private set; }
|
||||
public decimal NewPrice { get; private init; }
|
||||
|
||||
public decimal OldPrice { get; private set; }
|
||||
public decimal OldPrice { get; private init; }
|
||||
|
||||
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user