-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analytics tracking for UpdateTenant, DeleteTenant, UpdateUser, an…
…d DeleteTenant
- Loading branch information
Showing
5 changed files
with
62 additions
and
4 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
8 changes: 7 additions & 1 deletion
8
application/account-management/Application/Users/DeleteUser.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,18 +1,24 @@ | ||
using PlatformPlatform.SharedKernel.ApplicationCore.Cqrs; | ||
using PlatformPlatform.SharedKernel.ApplicationCore.Tracking; | ||
|
||
namespace PlatformPlatform.AccountManagement.Application.Users; | ||
|
||
public sealed record DeleteUserCommand(UserId Id) : ICommand, IRequest<Result>; | ||
|
||
[UsedImplicitly] | ||
public sealed class DeleteUserHandler(IUserRepository userRepository) : IRequestHandler<DeleteUserCommand, Result> | ||
public sealed class DeleteUserHandler( | ||
IUserRepository userRepository, | ||
IAnalyticEventsCollector analyticEventsCollector | ||
) : IRequestHandler<DeleteUserCommand, Result> | ||
{ | ||
public async Task<Result> Handle(DeleteUserCommand command, CancellationToken cancellationToken) | ||
{ | ||
var user = await userRepository.GetByIdAsync(command.Id, cancellationToken); | ||
if (user is null) return Result.NotFound($"User with id '{command.Id}' not found."); | ||
|
||
userRepository.Remove(user); | ||
|
||
analyticEventsCollector.CollectEvent("UserDeleted"); | ||
return Result.Success(); | ||
} | ||
} |
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