diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/ApproveDeletionProcess/ApproveDeletionProcessResponse.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/ApproveDeletionProcess/ApproveDeletionProcessResponse.cs index 5c5706d8de..539e72c686 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/ApproveDeletionProcess/ApproveDeletionProcessResponse.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/ApproveDeletionProcess/ApproveDeletionProcessResponse.cs @@ -1,21 +1,11 @@ +using Backbone.Modules.Devices.Application.DTOs; using Backbone.Modules.Devices.Domain.Entities.Identities; namespace Backbone.Modules.Devices.Application.Identities.Commands.ApproveDeletionProcess; -public class ApproveDeletionProcessResponse +public class ApproveDeletionProcessResponse : IdentityDeletionProcessOverviewDTO { - public ApproveDeletionProcessResponse(IdentityDeletionProcess deletionProcess) + public ApproveDeletionProcessResponse(IdentityDeletionProcess deletionProcess) : base(deletionProcess) { - Id = deletionProcess.Id; - Status = deletionProcess.Status; - CreatedAt = deletionProcess.CreatedAt; - ApprovedAt = deletionProcess.ApprovedAt ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.ApprovedAt)}' property of the given deletion process must not be null."); - ApprovedByDevice = deletionProcess.ApprovedByDevice ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.ApprovedByDevice)}' property of the given deletion process must not be null."); } - - public string Id { get; } - public DeletionProcessStatus Status { get; } - public DateTime CreatedAt { get; } - public DateTime ApprovedAt { get; } - public string ApprovedByDevice { get; } } diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/CancelDeletionProcessAsOwner/CancelDeletionProcessAsOwnerResponse.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/CancelDeletionProcessAsOwner/CancelDeletionProcessAsOwnerResponse.cs index 60cbf853f0..3eef214f58 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/CancelDeletionProcessAsOwner/CancelDeletionProcessAsOwnerResponse.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/CancelDeletionProcessAsOwner/CancelDeletionProcessAsOwnerResponse.cs @@ -1,19 +1,11 @@ -using Backbone.Modules.Devices.Domain.Entities.Identities; +using Backbone.Modules.Devices.Application.DTOs; +using Backbone.Modules.Devices.Domain.Entities.Identities; namespace Backbone.Modules.Devices.Application.Identities.Commands.CancelDeletionProcessAsOwner; -public class CancelDeletionProcessAsOwnerResponse +public class CancelDeletionProcessAsOwnerResponse : IdentityDeletionProcessOverviewDTO { - public CancelDeletionProcessAsOwnerResponse(IdentityDeletionProcess deletionProcess) + public CancelDeletionProcessAsOwnerResponse(IdentityDeletionProcess deletionProcess) : base(deletionProcess) { - Id = deletionProcess.Id; - Status = deletionProcess.Status; - CancelledAt = deletionProcess.CancelledAt ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.CancelledAt)}' property of the given deletion process must not be null."); - CancelledByDevice = deletionProcess.CancelledByDevice ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.CancelledByDevice)}' property of the given deletion process must not be null."); } - - public string Id { get; } - public DeletionProcessStatus Status { get; } - public DateTime CancelledAt { get; } - public string CancelledByDevice { get; } } diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/RejectDeletionProcess/RejectDeletionProcessResponse.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/RejectDeletionProcess/RejectDeletionProcessResponse.cs index 7c3ebe2e69..8ba8ab90eb 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/RejectDeletionProcess/RejectDeletionProcessResponse.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/RejectDeletionProcess/RejectDeletionProcessResponse.cs @@ -1,18 +1,11 @@ -using Backbone.Modules.Devices.Domain.Entities.Identities; +using Backbone.Modules.Devices.Application.DTOs; +using Backbone.Modules.Devices.Domain.Entities.Identities; namespace Backbone.Modules.Devices.Application.Identities.Commands.RejectDeletionProcess; -public class RejectDeletionProcessResponse + +public class RejectDeletionProcessResponse : IdentityDeletionProcessOverviewDTO { - public RejectDeletionProcessResponse(IdentityDeletionProcess deletionProcess) + public RejectDeletionProcessResponse(IdentityDeletionProcess deletionProcess) : base(deletionProcess) { - Id = deletionProcess.Id; - Status = deletionProcess.Status; - RejectedAt = deletionProcess.RejectedAt ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.RejectedAt)}' property of the given deletion process must not be null."); - RejectedByDevice = deletionProcess.RejectedByDevice ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.RejectedByDevice)}' property of the given deletion process must not be null."); } - - public string Id { get; } - public DeletionProcessStatus Status { get; } - public DateTime RejectedAt { get; } - public string RejectedByDevice { get; } } diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerResponse.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerResponse.cs index 187b5d5bf6..77c32706c0 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerResponse.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerResponse.cs @@ -1,26 +1,11 @@ -using Backbone.DevelopmentKit.Identity.ValueObjects; +using Backbone.Modules.Devices.Application.DTOs; using Backbone.Modules.Devices.Domain.Entities.Identities; namespace Backbone.Modules.Devices.Application.Identities.Commands.StartDeletionProcessAsOwner; -public class StartDeletionProcessAsOwnerResponse +public class StartDeletionProcessAsOwnerResponse : IdentityDeletionProcessOverviewDTO { - public StartDeletionProcessAsOwnerResponse(IdentityDeletionProcess deletionProcess) + public StartDeletionProcessAsOwnerResponse(IdentityDeletionProcess deletionProcess) : base(deletionProcess) { - Id = deletionProcess.Id; - Status = deletionProcess.Status; - CreatedAt = deletionProcess.CreatedAt; - ApprovedAt = deletionProcess.ApprovedAt ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.ApprovedAt)}' property of the given deletion process must not be null."); - ApprovedByDevice = deletionProcess.ApprovedByDevice ?? throw new Exception($"The '{nameof(IdentityDeletionProcess.ApprovedByDevice)}' property of the given deletion process must not be null."); - GracePeriodEndsAt = deletionProcess.GracePeriodEndsAt.GetValueOrDefault(); } - - public string Id { get; set; } - public DeletionProcessStatus Status { get; set; } - public DateTime CreatedAt { get; set; } - - public DateTime ApprovedAt { get; set; } - public DeviceId ApprovedByDevice { get; set; } - - public DateTime GracePeriodEndsAt { get; set; } } diff --git a/Modules/Devices/test/Devices.Application.Tests/Tests/Identities/Commands/RejectDeletionProcess/HandlerTests.cs b/Modules/Devices/test/Devices.Application.Tests/Tests/Identities/Commands/RejectDeletionProcess/HandlerTests.cs index d9e993b27f..236feed42c 100644 --- a/Modules/Devices/test/Devices.Application.Tests/Tests/Identities/Commands/RejectDeletionProcess/HandlerTests.cs +++ b/Modules/Devices/test/Devices.Application.Tests/Tests/Identities/Commands/RejectDeletionProcess/HandlerTests.cs @@ -11,6 +11,7 @@ using static Backbone.UnitTestTools.Data.TestDataGenerator; namespace Backbone.Modules.Devices.Application.Tests.Tests.Identities.Commands.RejectDeletionProcess; + public class HandlerTests { [Fact] @@ -46,8 +47,6 @@ public async Task Happy_path() response.Id.Should().Be(deletionProcess.Id); response.Status.Should().Be(DeletionProcessStatus.Rejected); - response.RejectedAt.Should().Be(utcNow); - response.RejectedByDevice.Should().Be(device.Id); } [Fact]