using FictionArchive.Service.Shared.Services.GraphQL; using HotChocolate.Execution.Configuration; using HotChocolate.Types.NodaTime; using Microsoft.Extensions.DependencyInjection; namespace FictionArchive.Service.Shared.Extensions; public static class GraphQLExtensions { public static IRequestExecutorBuilder AddDefaultGraphQl(this IServiceCollection services) where TQuery : class where TMutation : class { return services.AddGraphQLServer() .AddQueryType() .AddMutationType() .AddDiagnosticEventListener() .AddType() .AddType() .AddMutationConventions(applyToAllMutations: true) .AddFiltering(opt => opt.AddDefaults().BindRuntimeType()) .AddSorting() .AddProjections(); } }