Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Hackney.Shared.Asset/Domain/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Asset
public int? VersionNumber { get; set; }
public List<PatchEntity?> Patches { get; set; }

public AssetContract AssetContract { get; set; }
public static Asset Create(string id,
string assetId,
string assetType,
Expand Down
14 changes: 14 additions & 0 deletions Hackney.Shared.Asset/Domain/AssetContract.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Hackney.Shared.Asset.Domain
{
public class AssetContract
{
public string Id { get; set; }
public string TargetId { get; set; }
public string TargetType { get; set; }
public IEnumerable<Charges> Charges { get; set; }
}
}
15 changes: 15 additions & 0 deletions Hackney.Shared.Asset/Domain/Charges.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Hackney.Shared.Asset.Domain
{
public class Charges
{
public string Id { get; set; }
public string Type { get; set; }
public string SubType { get; set; }
public Frequency Frequency { get; set; }
public decimal? Amount { get; set; }
}
}
9 changes: 9 additions & 0 deletions Hackney.Shared.Asset/Domain/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,14 @@ public enum AssetType
Maisonette,
[EnumMember(Value = "New Build")]
NewBuild
}

[JsonConverter(typeof(JsonStringEnumConverter))]
public enum Frequency
{
Daily,
Weekly,
Monthly,
Yearly
}
}
2 changes: 2 additions & 0 deletions Hackney.Shared.Asset/Factories/EntityFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static AssetDomain ToDomain(this AssetDb databaseEntity)
AssetAddress = databaseEntity.AssetAddress,
AssetManagement = databaseEntity.AssetManagement,
AssetCharacteristics = databaseEntity.AssetCharacteristics,
AssetContract = databaseEntity.AssetContract,
Tenure = databaseEntity.Tenure.ToDomain(),
VersionNumber = databaseEntity.VersionNumber,
Patches = databaseEntity.Patches?.ToDomain()
Expand Down Expand Up @@ -69,6 +70,7 @@ public static AssetDb ToDatabase(this AssetDomain domain)
AssetAddress = domain.AssetAddress,
AssetManagement = domain.AssetManagement,
AssetCharacteristics = domain.AssetCharacteristics,
AssetContract = domain.AssetContract,
Tenure = domain.Tenure.ToDatabase(),
VersionNumber = domain.VersionNumber,
Patches = domain.Patches?.ToDatabase()
Expand Down
3 changes: 3 additions & 0 deletions Hackney.Shared.Asset/Infrastructure/AssetDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class AssetDb
[DynamoDBProperty(Converter = typeof(DynamoDbObjectListConverter<PatchesDb>))]
public List<PatchesDb?> Patches { get; set; }

[DynamoDBProperty(Converter = typeof(DynamoDbObjectConverter<AssetContract>))]
public AssetContract AssetContract { get; set; }

[DynamoDBVersion]
public int? VersionNumber { get; set; }
}
Expand Down