initial commit
This commit is contained in:
12
Presentation/GraphQL/Types/KillNode.cs
Normal file
12
Presentation/GraphQL/Types/KillNode.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Domain.Entities;
|
||||
|
||||
namespace GraphQLTEST.GraphQL.Types;
|
||||
|
||||
public class KillNode : ObjectType<Kill>
|
||||
{
|
||||
protected override void Configure(IObjectTypeDescriptor<Kill> descriptor)
|
||||
{
|
||||
descriptor.Ignore(x => x.Id);
|
||||
descriptor.Ignore(x => x.UserId);
|
||||
}
|
||||
}
|
||||
26
Presentation/GraphQL/Types/UserNode.cs
Normal file
26
Presentation/GraphQL/Types/UserNode.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Security.Principal;
|
||||
using Application.Interfaces.Services;
|
||||
using Domain.Entities;
|
||||
using GraphQLTEST.GraphQL.DataLoaders;
|
||||
using GreenDonut.Data;
|
||||
using HotChocolate.Types.Pagination;
|
||||
|
||||
namespace GraphQLTEST.GraphQL.Types;
|
||||
|
||||
public class UserNode : ObjectType<User>
|
||||
{
|
||||
protected override void Configure(IObjectTypeDescriptor<User> descriptor)
|
||||
{
|
||||
descriptor.Ignore(x => x.Id);
|
||||
descriptor.Ignore(x => x.Password);
|
||||
descriptor.Field(x => x.Kills)
|
||||
.UsePaging()
|
||||
.UseFiltering()
|
||||
.ParentRequires<User>(x => nameof(x.Id))
|
||||
.Resolve(async (r, t) =>
|
||||
{
|
||||
User parent = r.Parent<User>();
|
||||
return await r.DataLoader<KillsByUserDataLoader>().LoadAsync(parent.Id, t);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user