Introduce Server paging for Payouts List (#2564)

* Introduce Server paging for Payouts List

* Add paging params

* Minor code and formatting improvements

* View updates

* Apply suggestions from code review

Co-authored-by: Zaxounette <51208677+Zaxounette@users.noreply.github.com>

* fix tests

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
Co-authored-by: Zaxounette <51208677+Zaxounette@users.noreply.github.com>
This commit is contained in:
Andrew Camilleri
2021-06-30 08:59:01 +01:00
committed by GitHub
parent 33de4cccfc
commit 6c856aba48
5 changed files with 267 additions and 270 deletions

View File

@@ -2,18 +2,21 @@ using System;
using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Payments;
namespace BTCPayServer.Models.WalletViewModels
{
public class PayoutsModel
public class PayoutsModel : BasePagingViewModel
{
public string PullPaymentId { get; set; }
public string Command { get; set; }
public List<PayoutStateSet> PayoutStateSets{ get; set; }
public Dictionary<PayoutState, int> PayoutStateCount { get; set; }
public PaymentMethodId PaymentMethodId { get; set; }
public List<PayoutModel> Payouts { get; set; }
public PayoutState PayoutState { get; set; }
public string PullPaymentName { get; set; }
public class PayoutModel
{
public string PayoutId { get; set; }
@@ -26,16 +29,9 @@ namespace BTCPayServer.Models.WalletViewModels
public string ProofLink { get; set; }
}
public class PayoutStateSet
{
public PayoutState State { get; set; }
public List<PayoutModel> Payouts { get; set; }
}
public string[] GetSelectedPayouts(PayoutState state)
{
return PayoutStateSets.Where(set => set.State == state)
.SelectMany(set => set.Payouts.Where(model => model.Selected).Select(model => model.PayoutId))
return Payouts.Where(model => model.Selected).Select(model => model.PayoutId)
.ToArray();
}
}