Skip to content

Commit

Permalink
#340 - Complete registration and fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed May 14, 2021
1 parent 6677cae commit 21a5bc7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Money.Api/Domain/Bootstrap/BootstrapTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ private void Domain(IServiceProvider provider)
new EmptySnapshotStore()
);

var incomeRepository = new AggregateRootRepository<Income>(
eventStore,
eventFormatter,
new ReflectionAggregateRootFactory<Income>(),
eventDispatcher,
new NoSnapshotProvider(),
new EmptySnapshotStore()
);

var categoryRepository = new AggregateRootRepository<Category>(
eventStore,
eventFormatter,
Expand All @@ -194,6 +203,7 @@ private void Domain(IServiceProvider provider)
Money.BootstrapTask bootstrapTask = new Money.BootstrapTask(
commandDispatcher.Handlers,
Factory.Instance(outcomeRepository),
Factory.Instance(incomeRepository),
Factory.Instance(categoryRepository),
Factory.Instance(currencyListRepository)
);
Expand Down
3 changes: 3 additions & 0 deletions src/Money.Models.EntityFrameworkCore/IncomeEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class IncomeEntity : IPriceFixed, IUserEntity
Price IPriceFixed.Amount => new Price(Amount, Currency);
DateTime IPriceFixed.When => When;

public IncomeEntity()
{ }

public IncomeEntity(IncomeCreated payload)
{
Id = payload.AggregateKey.AsGuidKey().Guid;
Expand Down
2 changes: 1 addition & 1 deletion src/Money/Commands/Handlers/IncomeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IncomeHandler(IFactory<IRepository<Income, IKey>> repositoryFactory)
: base(repositoryFactory)
{ }

public Task HandleAsync(Envelope<CreateIncome> envelope) => WithCommand(envelope.Body.Key).Execute(envelope, () => new Income(envelope.Body.Amount, envelope.Body.Description, envelope.Body.When);
public Task HandleAsync(Envelope<CreateIncome> envelope) => WithCommand(envelope.Body.Key).Execute(envelope, () => new Income(envelope.Body.Amount, envelope.Body.Description, envelope.Body.When));
public Task HandleAsync(Envelope<DeleteIncome> envelope) => WithCommand(envelope.Body.Key).Execute(envelope.Body.IncomeKey, envelope, model => model.Delete());
}
}
2 changes: 1 addition & 1 deletion src/Money/Income.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Task IEventHandler<IncomeDeleted>.HandleAsync(IncomeDeleted payload)
{
return UpdateState(() =>
{
IsDeleted = true
IsDeleted = true;
});
}
}
Expand Down

0 comments on commit 21a5bc7

Please sign in to comment.