Refactor labels (#4179)

* Create new tables

* wip

* wip

* Refactor LegacyLabel

* Remove LabelFactory

* Add migration

* wip

* wip

* Add pull-payment attachment to tx

* Address kukks points
This commit is contained in:
Nicolas Dorier
2022-10-11 17:34:29 +09:00
committed by GitHub
parent 895462ac7f
commit a2fa688cde
38 changed files with 1303 additions and 729 deletions

View File

@@ -15,9 +15,9 @@ namespace BTCPayServer.Models.WalletViewModels
public string Link { get; set; }
public bool Positive { get; set; }
public string Balance { get; set; }
public HashSet<ColoredLabel> Labels { get; set; } = new HashSet<ColoredLabel>();
public HashSet<TransactionTagModel> Tags { get; set; } = new HashSet<TransactionTagModel>();
}
public HashSet<ColoredLabel> Labels { get; set; } = new HashSet<ColoredLabel>();
public HashSet<(string Text, string Color, string TextColor)> Labels { get; set; } = new HashSet<(string Text, string Color, string TextColor)>();
public List<TransactionViewModel> Transactions { get; set; } = new List<TransactionViewModel>();
public override int CurrentPageCount => Transactions.Count;
public string CryptoCode { get; set; }

View File

@@ -0,0 +1,40 @@
using System;
namespace BTCPayServer.Models.WalletViewModels
{
public class TransactionTagModel
{
public string Text { get; internal set; }
public string Color { get; internal set; }
public string TextColor { get; internal set; }
public string Link { get; internal set; }
public string Tooltip { get; internal set; } = String.Empty;
public override bool Equals(object obj)
{
TransactionTagModel item = obj as TransactionTagModel;
if (item == null)
return false;
return Text.Equals(item.Text, StringComparison.OrdinalIgnoreCase);
}
public static bool operator ==(TransactionTagModel a, TransactionTagModel b)
{
if (System.Object.ReferenceEquals(a, b))
return true;
if (((object)a == null) || ((object)b == null))
return false;
return a.Text == b.Text;
}
public static bool operator !=(TransactionTagModel a, TransactionTagModel b)
{
return !(a == b);
}
public override int GetHashCode()
{
return Text.GetHashCode(StringComparison.OrdinalIgnoreCase);
}
}
}

View File

@@ -73,7 +73,7 @@ namespace BTCPayServer.Models.WalletViewModels
public class InputSelectionOption
{
public IEnumerable<ColoredLabel> Labels { get; set; }
public IEnumerable<TransactionTagModel> Labels { get; set; }
public string Comment { get; set; }
public decimal Amount { get; set; }
public string Outpoint { get; set; }