diff --git a/src/Tgstation.Server.Host/GraphQL/Types/UserName.cs b/src/Tgstation.Server.Host/GraphQL/Types/UserName.cs
index 832aaa1798..016a1bb2f4 100644
--- a/src/Tgstation.Server.Host/GraphQL/Types/UserName.cs
+++ b/src/Tgstation.Server.Host/GraphQL/Types/UserName.cs
@@ -27,19 +27,14 @@ namespace Tgstation.Server.Host.GraphQL.Types
/// The for the operation.
/// A resulting in the queried , if present.
[TgsGraphQLAuthorize]
- public static async ValueTask GetUserName(
+ public static ValueTask GetUserName(
long id,
[Service] IGraphQLAuthorityInvoker userAuthority,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(userAuthority);
- var user = await userAuthority.InvokeTransformable(
+ return userAuthority.InvokeTransformableAllowMissing(
authority => authority.GetId(id, false, true, cancellationToken));
-
- if (user == null)
- return null;
-
- return new UserName(user);
}
///
@@ -51,5 +46,12 @@ namespace Tgstation.Server.Host.GraphQL.Types
: base(copy)
{
}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UserName()
+ {
+ }
}
}
diff --git a/src/Tgstation.Server.Host/Models/Transformers/UserNameGraphQLTransformer.cs b/src/Tgstation.Server.Host/Models/Transformers/UserNameGraphQLTransformer.cs
new file mode 100644
index 0000000000..ebe6338895
--- /dev/null
+++ b/src/Tgstation.Server.Host/Models/Transformers/UserNameGraphQLTransformer.cs
@@ -0,0 +1,20 @@
+namespace Tgstation.Server.Host.Models.Transformers
+{
+ ///
+ /// for s.
+ ///
+ sealed class UserNameGraphQLTransformer : TransformerBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UserNameGraphQLTransformer()
+ : base(model => new GraphQL.Types.UserName
+ {
+ Id = model.Id!.Value,
+ Name = model.Name!,
+ })
+ {
+ }
+ }
+}
diff --git a/src/Tgstation.Server.Host/Models/User.cs b/src/Tgstation.Server.Host/Models/User.cs
index 46c5530da1..c573368deb 100644
--- a/src/Tgstation.Server.Host/Models/User.cs
+++ b/src/Tgstation.Server.Host/Models/User.cs
@@ -12,7 +12,8 @@ namespace Tgstation.Server.Host.Models
///
public sealed class User : Api.Models.Internal.UserModelBase,
ILegacyApiTransformable,
- IApiTransformable
+ IApiTransformable,
+ IApiTransformable
{
///
/// Username used when creating jobs automatically.