Make it possible to gather values using scoped ItemConfiguration
This commit is contained in:
@@ -3,28 +3,23 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public class ConfirmCreateItemHandler(IMediator mediator,
|
||||
IDecoratorService<ItemConfiguration> decoratorItemConfiguration,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<ConfirmEventArgs<Item>>
|
||||
{
|
||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||
{
|
||||
string? name = await mediator.Handle<ConfirmEventArgs<ItemHeader>,
|
||||
string>(Confirm.As<ItemHeader>());
|
||||
|
||||
if (name is not null)
|
||||
if (decoratorItemConfiguration.Value is ItemConfiguration configuration)
|
||||
{
|
||||
IList<(int, string)> sections = await mediator.HandleMany<ConfirmEventArgs<ItemSection>,
|
||||
(int, string)>(Confirm.As<ItemSection>());
|
||||
string? name = await mediator.Handle<ConfirmEventArgs<ItemHeader>, string>(Confirm.As<ItemHeader>());
|
||||
if (name is not null)
|
||||
{
|
||||
Guid id = Guid.NewGuid();
|
||||
publisher.Publish(Created.As(new Item<(Guid, string)>((id, name))));
|
||||
|
||||
IList<(int, ItemEntryConfiguration)> entries = await mediator.HandleMany<ConfirmEventArgs<ItemContentEntry>,
|
||||
(int, ItemEntryConfiguration)>(Confirm.As<ItemContentEntry>());
|
||||
|
||||
Guid id = Guid.NewGuid();
|
||||
publisher.Publish(Created.As(new Item<(Guid, string)>((id, name))));
|
||||
|
||||
await mediator.Handle<CreateEventArgs<(Guid, string, string,
|
||||
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string, ItemConfiguration)>((id, name, "",
|
||||
new ItemConfiguration())));
|
||||
await mediator.Handle<CreateEventArgs<(Guid, string, string,
|
||||
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string, ItemConfiguration)>((id, name, "", configuration)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user