diff --git a/src/Tgstation.Server.Host/GraphQL/Types/UserGroup.cs b/src/Tgstation.Server.Host/GraphQL/Types/UserGroup.cs
index 9dfb63459b..f97f4eefdb 100644
--- a/src/Tgstation.Server.Host/GraphQL/Types/UserGroup.cs
+++ b/src/Tgstation.Server.Host/GraphQL/Types/UserGroup.cs
@@ -1,8 +1,12 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using GreenDonut;
+using GreenDonut.Data;
+
using HotChocolate;
using HotChocolate.CostAnalysis.Types;
using HotChocolate.Data;
@@ -10,6 +14,8 @@ using HotChocolate.Types;
using HotChocolate.Types.Relay;
using Tgstation.Server.Host.Authority;
+using Tgstation.Server.Host.Authority.Core;
+using Tgstation.Server.Host.Extensions;
using Tgstation.Server.Host.GraphQL.Transformers;
namespace Tgstation.Server.Host.GraphQL.Types
@@ -25,21 +31,46 @@ namespace Tgstation.Server.Host.GraphQL.Types
///
public required PermissionSet PermissionSet { get; set; }
+ ///
+ /// Implements the .
+ ///
+ /// The of s to load paired with if the system user should be allowed.
+ /// The for the .
+ /// The for mapped to an .
+ /// The for the operation.
+ /// A resulting in a of the requested s.
+ [DataLoader(AccessModifier = DataLoaderAccessModifier.PublicInterface)]
+ public static ValueTask>> GetUserGroups(
+ IReadOnlyList ids,
+ IGraphQLAuthorityInvoker userAuthority,
+ QueryContext>? queryContext,
+ CancellationToken cancellationToken)
+ {
+ ArgumentNullException.ThrowIfNull(ids);
+ ArgumentNullException.ThrowIfNull(userAuthority);
+
+ return userAuthority.ExecuteDataLoader(
+ (authority, id) => authority.GetId(id, cancellationToken),
+ ids,
+ queryContext);
+ }
+
///
/// Node resolver for s.
///
/// The to lookup.
- /// The for the .
+ /// The to use.
+ /// The for the operation.
/// The for the operation.
/// A resulting in the queried , if present.
public static ValueTask GetUserGroup(
long id,
- [Service] IGraphQLAuthorityInvoker userGroupAuthority,
+ [Service] IUserGroupsDataLoader userGroupsDataLoader,
+ QueryContext? queryContext,
CancellationToken cancellationToken)
{
- ArgumentNullException.ThrowIfNull(userGroupAuthority);
- return userGroupAuthority.InvokeTransformableAllowMissing(
- authority => authority.GetId(id, false, cancellationToken));
+ ArgumentNullException.ThrowIfNull(userGroupsDataLoader);
+ return userGroupsDataLoader.LoadAuthorityResponse(queryContext, id, cancellationToken);
}
///
diff --git a/src/Tgstation.Server.Host/GraphQL/Types/UserGroupsRepository.cs b/src/Tgstation.Server.Host/GraphQL/Types/UserGroupsRepository.cs
index 9837ac5f2e..eae602f30c 100644
--- a/src/Tgstation.Server.Host/GraphQL/Types/UserGroupsRepository.cs
+++ b/src/Tgstation.Server.Host/GraphQL/Types/UserGroupsRepository.cs
@@ -43,14 +43,16 @@ namespace Tgstation.Server.Host.GraphQL.Types
/// Gets a by .
///
/// The of the .
- /// The for the .
+ /// The to use.
+ /// The for the operation.
/// The for the operation.
/// The represented by , if any.
public ValueTask ById(
[ID(nameof(UserGroup))] long id,
- [Service] IGraphQLAuthorityInvoker userGroupAuthority,
+ [Service] IUserGroupsDataLoader userGroupsDataLoader,
+ QueryContext? queryContext,
CancellationToken cancellationToken)
- => UserGroup.GetUserGroup(id, userGroupAuthority, cancellationToken);
+ => UserGroup.GetUserGroup(id, userGroupsDataLoader, queryContext, cancellationToken);
///
/// Queries all registered s.