diff --git a/Modules/Devices/src/Devices.Application/DTOs/IdentitySummaryDTO.cs b/Modules/Devices/src/Devices.Application/DTOs/IdentitySummaryDTO.cs index b7cb02dfb3..8ab36caaf0 100644 --- a/Modules/Devices/src/Devices.Application/DTOs/IdentitySummaryDTO.cs +++ b/Modules/Devices/src/Devices.Application/DTOs/IdentitySummaryDTO.cs @@ -1,37 +1,32 @@ -using Backbone.DevelopmentKit.Identity.ValueObjects; -using Backbone.Modules.Devices.Application.Devices.DTOs; +using Backbone.Modules.Devices.Application.Devices.DTOs; using Backbone.Modules.Devices.Domain.Entities; namespace Backbone.Modules.Devices.Application.DTOs; public class IdentitySummaryDTO { - public string Address { get; set; } public string? ClientId { get; set; } - public byte[] PublicKey { get; set; } - - public string TierId { get; set; } + public string Address { get; set; } + public byte[] PublicKey { get; set; } public DateTime CreatedAt { get; set; } - public byte IdentityVersion { get; set; } - + public IEnumerable Devices { get; set; } public int NumberOfDevices { get; set; } - public IEnumerable Devices { get; set; } + public byte IdentityVersion { get; set; } - public IdentitySummaryDTO(IdentityAddress address, string? clientId, byte[] publicKey, byte identityVersion, DateTime createdAt, List devices, string tierId) - { - Address = address.ToString(); + public string TierId { get; set; } - if (clientId != null) - ClientId = clientId; + public IdentitySummaryDTO(Identity identity) + { + ClientId = identity.ClientId; - PublicKey = publicKey; - IdentityVersion = identityVersion; - CreatedAt = createdAt; + Address = identity.Address.ToString(); + PublicKey = identity.PublicKey; + CreatedAt = identity.CreatedAt; - Devices = devices.Select(it => new DeviceDTO() + Devices = identity.Devices.Select(it => new DeviceDTO() { CreatedAt = it.CreatedAt, CreatedByDevice = it.CreatedByDevice, @@ -39,8 +34,10 @@ public IdentitySummaryDTO(IdentityAddress address, string? clientId, byte[] publ LastLogin = new LastLoginInformation { Time = it.User.LastLoginAt }, Username = it.User.UserName! }); + NumberOfDevices = identity.Devices.Count; + + IdentityVersion = identity.IdentityVersion; - NumberOfDevices = devices.Count; - TierId = tierId; + TierId = identity.TierId; } }