-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Queueing of external events while identity is in status
ToBeDeleted
(…
…#910) * feat: enable sending messages to peers that are in status `ToBeDeleted` * feat: allow changing relationships with `ToBeDeleted` peers * chore: update integration tests * feat: identities in status `ToBeDeleted` can't start a new sync run * refactor: remove address variable * feat: identities in status `ToBeDeleted` are not notified via push notifications * fix: actual deletion worker * test: fix tests * refactor: use void instead `IEventBus` * test: fix missing parameter * test: dont send notifications when identity is in status to be deleted * fix: relationship created by i1 * test: fix & improve tests * refactor: utilize `await` and remove `.Result` when finding an `Identity` * chore: test formatting * refactor: utilize `await` and rename application error * chore: formatting * chore: remove unused using * chore: remove unused unsings * chore: remove unused using * refactor: utilize `await` instead of `.Result` * chore: rename application error * chore: remove redundant identity status check * chore: formatting * chore: rename * chore: rename error message * chore: remove redundant `TestDataGenerator` * test: update test * refactor: status check * refactor: implement EnsureIdentityIsToBeDeleted * refactor: remove redundant method * refactor: implement not found exception * fix: unblock notifications * chore: refactor * test: improve tests * chore: rename test * test: fix tests * chore: fix formatting * test: refactor tests & add `TestDataGenerator` * fix: remove unnecessary null check * chore: fix domain error message * chore: fix accidentally removed blank line * chore: fix formatting * chore: rename variable * chore: rename method * chore: revert & remove code * fix: remove status check from PNS handle * chore: remove unused code * refactor: SyncRunsController * chore: undo unnecessary changes to this file * chore: cleanup * feat: block push notifications * refactor: block starting a sync run for identities in status `ToBeDeleted` * chore: fix formatting * test: improve & fix tests * test: add new test * fix: remove user context * refactor: split step definitions * test: add assignment to WhenResponse --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Timo Notheisen <[email protected]>
- Loading branch information
1 parent
90d6f9b
commit 9dbd785
Showing
15 changed files
with
98 additions
and
76 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
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
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
12 changes: 10 additions & 2 deletions
12
...tion/DomainEvents/Incoming/ExternalEventCreated/ExternalEventCreatedDomainEventHandler.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 |
---|---|---|
@@ -1,24 +1,32 @@ | ||
using Backbone.BuildingBlocks.Application.Abstractions.Exceptions; | ||
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus; | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository; | ||
using Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.ExternalEvents; | ||
using Backbone.Modules.Devices.Domain.DomainEvents.Incoming.ExternalEventCreated; | ||
using Backbone.Modules.Devices.Domain.Entities.Identities; | ||
|
||
namespace Backbone.Modules.Devices.Application.DomainEvents.Incoming.ExternalEventCreated; | ||
|
||
public class ExternalEventCreatedDomainEventHandler : IDomainEventHandler<ExternalEventCreatedDomainEvent> | ||
{ | ||
private readonly IPushNotificationSender _pushSenderService; | ||
private readonly IIdentitiesRepository _identitiesRepository; | ||
|
||
public ExternalEventCreatedDomainEventHandler(IPushNotificationSender pushSenderService) | ||
public ExternalEventCreatedDomainEventHandler(IPushNotificationSender pushSenderService, IIdentitiesRepository identitiesRepository) | ||
{ | ||
_pushSenderService = pushSenderService; | ||
_identitiesRepository = identitiesRepository; | ||
} | ||
|
||
public async Task Handle(ExternalEventCreatedDomainEvent @event) | ||
{ | ||
if (@event.IsDeliveryBlocked) | ||
return; | ||
|
||
await _pushSenderService.SendNotification(@event.Owner, new ExternalEventCreatedPushNotification(), CancellationToken.None); | ||
var identity = await _identitiesRepository.FindByAddress(@event.Owner, CancellationToken.None) ?? throw new NotFoundException(nameof(Identity)); | ||
|
||
if (identity.Status != IdentityStatus.ToBeDeleted) | ||
await _pushSenderService.SendNotification(@event.Owner, new ExternalEventCreatedPushNotification(), CancellationToken.None); | ||
} | ||
} |
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
Oops, something went wrong.