diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/UserResolver.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/UserResolver.cs index 584f3735..1b50971d 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/UserResolver.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/UserResolver.cs @@ -6,9 +6,9 @@ using Iceshrimp.Backend.Core.Database.Tables; using Iceshrimp.Backend.Core.Extensions; using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; using Iceshrimp.Backend.Core.Federation.WebFinger; -using Iceshrimp.Backend.Core.Helpers; using Iceshrimp.Backend.Core.Middleware; using Iceshrimp.Backend.Core.Services; +using Iceshrimp.Utils.Common; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; diff --git a/Iceshrimp.Backend/Core/Helpers/Result.cs b/Iceshrimp.Backend/Core/Helpers/Result.cs deleted file mode 100644 index 6c34e7f0..00000000 --- a/Iceshrimp.Backend/Core/Helpers/Result.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Diagnostics.CodeAnalysis; - -namespace Iceshrimp.Backend.Core.Helpers; - -public abstract record Result - where TResult : class - where TError : class -{ - private Result() { } - - public sealed record Success(TResult Result) : Result; - - public sealed record Failure(TError Error) : Result; - - public static implicit operator Result(TResult result) => new Success(result); - public static implicit operator Result(TError error) => new Failure(error); - - public bool TryGetResult([NotNullWhen(true)] out TResult? result) - { - if (this is Success s) - { - result = s.Result; - return true; - } - - result = null; - return false; - } - - public bool TryGetError([NotNullWhen(true)] out TError? error) - { - if (this is Failure f) - { - error = f.Error; - return true; - } - - error = null; - return false; - } - - public bool IsSuccess => this is Success; - public bool IsFailure => this is Failure; -} - -public abstract record Result where TResult : class -{ - private Result() { } - - public sealed record Success(TResult Result) : Result; - - public sealed record Failure(Exception Error) : Result; - - public static implicit operator Result(TResult result) => new Success(result); - public static implicit operator Result(Exception error) => new Failure(error); - - public bool TryGetResult([NotNullWhen(true)] out TResult? result) - { - if (this is Success s) - { - result = s.Result; - return true; - } - - result = null; - return false; - } - - public bool TryGetError([NotNullWhen(true)] out Exception? error) - { - if (this is Failure f) - { - error = f.Error; - return true; - } - - error = null; - return false; - } - - public bool IsSuccess => this is Success; - public bool IsFailure => this is Failure; -} \ No newline at end of file diff --git a/Iceshrimp.Backend/Iceshrimp.Backend.csproj b/Iceshrimp.Backend/Iceshrimp.Backend.csproj index bb1565a8..76d8602a 100644 --- a/Iceshrimp.Backend/Iceshrimp.Backend.csproj +++ b/Iceshrimp.Backend/Iceshrimp.Backend.csproj @@ -54,6 +54,7 @@ +