-
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.
Admin API for sending announcements to specific identities (#1034)
* feat: added optional property recipients and validation rule added some bruno http request files * fix: declared the property Recipients as nullable * fix: validation rule of Recipients * fix: validation of property Recipients * feat: added AnnouncementRecipient + Migration + Handler update * feat: added AnnouncementRecipient Migration * feat: added announcement-recipients, updated outgoing/incoming domain-event, updated push-service * feat: return recipients in admin-api on get request * feat: added Announcement Recipient IdentityDeleter * chore: removed pubspec.lock * fix: fixed AnnouncementRecipient + PushService usage per PnsHandle * test: added CreateAnnouncement Handler Tests * test: added AnnouncementRecipient Anonymize IdentityDeleter Tests * test: added AnonymizeRecipient tests * fix: updated docker file * fix: updated docker-file * chore: added debug-logging * chore: added some debug statement * chore: debug - check database-migrator logs * chore: debug - fixed the check database-migrator-test log cmd * chore: added new migration as error seen in logs regarding AnnouncementsDbContext * fix: added announcement-recipient migration for sqlserver + postgres db * fix: another attempt to get the database-migrator-test logs * chore: try to log exiting ci-seed-database-1 container * chore: try to log exiting ci-seed-database-1 container * fix: replaced DistinctBy (can't be translated to SQL by EF Core) * chore: removed debug log * fix: added AnnouncementsModule * fix: added missing DOCKERFILE project reference * fix: added missing DOCKERFILE project reference * fix: updated regarding PR remarks * fix: use change-tracker announcements * fix: updated regarding PR remarks * test: new AnonymizeRecipient Handler UnitTest * chore: added ValidId check * fix: failed test * chore: cleanup * fix: remove didDomainName from appsettings.json files and add it to appsettings.override.json files * feat: delete recipients instead of anonymizing them * refactor: simplify CreateAnnouncement Handler * chore: add `FromBody` attribute * refactor: simplify application logic by adding a default value to the `Recipients` property of the CreateAnnouncementCommand * fix: don't catch and rethrow exceptions in SseServerClient * refactor: simplify validation * fix: fix migration errors * fix: return simple string instead of an object in AnnouncementDTO.cs * chore: delete redundant tests * chore: delete unused repository method * chore: don't unclude navigation properties when deleting recipients * chore: cleanup * refactor: move extension method to correct place * refactor: simplify AnnouncementCreatedDomainEventHandler * chore: restore original order of members of PushService * refactor: filter for distinct handles in PushService instead of in the repository * test: fix invalidId tests * chore: remove redundant query parameters from bruno files --------- Co-authored-by: Eric Brunner <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b34229e
commit cbdb115
Showing
48 changed files
with
792 additions
and
55 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Applications/AdminApi/http/Announcements/Announcements.bru
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 @@ | ||
meta { | ||
name: /Announcements | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
post { | ||
url: {{baseUrl}}/Announcements | ||
body: json | ||
auth: none | ||
} | ||
|
||
body:json { | ||
{ | ||
"severity": 1, | ||
"texts": [ | ||
{ | ||
"language": "en", | ||
"title": "System Maintenance V2", | ||
"body": "The system will be undergoing maintenance on Saturday." | ||
} | ||
], | ||
"expiresAt": "2023-12-31T23:59:59Z", | ||
"recipients": [ | ||
"did:e:localhost:dids:8234cca0160ff05c785636", | ||
"did:e:localhost:dids:5b8640b14cc9796fbf8d0d" | ||
] | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Applications/AdminApi/http/Announcements/List Announcements.bru
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,11 @@ | ||
meta { | ||
name: /Announcements | ||
type: http | ||
seq: 2 | ||
} | ||
|
||
get { | ||
url: {{baseUrl}}/Announcements | ||
body: none | ||
auth: 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
15 changes: 15 additions & 0 deletions
15
Applications/ConsumerApi/src/http/Announcements/List Announcements.bru
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,15 @@ | ||
meta { | ||
name: /Announcements | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
get { | ||
url: {{baseUrl}}/Announcements | ||
body: none | ||
auth: inherit | ||
} | ||
|
||
params:query { | ||
language: en | ||
} |
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
2 changes: 2 additions & 0 deletions
2
Applications/IdentityDeletionJobs/src/Job.IdentityDeletion/ServicesExtensions.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
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
9 changes: 9 additions & 0 deletions
9
BuildingBlocks/src/Tooling/Extensions/IEnumerableExtensions.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,9 @@ | ||
namespace Backbone.Tooling.Extensions; | ||
|
||
public static class IEnumerableExtensions | ||
{ | ||
public static bool IsEmpty<T>(this IEnumerable<T> items) | ||
{ | ||
return !items.Any(); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...nnouncements/Commands/DeleteAnnouncementRecipients/DeleteAnnouncementRecipientsCommand.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,13 @@ | ||
using MediatR; | ||
|
||
namespace Backbone.Modules.Announcements.Application.Announcements.Commands.DeleteAnnouncementRecipients; | ||
|
||
public record DeleteAnnouncementRecipientsCommand : IRequest | ||
{ | ||
public DeleteAnnouncementRecipientsCommand(string identityAddress) | ||
{ | ||
IdentityAddress = identityAddress; | ||
} | ||
|
||
public string IdentityAddress { get; } | ||
} |
22 changes: 22 additions & 0 deletions
22
.../Announcements.Application/Announcements/Commands/DeleteAnnouncementRecipients/Handler.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,22 @@ | ||
using Backbone.DevelopmentKit.Identity.ValueObjects; | ||
using Backbone.Modules.Announcements.Application.Infrastructure.Persistence.Repository; | ||
using MediatR; | ||
|
||
namespace Backbone.Modules.Announcements.Application.Announcements.Commands.DeleteAnnouncementRecipients; | ||
|
||
public class Handler : IRequestHandler<DeleteAnnouncementRecipientsCommand> | ||
{ | ||
private readonly IAnnouncementsRepository _announcementsRepository; | ||
|
||
public Handler(IAnnouncementsRepository announcementsRepository) | ||
{ | ||
_announcementsRepository = announcementsRepository; | ||
} | ||
|
||
public async Task Handle(DeleteAnnouncementRecipientsCommand request, CancellationToken cancellationToken) | ||
{ | ||
var parsedIdentityAddress = IdentityAddress.Parse(request.IdentityAddress); | ||
|
||
await _announcementsRepository.DeleteRecipients(r => r.Address == parsedIdentityAddress, cancellationToken); | ||
} | ||
} |
Oops, something went wrong.