Replaces FluentValidation and Mediator command/queries handling with custom implementations.

This commit is contained in:
BinaryAlley committed 2026-08-13 08:53:06 -07:00
1 parent 9a5c7473f9
commit 2d1c6b1ab8
297 files changed
+3619 -3045

No files matched your search

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