Skip to content

Commit 6fc6048

Browse files
author
Borja García Rodríguez
committed
integration events updated to record types
1 parent 1857cc1 commit 6fc6048

38 files changed

Lines changed: 88 additions & 96 deletions

File tree

src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
55
{
6-
public class IntegrationEvent
6+
public record IntegrationEvent
77
{
88
public IntegrationEvent()
99
{
@@ -19,9 +19,9 @@ public IntegrationEvent(Guid id, DateTime createDate)
1919
}
2020

2121
[JsonProperty]
22-
public Guid Id { get; private set; }
22+
public Guid Id { get; private init; }
2323

2424
[JsonProperty]
25-
public DateTime CreationDate { get; private set; }
25+
public DateTime CreationDate { get; private init; }
2626
}
2727
}

src/Services/Basket/Basket.API/IntegrationEvents/Events/OrderStartedIntegrationEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace Basket.API.IntegrationEvents.Events
55
// Integration Events notes:
66
// An Event is “something that has happened in the past”, therefore its name has to be
77
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
8-
public class OrderStartedIntegrationEvent : IntegrationEvent
8+
public record OrderStartedIntegrationEvent : IntegrationEvent
99
{
10-
public string UserId { get; set; }
10+
public string UserId { get; init; }
1111

1212
public OrderStartedIntegrationEvent(string userId)
1313
=> UserId = userId;

src/Services/Basket/Basket.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
55
// Integration Events notes:
66
// An Event is “something that has happened in the past”, therefore its name has to be
77
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
8-
public class ProductPriceChangedIntegrationEvent : IntegrationEvent
8+
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
99
{
10-
public int ProductId { get; private set; }
10+
public int ProductId { get; private init; }
1111

12-
public decimal NewPrice { get; private set; }
12+
public decimal NewPrice { get; private init; }
1313

14-
public decimal OldPrice { get; private set; }
14+
public decimal OldPrice { get; private init; }
1515

1616
public ProductPriceChangedIntegrationEvent(int productId, decimal newPrice, decimal oldPrice)
1717
{

src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@
44

55
namespace Basket.API.IntegrationEvents.Events
66
{
7-
public class UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
7+
public record UserCheckoutAcceptedIntegrationEvent : IntegrationEvent
88
{
99
public string UserId { get; }
1010

1111
public string UserName { get; }
1212

13-
public int OrderNumber { get; set; }
13+
public int OrderNumber { get; init; }
1414

15-
public string City { get; set; }
15+
public string City { get; init; }
1616

17-
public string Street { get; set; }
17+
public string Street { get; init; }
1818

19-
public string State { get; set; }
19+
public string State { get; init; }
2020

21-
public string Country { get; set; }
21+
public string Country { get; init; }
2222

23-
public string ZipCode { get; set; }
23+
public string ZipCode { get; init; }
2424

25-
public string CardNumber { get; set; }
25+
public string CardNumber { get; init; }
2626

27-
public string CardHolderName { get; set; }
27+
public string CardHolderName { get; init; }
2828

29-
public DateTime CardExpiration { get; set; }
29+
public DateTime CardExpiration { get; init; }
3030

31-
public string CardSecurityNumber { get; set; }
31+
public string CardSecurityNumber { get; init; }
3232

33-
public int CardTypeId { get; set; }
33+
public int CardTypeId { get; init; }
3434

35-
public string Buyer { get; set; }
35+
public string Buyer { get; init; }
3636

37-
public Guid RequestId { get; set; }
37+
public Guid RequestId { get; init; }
3838

3939
public CustomerBasket Basket { get; }
4040

src/Services/Basket/Basket.API/Model/BasketCheckout.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
namespace Basket.API.Model
44
{
5-
public record BasketCheckout
5+
public class BasketCheckout
66
{
7-
public string City { get; init; }
7+
public string City { get; set; }
88

9-
public string Street { get; init; }
9+
public string Street { get; set; }
1010

11-
public string State { get; init; }
11+
public string State { get; set; }
1212

13-
public string Country { get; init; }
13+
public string Country { get; set; }
1414

15-
public string ZipCode { get; init; }
15+
public string ZipCode { get; set; }
1616

17-
public string CardNumber { get; init; }
17+
public string CardNumber { get; set; }
1818

19-
public string CardHolderName { get; init; }
19+
public string CardHolderName { get; set; }
2020

21-
public DateTime CardExpiration { get; init; }
21+
public DateTime CardExpiration { get; set; }
2222

23-
public string CardSecurityNumber { get; init; }
23+
public string CardSecurityNumber { get; set; }
2424

25-
public int CardTypeId { get; init; }
25+
public int CardTypeId { get; set; }
2626

27-
public string Buyer { get; init; }
27+
public string Buyer { get; set; }
2828

2929
public Guid RequestId { get; set; }
3030
}

src/Services/Basket/Basket.API/Model/BasketItem.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
55
{
6-
public record BasketItem : IValidatableObject
6+
public class BasketItem : IValidatableObject
77
{
8-
public string Id { get; init; }
9-
public int ProductId { get; init; }
10-
public string ProductName { get; init; }
8+
public string Id { get; set; }
9+
public int ProductId { get; set; }
10+
public string ProductName { get; set; }
1111
public decimal UnitPrice { get; set; }
1212
public decimal OldUnitPrice { get; set; }
13-
public int Quantity { get; init; }
14-
public string PictureUrl { get; init; }
13+
public int Quantity { get; set; }
14+
public string PictureUrl { get; set; }
1515
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
1616
{
1717
var results = new List<ValidationResult>();

src/Services/Basket/Basket.API/Model/CustomerBasket.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
44
{
5-
public record CustomerBasket
5+
public class CustomerBasket
66
{
7-
public string BuyerId { get; init; }
7+
public string BuyerId { get; set; }
88

99
public List<BasketItem> Items { get; set; } = new List<BasketItem>();
1010

src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using BuildingBlocks.EventBus.Events;
44
using System.Collections.Generic;
55

6-
public class OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
6+
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
77
{
88
public int OrderId { get; }
99
public IEnumerable<OrderStockItem> OrderStockItems { get; }
@@ -16,7 +16,7 @@ public OrderStatusChangedToAwaitingValidationIntegrationEvent(int orderId,
1616
}
1717
}
1818

19-
public class OrderStockItem
19+
public record OrderStockItem
2020
{
2121
public int ProductId { get; }
2222
public int Units { get; }

src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToPaidIntegrationEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Collections.Generic;
44
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
55

6-
public class OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
6+
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
77
{
88
public int OrderId { get; }
99
public IEnumerable<OrderStockItem> OrderStockItems { get; }

src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
using BuildingBlocks.EventBus.Events;
44

5-
public class OrderStockConfirmedIntegrationEvent : IntegrationEvent
5+
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
66
{
77
public int OrderId { get; }
88

0 commit comments

Comments
 (0)