public async Task <IActionResult> Get(string terms, WorkflowStatus?status, string type, DateTime?createdFrom, DateTime?createdTo, int skip, int take = 10) { var filters = new List <SearchFilter>(); if (status.HasValue) { filters.Add(StatusFilter.Equals(status.Value)); } if (createdFrom.HasValue) { filters.Add(DateRangeFilter.After(x => x.CreateTime, createdFrom.Value)); } if (createdTo.HasValue) { filters.Add(DateRangeFilter.Before(x => x.CreateTime, createdTo.Value)); } if (!string.IsNullOrEmpty(type)) { filters.Add(ScalarFilter.Equals(x => x.WorkflowDefinitionId, type)); } var result = await _searchService.Search(terms, skip, take, filters.ToArray()); return(Json(result)); }
public async void should_filter_on_reference() { var result = await Subject.Search(null, 0, 10, ScalarFilter.Equals(x => x.Reference, "ref2")); result.Data.Should().NotContain(x => x.Id == "1"); result.Data.Should().Contain(x => x.Id == "2"); result.Data.Should().NotContain(x => x.Id == "3"); }
public async void should_filter_on_custom_data() { var result = await Subject.Search(null, 0, 10, ScalarFilter.Equals <DataObject>(x => x.Value3, 7)); result.Data.Should().NotContain(x => x.Id == "1"); result.Data.Should().Contain(x => x.Id == "2"); result.Data.Should().NotContain(x => x.Id == "3"); }
public async void should_filter_on_alt_custom_data_with_conflicting_names() { var result1 = await Subject.Search(null, 0, 10, ScalarFilter.Equals <AltDataObject>(x => x.Value1, 9)); var result2 = await Subject.Search(null, 0, 10, DateRangeFilter.Between <AltDataObject>(x => x.Value2, new DateTime(1999, 12, 31), new DateTime(2000, 1, 2))); result1.Data.Should().Contain(x => x.Id == "4"); result2.Data.Should().Contain(x => x.Id == "4"); }
public static void Main(string[] args) { IServiceProvider serviceProvider = ConfigureServices(); //start the workflow host var host = serviceProvider.GetService <IWorkflowHost>(); var searchIndex = serviceProvider.GetService <ISearchIndex>(); host.RegisterWorkflow <WorkflowCore.Sample03.PassingDataWorkflow, WorkflowCore.Sample03.MyDataClass>(); host.RegisterWorkflow <WorkflowCore.Sample04.EventSampleWorkflow, WorkflowCore.Sample04.MyDataClass>(); host.Start(); var data1 = new WorkflowCore.Sample03.MyDataClass() { Value1 = 2, Value2 = 3 }; host.StartWorkflow("PassingDataWorkflow", data1, "quick dog").Wait(); var data2 = new WorkflowCore.Sample04.MyDataClass() { Value1 = "test" }; host.StartWorkflow("EventSampleWorkflow", data2, "alt1 boom").Wait(); var searchResult1 = searchIndex.Search("dog", 0, 10).Result; var searchResult2 = searchIndex.Search("quick dog", 0, 10).Result; var searchResult3 = searchIndex.Search("fast", 0, 10).Result; var searchResult4 = searchIndex.Search("alt1", 0, 10).Result; var searchResult5 = searchIndex.Search("dogs", 0, 10).Result; var searchResult6 = searchIndex.Search("test", 0, 10).Result; var searchResult7 = searchIndex.Search("", 0, 10).Result; var searchResult8 = searchIndex.Search("", 0, 10, ScalarFilter.Equals(x => x.Reference, "quick dog")).Result; var searchResult9 = searchIndex.Search("", 0, 10, ScalarFilter.Equals <WorkflowCore.Sample03.MyDataClass>(x => x.Value1, 2)).Result; Console.ReadLine(); host.Stop(); }