Skip to content

Commit

Permalink
Merge pull request #477 from J-Tech-Japan/476-split-files
Browse files Browse the repository at this point in the history
Working on the file and namespaces
  • Loading branch information
tomohisa authored Dec 31, 2024
2 parents d7fa2d5 + 9f35b50 commit 8b661c6
Show file tree
Hide file tree
Showing 125 changed files with 1,522 additions and 1,149 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using MultiTenant.Domain.Aggregates.Clients;
using MultiTenant.Domain.Aggregates.Clients.Commands;
using MultiTenant.Domain.Aggregates.Clients.Queries;
using Sekiban.Core.Dependency;
using System.Reflection;
Expand Down
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/Branch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Aggregates;
namespace Pure.Domain;

public record Branch(string Name) : IAggregatePayload;
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/BranchCreated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record BranchCreated(string Name) : IEventPayload;
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/BranchNameChanged.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record BranchNameChanged(string Name) : IEventPayload;
15 changes: 15 additions & 0 deletions internalUsages/Pure.Domain/BranchProjector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Sekiban.Pure.Aggregates;
using Sekiban.Pure.Events;
using Sekiban.Pure.Projectors;
namespace Pure.Domain;

public class BranchProjector : IAggregateProjector
{
public IAggregatePayload Project(IAggregatePayload payload, IEvent ev) =>
(payload, ev.GetPayload()) switch
{
(EmptyAggregatePayload, BranchCreated created) => new Branch(created.Name),
(Branch branch, BranchNameChanged changed) => new Branch(changed.Name),
_ => payload
};
}
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/BuyingShoppingCart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Aggregates;
namespace Pure.Domain;

public record BuyingShoppingCart(Guid UserId, List<ShoppingCartItems> Items) : IAggregatePayload;
16 changes: 16 additions & 0 deletions internalUsages/Pure.Domain/ChangeBranchName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using ResultBoxes;
using Sekiban.Pure.Aggregates;
using Sekiban.Pure.Command.Executor;
using Sekiban.Pure.Command.Handlers;
using Sekiban.Pure.Documents;
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record ChangeBranchName(Guid BranchId, string NameToChange)
: ICommandWithHandler<ChangeBranchName, BranchProjector>
{
public ResultBox<EventOrNone> Handle(ChangeBranchName command, ICommandContext<IAggregatePayload> context) =>
context.AppendEvent(new BranchNameChanged(command.NameToChange));
public PartitionKeys SpecifyPartitionKeys(ChangeBranchName command) =>
PartitionKeys<BranchProjector>.Existing(BranchId);
}
264 changes: 0 additions & 264 deletions internalUsages/Pure.Domain/Class1.cs

This file was deleted.

13 changes: 13 additions & 0 deletions internalUsages/Pure.Domain/ConfirmUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using ResultBoxes;
using Sekiban.Pure.Command.Executor;
using Sekiban.Pure.Command.Handlers;
using Sekiban.Pure.Documents;
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record ConfirmUser(Guid UserId) : ICommandWithHandler<ConfirmUser, UserProjector, UnconfirmedUser>
{
public ResultBox<EventOrNone> Handle(ConfirmUser command, ICommandContext<UnconfirmedUser> context) =>
EventOrNone.Event(new UserConfirmed());
public PartitionKeys SpecifyPartitionKeys(ConfirmUser command) => PartitionKeys<UserProjector>.Existing(UserId);
}
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/ConfirmedUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Aggregates;
namespace Pure.Domain;

public record ConfirmedUser(string Name, string Email) : IAggregatePayload;
17 changes: 17 additions & 0 deletions internalUsages/Pure.Domain/CreateShoppingCart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using ResultBoxes;
using Sekiban.Pure.Aggregates;
using Sekiban.Pure.Command.Executor;
using Sekiban.Pure.Command.Handlers;
using Sekiban.Pure.Documents;
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record CreateShoppingCart(Guid UserId) : ICommandWithHandlerAsync<CreateShoppingCart, ShoppingCartProjector>
{
public PartitionKeys SpecifyPartitionKeys(CreateShoppingCart command) =>
PartitionKeys<ShoppingCartProjector>.Generate();
public Task<ResultBox<EventOrNone>> HandleAsync(
CreateShoppingCart command,
ICommandContext<IAggregatePayload> context) =>
EventOrNone.Event(new ShoppingCartCreated(command.UserId)).ToTask();
}
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/PaymentProcessedShoppingCart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record PaymentProcessedShoppingCart(string PaymentMethod) : IEventPayload;
8 changes: 8 additions & 0 deletions internalUsages/Pure.Domain/PaymentProcessingShoppingCart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Sekiban.Pure.Aggregates;
namespace Pure.Domain;

public record PaymentProcessingShoppingCart(
Guid UserId,
List<ShoppingCartItems> Items,
int TotalPrice,
string PaymentMethod) : IAggregatePayload;
14 changes: 14 additions & 0 deletions internalUsages/Pure.Domain/RegisterBranch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using ResultBoxes;
using Sekiban.Pure.Aggregates;
using Sekiban.Pure.Command.Executor;
using Sekiban.Pure.Command.Handlers;
using Sekiban.Pure.Documents;
using Sekiban.Pure.Events;
namespace Pure.Domain;

public record RegisterBranch(string Name) : ICommandWithHandler<RegisterBranch, BranchProjector>
{
public PartitionKeys SpecifyPartitionKeys(RegisterBranch command) => PartitionKeys<BranchProjector>.Generate();
public ResultBox<EventOrNone> Handle(RegisterBranch command, ICommandContext<IAggregatePayload> context) =>
EventOrNone.Event(new BranchCreated(command.Name));
}
4 changes: 4 additions & 0 deletions internalUsages/Pure.Domain/RegisterBranch2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Sekiban.Pure.Command.Handlers;
namespace Pure.Domain;

public record RegisterBranch2(string Name) : ICommand;
Loading

0 comments on commit 8b661c6

Please sign in to comment.