public async Task <IActionResult> Filter([FromBody] TenantFilter viewModel) { if (CurrentUser.Right.CanSuperuser) { var query = new TenantDisplayByFilter { Filter = viewModel, CurrentUser = CurrentUser }; await DataHandler.Execute(query); return(Ok(new PagedResult <IEnumerable <TenantDisplay> > { Data = Secure(query.Result), Paging = query.Paging, Success = true })); } return(Unauthorized()); }
public async Task TenantDisplayByFilterDataTestSearch() { var filter = new TenantFilter { Search = "Org", Take = 10 }; using var store = GetDocumentStore(); using var session = store.OpenAsyncSession(); var query = new TenantDisplayByFilter { Session = session, Filter = filter, CurrentUser = StandardUser }; await query.Execute(); query.Result.Should().NotBeNull(); query.Result.Count().Should().Be(1); Assert.That(query.Result.First(), Is.DeepEqualTo(TenantData.GetFirstDisplay())); }