Clan info added

This commit is contained in:
Mikhail Shabanov committed 2020-03-06 17:33:40 +01:00
1 parent 1d13507aa7
commit 089c6329ee
7 files changed
+261 -1

No files matched your search

@@ -0,0 +1,10 @@
using HotChocolate.Types;
using WotBlitzStatisticsPro.WgApiClient.Model;
namespace WotBlitzStatistics.GraphQl.ObjectTypes
{
public class ClanInfoObjectType : ObjectType<ClanInfo>
{
}
}
@@ -10,7 +10,7 @@ namespace WotBlitzStatistics.GraphQl.ObjectTypes
protected override void Configure(IObjectTypeDescriptor<AccountInfo> descriptor)
{
descriptor.Field(a => a.Private).Ignore();
descriptor.Field("clanInfo")
descriptor.Field("accountClanInfo")
//.Argument("accountId", a => a.Type<NonNullType<LongType>>())
//.Type<ClanAccountInfo>()
.Resolver(c => c.Service<IWargamingApiClient>()
@@ -1,9 +1,19 @@
using HotChocolate.Types;
using WotBlitzStatisticsPro.WgApiClient;
using WotBlitzStatisticsPro.WgApiClient.Model;
namespace WotBlitzStatistics.GraphQl.ObjectTypes
{
public class PlayerClanInfoObjectType : ObjectType<ClanAccountInfo>
{
protected override void Configure(IObjectTypeDescriptor<ClanAccountInfo> descriptor)
{
// ToDo: Cache clan info!
// https://hotchocolate.io/docs/dataloaders
descriptor.Field("clanInfo")
.Resolver(c => c.Service<IWargamingApiClient>()
.GetClanInfo(c.Parent<ClanAccountInfo>().ClanId.Value));
}
}
}