-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from J-Tech-Japan/250-command-converter
Command converter
- Loading branch information
Showing
25 changed files
with
231 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
internalUsages/FeatureCheck.Domain/Aggregates/DerivedTypes/Commands/CreateCar.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using FeatureCheck.Domain.Aggregates.DerivedTypes.ValueObjects; | ||
using Sekiban.Core.Command; | ||
using System.ComponentModel.DataAnnotations; | ||
namespace FeatureCheck.Domain.Aggregates.DerivedTypes.Commands; | ||
|
||
public record CreateCar( | ||
string Color, | ||
[property: Required] | ||
string Name) : ICommandConverter<DerivedTypeAggregate> | ||
{ | ||
public Guid GetAggregateId() => Guid.NewGuid(); | ||
public class Handler : ICommandConverterHandler<DerivedTypeAggregate, CreateCar> | ||
{ | ||
public ICommand<DerivedTypeAggregate> ConvertCommand(CreateCar command) => new CreateVehicle(new Car(command.Color, command.Name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
internalUsages/FeatureCheck.Domain/Aggregates/DerivedTypes/ValueObjects/Car.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
namespace FeatureCheck.Domain.Aggregates.DerivedTypes.ValueObjects; | ||
|
||
public record Car(string Color, string Name) : IVehicle | ||
public record Car( | ||
[property: Required] | ||
string Color, | ||
string Name) : IVehicle | ||
{ | ||
public static Car Empty => new(string.Empty, string.Empty); | ||
} |
3 changes: 3 additions & 0 deletions
3
internalUsages/FeatureCheck.Domain/Aggregates/DerivedTypes/ValueObjects/IVehicle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
using System.Text.Json.Serialization; | ||
namespace FeatureCheck.Domain.Aggregates.DerivedTypes.ValueObjects; | ||
|
||
[JsonDerivedType(typeof(Bike), nameof(Bike))] | ||
[JsonDerivedType(typeof(Car), nameof(Car))] | ||
public interface IVehicle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using Sekiban.Core.Aggregate; | ||
namespace Sekiban.Core.Command; | ||
|
||
public interface ICommandConverter<TAggregatePayload> : ICommand<TAggregatePayload>, ICommandConverterCommon | ||
where TAggregatePayload : IAggregatePayloadCommon | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Sekiban.Core.Command; | ||
|
||
public interface ICommandConverterCommon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Sekiban.Core.Aggregate; | ||
namespace Sekiban.Core.Command; | ||
|
||
public interface ICommandConverterHandler<TAggregatePayload, TCommand> : ICommandHandlerCommon<TAggregatePayload, TCommand>, | ||
ICommandConverterHandlerCommon where TAggregatePayload : IAggregatePayloadCommon where TCommand : ICommandConverter<TAggregatePayload> | ||
{ | ||
public ICommand<TAggregatePayload> ConvertCommand(TCommand command); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Sekiban.Core.Command; | ||
|
||
public interface ICommandConverterHandlerCommon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.