basic query and mutation discovery, next dynamic queries get added through extensions :)

This commit is contained in:
David Lebee
2021-02-03 19:51:23 -05:00
parent bd1b948a19
commit afb8b534bb
14 changed files with 258 additions and 10 deletions
+2
View File
@@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="9.5.0" />
<PackageReference Include="HotChocolate.AspNetCore" Version="11.0.9" />
<PackageReference Include="PoweredSoft.Data" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.6.3" />
@@ -17,6 +18,7 @@
<ProjectReference Include="..\PoweredSoft.CQRS.DynamicQuery.Abstractions\PoweredSoft.CQRS.DynamicQuery.Abstractions.csproj" />
<ProjectReference Include="..\PoweredSoft.CQRS.DynamicQuery.AspNetCore\PoweredSoft.CQRS.DynamicQuery.AspNetCore.csproj" />
<ProjectReference Include="..\PoweredSoft.CQRS.DynamicQuery\PoweredSoft.CQRS.DynamicQuery.csproj" />
<ProjectReference Include="..\PoweredSoft.CQRS.GraphQL.HotChocolate\PoweredSoft.CQRS.GraphQL.HotChocolate.csproj" />
<ProjectReference Include="..\PoweredSoft.CQRS\PoweredSoft.CQRS.csproj" />
</ItemGroup>
+18 -7
View File
@@ -4,6 +4,7 @@ using Demo.DynamicQueries;
using Demo.Queries;
using FluentValidation;
using FluentValidation.AspNetCore;
using HotChocolate.Types;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
@@ -18,6 +19,7 @@ using PoweredSoft.CQRS.AspNetCore.Mvc;
using PoweredSoft.CQRS.DynamicQuery;
using PoweredSoft.CQRS.DynamicQuery.Abstractions;
using PoweredSoft.CQRS.DynamicQuery.AspNetCore;
using PoweredSoft.CQRS.GraphQL.HotChocolate;
using PoweredSoft.Data;
using PoweredSoft.Data.Core;
using PoweredSoft.DynamicQuery;
@@ -27,7 +29,7 @@ using System.Linq;
using System.Threading.Tasks;
namespace Demo
{
{
public class Startup
{
public Startup(IConfiguration configuration)
@@ -56,7 +58,15 @@ namespace Demo
.AddPoweredSoftDynamicQueries()
.AddFluentValidation();
services.AddSwaggerGen();
services
.AddGraphQLServer()
.AddQueryType(d => d.Name("Query"))
.AddPoweredSoftQueries()
.AddMutationType(d => d.Name("Mutation"))
.AddPoweredSoftMutations();
//services.AddSwaggerGen();
}
private void AddDynamicQueries(IServiceCollection services)
@@ -100,18 +110,19 @@ namespace Demo
app.UseAuthorization();
app.UseSwagger();
//app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
//app.UseSwaggerUI(c =>
//{
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
//});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapGraphQL();
});
}
}