public async Task TenantDisplayByIdDataTest() { using var store = GetDocumentStore(); using var session = store.OpenAsyncSession(); var query = new TenantDisplayById { Session = session, Id = TenantData.FirstId }; await query.Execute(); query.Result.Should().NotBeNull(); query.Result.Id.Should().Be(TenantData.FirstId); query.Result.Searchable.Should().BeEmpty(); Assert.That(query.Result, Is.DeepEqualTo(TenantData.GetFirstDisplay())); }
public async Task <IActionResult> Get() { var current = new CurrentViewModel() { Id = CurrentUser.Id, TenantId = CurrentUser.TenantId, Config = CurrentConfig, Right = CurrentUser.Right }; var tenant = new TenantDisplayById { Id = CurrentUser.TenantId }; await DataHandler.Execute(tenant); if (tenant.Result != null) { current = Mapper.Map(tenant.Result, current); } return(Ok(current)); }
public async Task <IActionResult> Display(string id) { if (CurrentUser.TenantId == id || CurrentUser.Right.CanSuperuser) { var query = new TenantDisplayById { Id = id }; await DataHandler.Execute(query); if (query.Result != null) { return(Ok(Strip(query.Result))); } return(NotFound()); } return(Unauthorized()); }