public LambdaEntry()
        {
            var startup           = new Startup();
            var serviceCollection = new ServiceCollection();

            startup.ConfigureServices(serviceCollection);
            var sp = serviceCollection.BuildServiceProvider();

            _provider = sp.GetService <ICaseProvider>();
            _store    = sp.GetService <ICaseStore>();
        }
Exemple #2
0
        public CovidTrackerQuery(ICaseStore store)
        {
            Field <ListGraphType <CaseType> >(
                "cases",
                resolve:
                context => store.GetAllAsync(),
                description: "List all cases"
                );

            Field <CaseType>(
                "case",
                arguments:
                new QueryArguments(new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "caseNo"
            }),
                resolve:
                context => store.GetByCaseNoAsync(context.GetArgument <string>("caseNo")),
                description: "Get case by caseNo"
                );

            Field <CaseStatisticType>(
                "statistics",
                resolve:
                context => store.GetStatisticsAsync(),
                description: "Get COVID19 case statistics"
                );

            Field <ListGraphType <DateIntAccumulationType> >(
                "accumulation",
                arguments:
                new QueryArguments(new QueryArgument <NonNullGraphType <CumulativeTypeEnumType> > {
                Name = "type"
            }),
                resolve:
                context => store.GetAccumulationAsync(context.GetArgument <Accumulate>("type")),
                description: "Get an accumulation of cases by accumulation type and ordered by date of confirmation descending"
                );

            Field <ListGraphType <AgeGenderDistributionType> >(
                "ageGenderDistribution",
                arguments:
                new QueryArguments(new QueryArgument <NonNullGraphType <CumulativeTypeEnumType> > {
                Name = "type"
            }),
                resolve:
                context => store.GetAgeGenderDistributionAsync(context.GetArgument <Accumulate>("type")),
                description: "Get an accumulation of cases by accumulation type and ordered by date of confirmation descending"
                );
        }