Some Data loader stuff

This commit is contained in:
Mikhail Shabanov committed 2020-03-19 22:00:47 +01:00
1 parent d643c323b3
commit 83628d21bd
5 files changed
+61 -14

No files matched your search

@@ -0,0 +1,20 @@
using System.Threading;
using System.Threading.Tasks;
using HotChocolate;
using WotBlitzStatistics.GraphQl.DataLoaders;
using WotBlitzStatisticsPro.WgApiClient;
using WotBlitzStatisticsPro.WgApiClient.Model;
namespace WotBlitzStatistics.GraphQl.Resolvers
{
[GraphQLResolverOf(typeof(ClanInfo))]
public class ClanInfoResolver
{
public async Task<ClanInfo> GetClanInfo(
[Parent] ClanAccountInfo clanAccountInfo,
[DataLoader] ClanDataLoader clanDataLoader)
{
return (await clanDataLoader.LoadAsync(new[] {clanAccountInfo.ClanId.Value}, CancellationToken.None))[0];
}
}
}