-
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.
refactor: rearrange properties to match domain class
refactor: pass in entire identity to ctor
- Loading branch information
1 parent
6363d66
commit f2b917a
Showing
1 changed file
with
17 additions
and
20 deletions.
There are no files selected for viewing
37 changes: 17 additions & 20 deletions
37
Modules/Devices/src/Devices.Application/DTOs/IdentitySummaryDTO.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,46 +1,43 @@ | ||
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<DeviceDTO> Devices { get; set; } | ||
public int NumberOfDevices { get; set; } | ||
|
||
public IEnumerable<DeviceDTO> Devices { get; set; } | ||
public byte IdentityVersion { get; set; } | ||
|
||
public IdentitySummaryDTO(IdentityAddress address, string? clientId, byte[] publicKey, byte identityVersion, DateTime createdAt, List<Device> 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, | ||
Id = it.Id, | ||
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; | ||
} | ||
} |