Skip to content

Commit 19327a2

Browse files
author
Daniel Gut
committed
feat(HC): simplified pipeline
1 parent 5f809d3 commit 19327a2

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/GraphQL-AzureFunctions-HotChocolate.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<RootNamespace>GraphQL_AzureFunctions_HotChocolate</RootNamespace>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="HotChocolate.AspNetCore" Version="10.3.2" />
9-
<PackageReference Include="HotChocolate.Types" Version="10.3.2" />
8+
<PackageReference Include="HotChocolate.AspNetCore" Version="10.3.4" />
9+
<PackageReference Include="HotChocolate.Types" Version="10.3.4" />
1010
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
1111
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.2" />
1212
</ItemGroup>

src/GraphQL.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ public class GraphQL
1313
{
1414
private readonly IGraphQLFunctions _graphQLFunctions;
1515

16-
public GraphQL(IGraphQLFunctions functionsGraphqlInjector)
16+
public GraphQL(IGraphQLFunctions graphQLFunctions)
1717
{
18-
_graphQLFunctions = functionsGraphqlInjector;
18+
_graphQLFunctions = graphQLFunctions;
1919
}
2020

2121
[FunctionName("graphql")]
2222
public async Task<IActionResult> Run(
2323
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
2424
ILogger log, CancellationToken cancellationToken)
2525
{
26-
var result = await _graphQLFunctions.ExecuteFunctionsQueryAsync(
26+
return await _graphQLFunctions.ExecuteFunctionsQueryAsync(
2727
req.HttpContext,
2828
cancellationToken);
29-
30-
return new OkObjectResult(result);
3129
}
3230
}
3331
}

src/HotChocolate.AzureFunctionsMiddleware/GraphQLFunctions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using HotChocolate.Language;
44
using HotChocolate.Server;
55
using Microsoft.AspNetCore.Http;
6+
using Microsoft.AspNetCore.Mvc;
67
using System.Threading;
78
using System.Threading.Tasks;
89

@@ -24,7 +25,7 @@ public GraphQLFunctions(IQueryExecutor executor, IDocumentCache documentCache,
2425
AzureFunctionsOptions = azureFunctionsOptions;
2526
}
2627

27-
public async Task<IExecutionResult> ExecuteFunctionsQueryAsync(
28+
public async Task<IActionResult> ExecuteFunctionsQueryAsync(
2829
HttpContext context,
2930
CancellationToken cancellationToken)
3031
{
@@ -58,7 +59,9 @@ public async Task<IExecutionResult> ExecuteFunctionsQueryAsync(
5859
}
5960
}
6061

61-
return await Executor.ExecuteAsync(builder.Create());
62+
var result = await Executor.ExecuteAsync(builder.Create());
63+
64+
return new OkObjectResult(result);
6265
}
6366
}
6467
}

src/HotChocolate.AzureFunctionsMiddleware/IGraphQLFunctions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using HotChocolate.Execution;
33
using HotChocolate.Language;
44
using Microsoft.AspNetCore.Http;
5+
using Microsoft.AspNetCore.Mvc;
56
using System.Threading;
67
using System.Threading.Tasks;
78

@@ -13,7 +14,7 @@ public interface IGraphQLFunctions
1314
IDocumentCache DocumentCache { get; }
1415
IDocumentHashProvider DocumentHashProvider { get; }
1516
IQueryExecutor Executor { get; }
16-
Task<IExecutionResult> ExecuteFunctionsQueryAsync(
17+
Task<IActionResult> ExecuteFunctionsQueryAsync(
1718
HttpContext context,
1819
CancellationToken cancellationToken);
1920
}

src/Startup.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public override void Configure(IFunctionsHostBuilder builder)
3030
.Create());
3131

3232
builder.Services.AddAzureFunctionsGraphQL();
33-
34-
builder.Services.AddSingleton<IDocumentHashProvider>(new MD5DocumentHashProvider());
3533
}
3634
}
3735
}

0 commit comments

Comments
 (0)