-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
improving document and read model updator
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"azureFunctions.projectSubpath": "src\\Sekiban.Testing" | ||
"azureFunctions.projectSubpath": "src\\Sekiban.Testing", | ||
"cSpell.words": [ | ||
"Stöckl" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Sekiban.Web.Authorizations; | ||
using Sekiban.Web.Common; | ||
using Sekiban.Web.Dependency; | ||
using SekibanEventSourcingBasics.Domain; | ||
namespace SekibanEventSourcingBasics.Cosmos.Web; | ||
|
||
public class SekibanWebDependency : DomainDependency, IWebDependencyDefinition | ||
{ | ||
public bool ShouldMakeSimpleAggregateListQueries => true; | ||
public bool ShouldMakeSimpleSingleProjectionListQueries => true; | ||
public AuthorizeDefinitionCollection AuthorizationDefinitions => new(); | ||
public SekibanControllerOptions Options => new(); | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Sekiban.Core.Aggregate; | ||
using Sekiban.Core.Command; | ||
using Sekiban.Core.Events; | ||
using SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Events; | ||
using System.ComponentModel.DataAnnotations; | ||
namespace SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Commands; | ||
|
||
|
||
public record CreateUserPoint( | ||
[property: Required]string Name, | ||
[property:Required, EmailAddress]string Email, | ||
[property:Range(0,10000)] int Point) : ICommand<UserPoint> | ||
{ | ||
// Assign new Aggregate Id by NewGuid() | ||
public Guid GetAggregateId() => Guid.NewGuid(); | ||
|
||
public class Handler : ICommandHandler<UserPoint, CreateUserPoint> | ||
{ | ||
public IEnumerable<IEventPayloadApplicableTo<UserPoint>> HandleCommand(Func<AggregateState<UserPoint>> getAggregateState, CreateUserPoint command) | ||
{ | ||
yield return new UserPointCreated(command.Name, command.Email, command.Point); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Sekiban.Core.Events; | ||
namespace SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Events; | ||
|
||
public record UserPointCreated(string Name, string Email, int Point) : IEventPayload<UserPoint, UserPointCreated> | ||
{ | ||
public static UserPoint OnEvent(UserPoint aggregatePayload, Event<UserPointCreated> ev) => | ||
new(ev.Payload.Name, ev.Payload.Email, ev.Payload.Point); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Sekiban.Core.Events; | ||
namespace SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Events; | ||
|
||
public record UserPointNameChanged(string ChangedName) : IEventPayload<UserPoint, UserPointNameChanged> | ||
{ | ||
public static UserPoint OnEvent(UserPoint aggregatePayload, Event<UserPointNameChanged> ev) => | ||
aggregatePayload with { Name = ev.Payload.ChangedName }; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Sekiban.Core.Events; | ||
namespace SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Events; | ||
|
||
public record UserPointReceived(int Point, string Note) : IEventPayload<UserPoint, UserPointReceived> | ||
{ | ||
public static UserPoint OnEvent(UserPoint aggregatePayload, Event<UserPointReceived> ev) => | ||
aggregatePayload with { Point = aggregatePayload.Point + ev.Payload.Point }; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Sekiban.Core.Events; | ||
namespace SekibanEventSourcingBasics.Domain.Aggregates.UserPoints.Events; | ||
|
||
public record UserPointUsed(int Point, string Note) : IEventPayload<UserPoint, UserPointUsed> | ||
{ | ||
public static UserPoint OnEvent(UserPoint aggregatePayload, Event<UserPointUsed> ev) => | ||
aggregatePayload with { Point = aggregatePayload.Point - ev.Payload.Point }; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Xunit; |