Agent Tests for API, MAUI, and Slop Features
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using API.GraphQL.Types;
|
||||
using Model.Entity.Data;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services
|
||||
.AddGraphQLServer()
|
||||
.AddQueryType(d =>
|
||||
{
|
||||
d.Name("Query");
|
||||
|
||||
d.Field("entities")
|
||||
.Type<NonNullType<ListType<NonNullType<EntityGraphType>>>>()
|
||||
.Resolve(ctx => EntityData.Get().Values.ToList());
|
||||
|
||||
d.Field("entity")
|
||||
.Type<EntityGraphType>()
|
||||
.Argument("id", a => a.Type<NonNullType<StringType>>())
|
||||
.Resolve(ctx =>
|
||||
{
|
||||
var id = ctx.ArgumentValue<string>("id");
|
||||
EntityData.Get().TryGetValue(id, out var entity);
|
||||
return entity;
|
||||
});
|
||||
})
|
||||
.AddType<EntityGraphType>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGraphQL();
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user