Replaces ErrorOr library with a custom implementation.

This commit is contained in:
BinaryAlley committed 2026-08-14 03:04:28 -07:00
1 parent 8fe90a4dde
commit 3b772d68ca
436 files changed
+4234 -3922

No files matched your search

@@ -1,17 +1,18 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectories;
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directories.GetDirectories;
@@ -21,13 +22,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directorie
/// </summary>
public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResult>
{
private readonly IQueryHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<DirectoryResponse>>> _getDirectoriesQueryHandler;
private readonly IQueryHandler<GetDirectoriesQuery, Result<IEnumerable<DirectoryResponse>>> _getDirectoriesQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesEndpoint"/> class.
/// </summary>
/// <param name="getDirectoriesQueryHandler">Injected service for handling get directories queries.</param>
public GetDirectoriesEndpoint(IQueryHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<DirectoryResponse>>> getDirectoriesQueryHandler)
public GetDirectoriesEndpoint(IQueryHandler<GetDirectoriesQuery, Result<IEnumerable<DirectoryResponse>>> getDirectoriesQueryHandler)
{
_getDirectoriesQueryHandler = getDirectoriesQueryHandler;
}
@@ -37,7 +38,7 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Directories.GET_DIRECTORIES);
Version(1);
DontCatchExceptions();
@@ -50,7 +51,7 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetDirectoriesRequest request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<DirectoryResponse>> result = await _getDirectoriesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<DirectoryResponse>> result = await _getDirectoriesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,9 +1,9 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Core.FileSystemManagement.Drives.Queries.GetDrives;
using Lumina.Contracts.Responses.FileSystemManagement.Common;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Drives.Get
/// </summary>
public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IQueryHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> _getDrivesQueryHandler;
private readonly IQueryHandler<GetDrivesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> _getDrivesQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetDrivesEndpoint"/> class.
/// </summary>
/// <param name="getDrivesQueryHandler">Injected service for handling get drives queries.</param>
public GetDrivesEndpoint(IQueryHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> getDrivesQueryHandler)
public GetDrivesEndpoint(IQueryHandler<GetDrivesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> getDrivesQueryHandler)
{
_getDrivesQueryHandler = getDrivesQueryHandler;
}
@@ -35,7 +35,7 @@ public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Drives.GET_DRIVES);
Version(1);
DontCatchExceptions();
@@ -47,7 +47,7 @@ public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest _, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _getDrivesQueryHandler.HandleAsync(new GetDrivesQuery(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<FileSystemTreeNodeResponse>> result = await _getDrivesQueryHandler.HandleAsync(new GetDrivesQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,15 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
using Lumina.Application.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
using Lumina.Contracts.Requests.FileSystemManagement.Files;
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -37,7 +33,7 @@ public class GetTypeEndpoint : BaseEndpoint<EmptyRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.FileSystem.GET_TYPES);
Version(1);
DontCatchExceptions();
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
using Lumina.Contracts.Requests.FileSystemManagement.Files;
using Lumina.Contracts.Responses.FileSystemManagement.Files;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetF
/// </summary>
public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
{
private readonly IQueryHandler<GetFilesQuery, ErrorOr<IEnumerable<FileResponse>>> _getFilesQueryHandler;
private readonly IQueryHandler<GetFilesQuery, Result<IEnumerable<FileResponse>>> _getFilesQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesEndpoint"/> class.
/// </summary>
/// <param name="getFilesQueryHandler">Injected service for handling get files queries.</param>
public GetFilesEndpoint(IQueryHandler<GetFilesQuery, ErrorOr<IEnumerable<FileResponse>>> getFilesQueryHandler)
public GetFilesEndpoint(IQueryHandler<GetFilesQuery, Result<IEnumerable<FileResponse>>> getFilesQueryHandler)
{
_getFilesQueryHandler = getFilesQueryHandler;
}
@@ -36,7 +37,7 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Files.GET_FILES);
Version(1);
DontCatchExceptions();
@@ -49,7 +50,7 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetFilesRequest request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<FileResponse>> result = await _getFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<FileResponse>> result = await _getFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
using Lumina.Contracts.Requests.FileSystemManagement.Files;
using Lumina.Contracts.Responses.FileSystemManagement.Common;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetT
/// </summary>
public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
{
private readonly IQueryHandler<GetTreeFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> _getTreeFilesQueryHandler;
private readonly IQueryHandler<GetTreeFilesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> _getTreeFilesQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesEndpoint"/> class.
/// </summary>
/// <param name="getTreeFilesQueryHandler">Injected service for handling get tree files queries.</param>
public GetTreeFilesEndpoint(IQueryHandler<GetTreeFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> getTreeFilesQueryHandler)
public GetTreeFilesEndpoint(IQueryHandler<GetTreeFilesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> getTreeFilesQueryHandler)
{
_getTreeFilesQueryHandler = getTreeFilesQueryHandler;
}
@@ -36,7 +37,7 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Files.GET_TREE_FILES);
Version(1);
DontCatchExceptions();
@@ -49,7 +50,7 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetTreeFilesRequest request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _getTreeFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<FileSystemTreeNodeResponse>> result = await _getTreeFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Check
/// </summary>
public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IResult>
{
private readonly IQueryHandler<CheckPathExistsQuery, ErrorOr<PathExistsResponse>> _checkPathExistsQueryHandler;
private readonly IQueryHandler<CheckPathExistsQuery, Result<PathExistsResponse>> _checkPathExistsQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsEndpoint"/> class.
/// </summary>
/// <param name="checkPathExistsQueryHandler">Injected service for handling check path exists queries.</param>
public CheckPathExistsEndpoint(IQueryHandler<CheckPathExistsQuery, ErrorOr<PathExistsResponse>> checkPathExistsQueryHandler)
public CheckPathExistsEndpoint(IQueryHandler<CheckPathExistsQuery, Result<PathExistsResponse>> checkPathExistsQueryHandler)
{
_checkPathExistsQueryHandler = checkPathExistsQueryHandler;
}
@@ -35,7 +36,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Path.CHECK_PATH_EXISTS);
Version(1);
DontCatchExceptions();
@@ -48,7 +49,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(CheckPathExistsRequest request, CancellationToken cancellationToken)
{
ErrorOr<PathExistsResponse> result = await _checkPathExistsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<PathExistsResponse> result = await _checkPathExistsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,10 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Combi
/// </summary>
public class CombinePathEndpoint : BaseEndpoint<CombinePathRequest, IResult>
{
private readonly ICommandHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>> _combinePathCommandHandler;
private readonly ICommandHandler<CombinePathCommand, Result<PathSegmentResponse>> _combinePathCommandHandler;
/// <summary>
/// Initializes a new instance of the <see cref="CombinePathEndpoint"/> class.
/// </summary>
/// <param name="combinePathCommandHandler">Injected service for handling combine path commands.</param>
public CombinePathEndpoint(ICommandHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>> combinePathCommandHandler)
public CombinePathEndpoint(ICommandHandler<CombinePathCommand, Result<PathSegmentResponse>> combinePathCommandHandler)
{
_combinePathCommandHandler = combinePathCommandHandler;
}
@@ -48,7 +48,7 @@ public class CombinePathEndpoint : BaseEndpoint<CombinePathRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(CombinePathRequest request, CancellationToken cancellationToken)
{
ErrorOr<PathSegmentResponse> result = await _combinePathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
Result<PathSegmentResponse> result = await _combinePathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPa
/// </summary>
public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
{
private readonly IQueryHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>> _getPathParentQueryHandler;
private readonly IQueryHandler<GetPathParentQuery, Result<IEnumerable<PathSegmentResponse>>> _getPathParentQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetPathParentEndpoint"/> class.
/// </summary>
/// <param name="getPathParentQueryHandler">Injected service for handling get path parent queries.</param>
public GetPathParentEndpoint(IQueryHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>> getPathParentQueryHandler)
public GetPathParentEndpoint(IQueryHandler<GetPathParentQuery, Result<IEnumerable<PathSegmentResponse>>> getPathParentQueryHandler)
{
_getPathParentQueryHandler = getPathParentQueryHandler;
}
@@ -36,7 +37,7 @@ public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Path.GET_PATH_PARENT);
Version(1);
DontCatchExceptions();
@@ -49,7 +50,7 @@ public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetPathParentRequest request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _getPathParentQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<PathSegmentResponse>> result = await _getPathParentQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPa
/// </summary>
public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
{
private readonly IQueryHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>> _getPathRootQueryHandler;
private readonly IQueryHandler<GetPathRootQuery, Result<PathSegmentResponse>> _getPathRootQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootEndpoint"/> class.
/// </summary>
/// <param name="getPathRootQueryHandler">Injected service for handling get path root queries.</param>
public GetPathRootEndpoint(IQueryHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>> getPathRootQueryHandler)
public GetPathRootEndpoint(IQueryHandler<GetPathRootQuery, Result<PathSegmentResponse>> getPathRootQueryHandler)
{
_getPathRootQueryHandler = getPathRootQueryHandler;
}
@@ -35,7 +36,7 @@ public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Path.GET_PATH_ROOT);
Version(1);
DontCatchExceptions();
@@ -48,7 +49,7 @@ public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetPathRootRequest request, CancellationToken cancellationToken)
{
ErrorOr<PathSegmentResponse> result = await _getPathRootQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<PathSegmentResponse> result = await _getPathRootQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Domain.Common.Primitives;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
@@ -20,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Split
/// </summary>
public class SplitPathEndpoint : BaseEndpoint<SplitPathRequest, IResult>
{
private readonly ICommandHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>> _splitPathCommandHandler;
private readonly ICommandHandler<SplitPathCommand, Result<IEnumerable<PathSegmentResponse>>> _splitPathCommandHandler;
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathEndpoint"/> class.
/// </summary>
/// <param name="splitPathCommandHandler">Injected service for handling split path commands.</param>
public SplitPathEndpoint(ICommandHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>> splitPathCommandHandler)
public SplitPathEndpoint(ICommandHandler<SplitPathCommand, Result<IEnumerable<PathSegmentResponse>>> splitPathCommandHandler)
{
_splitPathCommandHandler = splitPathCommandHandler;
}
@@ -49,7 +49,7 @@ public class SplitPathEndpoint : BaseEndpoint<SplitPathRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(SplitPathRequest request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _splitPathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
Result<IEnumerable<PathSegmentResponse>> result = await _splitPathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,10 +1,11 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Valid
/// </summary>
public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
{
private readonly IQueryHandler<ValidatePathQuery, ErrorOr<PathValidResponse>> _validatePathQueryHandler;
private readonly IQueryHandler<ValidatePathQuery, Result<PathValidResponse>> _validatePathQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="ValidatePathEndpoint"/> class.
/// </summary>
/// <param name="validatePathQueryHandler">Injected service for handling validate path queries.</param>
public ValidatePathEndpoint(IQueryHandler<ValidatePathQuery, ErrorOr<PathValidResponse>> validatePathQueryHandler)
public ValidatePathEndpoint(IQueryHandler<ValidatePathQuery, Result<PathValidResponse>> validatePathQueryHandler)
{
_validatePathQueryHandler = validatePathQueryHandler;
}
@@ -35,7 +36,7 @@ public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Path.VALIDATE);
Version(1);
DontCatchExceptions();
@@ -48,7 +49,7 @@ public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(ValidatePathRequest request, CancellationToken cancellationToken)
{
ErrorOr<PathValidResponse> result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<PathValidResponse> result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -1,11 +1,12 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
using Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
using Lumina.Domain.Common.Primitives;
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
using Lumina.Presentation.Api.Common.Utilities;
using Lumina.Presentation.Api.Core.Endpoints.Common;
@@ -21,13 +22,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Thumbnails
/// </summary>
public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
{
private readonly IQueryHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>> _getThumbnailQueryHandler;
private readonly IQueryHandler<GetThumbnailQuery, Result<ThumbnailResponse>> _getThumbnailQueryHandler;
/// <summary>
/// Initializes a new instance of the <see cref="GetThumbnailEndpoint"/> class.
/// </summary>
/// <param name="getThumbnailQueryHandler">Injected service for handling get thumbnail queries.</param>
public GetThumbnailEndpoint(IQueryHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>> getThumbnailQueryHandler)
public GetThumbnailEndpoint(IQueryHandler<GetThumbnailQuery, Result<ThumbnailResponse>> getThumbnailQueryHandler)
{
_getThumbnailQueryHandler = getThumbnailQueryHandler;
}
@@ -37,7 +38,7 @@ public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
/// </summary>
public override void Configure()
{
Verbs(FastEndpoints.Http.GET);
Verbs(Http.GET);
Routes(ApiRoutes.Thumbnails.GET_THUMBNAIL);
Version(1);
DontCatchExceptions();
@@ -50,7 +51,7 @@ public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetThumbnailRequest request, CancellationToken cancellationToken)
{
ErrorOr<ThumbnailResponse> result = await _getThumbnailQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
Result<ThumbnailResponse> result = await _getThumbnailQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.File(success.Bytes, MimeTypes.GetMimeType(success.Type)), Problem);
}
}