Generalizing saving of search, applying it to PaymentRequests grid

This commit is contained in:
rockstardev
2020-07-19 16:40:57 -05:00
parent 6bacddc159
commit 9d9d0461ad
6 changed files with 60 additions and 49 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Controllers.Logic;
using BTCPayServer.Data;
using BTCPayServer.Events;
using BTCPayServer.Filters;
@@ -61,8 +62,11 @@ namespace BTCPayServer.Controllers
[HttpGet]
[Route("")]
[BitpayAPIConstraint(false)]
public async Task<IActionResult> GetPaymentRequests(int skip = 0, int count = 50, bool includeArchived = false)
public async Task<IActionResult> GetPaymentRequests(int skip = 0, int count = 50, string searchTerm = null, int? timezoneOffset = null)
{
ListCookiePreference.Parse(this, "ListPaymentRequestsPreference", ref searchTerm, ref timezoneOffset);
var includeArchived = new SearchString(searchTerm).GetFilterBool("includearchived") == true;
var result = await _PaymentRequestRepository.FindPaymentRequests(new PaymentRequestQuery()
{
UserId = GetUserId(),