-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(weapons): assign weapon holder on 'WarMaterialDeliveryCertificat…
…eFormat' created
- Loading branch information
1 parent
e2dc588
commit f21ef17
Showing
8 changed files
with
76 additions
and
17 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
29 changes: 29 additions & 0 deletions
29
...plication/AssignHolder/AssignWeaponHolderOnWarMaterialDeliveryCertificateFormatCreated.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,29 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Armory.Shared.Domain.Bus.Event; | ||
using Armory.Shared.Domain.Formats.WarMaterialDeliveryCertificateFormats; | ||
|
||
namespace Armory.Armament.Weapons.Application.AssignHolder | ||
{ | ||
public class | ||
AssignWeaponHolderOnWarMaterialDeliveryCertificateFormatCreated : IDomainEventSubscriber< | ||
WarMaterialDeliveryCertificateFormatCreatedDomainEvent> | ||
{ | ||
private readonly WeaponHolderAssigner _assigner; | ||
|
||
public AssignWeaponHolderOnWarMaterialDeliveryCertificateFormatCreated(WeaponHolderAssigner assigner) | ||
{ | ||
_assigner = assigner; | ||
} | ||
|
||
public async Task Handle(WarMaterialDeliveryCertificateFormatCreatedDomainEvent notification, | ||
CancellationToken cancellationToken) | ||
{ | ||
var holder = notification.TroopId; | ||
foreach (var weapon in notification.Weapons) | ||
{ | ||
await _assigner.AssignHolder(weapon, holder); | ||
} | ||
} | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
...erialDeliveryCertificateFormats/WarMaterialDeliveryCertificateFormatCreatedDomainEvent.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,19 @@ | ||
using System.Collections.Generic; | ||
using Armory.Shared.Domain.Bus.Event; | ||
|
||
namespace Armory.Shared.Domain.Formats.WarMaterialDeliveryCertificateFormats | ||
{ | ||
public class WarMaterialDeliveryCertificateFormatCreatedDomainEvent : DomainEvent | ||
{ | ||
public IEnumerable<string> Weapons { get; init; } | ||
public IDictionary<string, int> Ammunition { get; init; } | ||
public IDictionary<string, int> Equipments { get; init; } | ||
public IDictionary<string, int> Explosives { get; init; } | ||
public string TroopId { get; init; } | ||
|
||
public override string EventName() | ||
{ | ||
return "war_material_delivery_certificate_format.created"; | ||
} | ||
} | ||
} |
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