-
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.
- Loading branch information
1 parent
198600c
commit 3fbf6ad
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.../Devices.Application/Identities/Queries/GetDeletionProcesses/GetDeletionProcessesQuery.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,7 @@ | ||
using MediatR; | ||
|
||
namespace Backbone.Modules.Devices.Application.Identities.Queries.GetDeletionProcesses; | ||
|
||
public class GetDeletionProcessesQuery : IRequest<GetDeletionProcessesResponse> | ||
{ | ||
} |
15 changes: 15 additions & 0 deletions
15
...vices.Application/Identities/Queries/GetDeletionProcesses/GetDeletionProcessesResponse.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,15 @@ | ||
using Backbone.Modules.Devices.Application.DTOs; | ||
using Backbone.Modules.Devices.Domain.Entities.Identities; | ||
|
||
namespace Backbone.Modules.Devices.Application.Identities.Queries.GetDeletionProcesses; | ||
public class GetDeletionProcessesResponse | ||
{ | ||
public GetDeletionProcessesResponse(Identity identity) | ||
{ | ||
DeletionProcesses = identity.DeletionProcesses | ||
.Select(p => new IdentityDeletionProcessDTO(p)) | ||
.ToList(); | ||
} | ||
|
||
public List<IdentityDeletionProcessDTO> DeletionProcesses { get; set; } | ||
} |
27 changes: 27 additions & 0 deletions
27
Modules/Devices/src/Devices.Application/Identities/Queries/GetDeletionProcesses/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,27 @@ | ||
using Backbone.BuildingBlocks.Application.Abstractions.Exceptions; | ||
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.UserContext; | ||
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository; | ||
using Backbone.Modules.Devices.Domain.Entities.Identities; | ||
using MediatR; | ||
|
||
namespace Backbone.Modules.Devices.Application.Identities.Queries.GetDeletionProcesses; | ||
|
||
public class Handler : IRequestHandler<GetDeletionProcessesQuery, GetDeletionProcessesResponse> | ||
{ | ||
private readonly IIdentitiesRepository _identityRepository; | ||
private readonly IUserContext _userContext; | ||
|
||
public Handler(IIdentitiesRepository identityRepository, IUserContext userContext) | ||
{ | ||
_identityRepository = identityRepository; | ||
_userContext = userContext; | ||
} | ||
|
||
public async Task<GetDeletionProcessesResponse> Handle(GetDeletionProcessesQuery request, CancellationToken cancellationToken) | ||
{ | ||
var identity = await _identityRepository.FindByAddress(_userContext.GetAddress(), cancellationToken) ?? throw new NotFoundException(nameof(Identity)); | ||
var response = new GetDeletionProcessesResponse(identity); | ||
|
||
return response; | ||
} | ||
} |
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