mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Replaces FluentValidation and Mediator command/queries handling with custom implementations.
This commit is contained in:
1 parent
9a5c7473f9
commit
2d1c6b1ab8
297 files changed
+3619
-3045
No files matched your search
+7
-8
@@ -1,12 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Admin.Authorization.Permissions.Queries.GetPermissions;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRoles;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@@ -20,15 +19,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Permissions
|
||||
/// </summary>
|
||||
public class GetPermissionsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> _getPermissionsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetPermissionsEndpoint(ISender sender)
|
||||
/// <param name="getPermissionsQueryHandler">Injected service for handling get permissions queries.</param>
|
||||
public GetPermissionsEndpoint(IQueryHandler<GetPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> getPermissionsQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getPermissionsQueryHandler = getPermissionsQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +35,7 @@ public class GetPermissionsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Permissions.GET_PERMISSIONS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +47,7 @@ public class GetPermissionsEndpoint : 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<PermissionResponse>> result = await _sender.Send(new GetPermissionsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<PermissionResponse>> result = await _getPermissionsQueryHandler.HandleAsync(new GetPermissionsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.DeleteRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.Admin.Authorization.Roles.Delet
|
||||
/// </summary>
|
||||
public class DeleteRoleEndpoint : BaseEndpoint<DeleteRoleRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<DeleteRoleCommand, ErrorOr<Deleted>> _deleteRoleCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeleteRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public DeleteRoleEndpoint(ISender sender)
|
||||
/// <param name="deleteRoleCommandHandler">Injected service for handling delete role commands.</param>
|
||||
public DeleteRoleEndpoint(ICommandHandler<DeleteRoleCommand, ErrorOr<Deleted>> deleteRoleCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_deleteRoleCommandHandler = deleteRoleCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class DeleteRoleEndpoint : BaseEndpoint<DeleteRoleRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.DELETE);
|
||||
Verbs(FastEndpoints.Http.DELETE);
|
||||
Routes(ApiRoutes.Roles.DELETE_ROLE);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class DeleteRoleEndpoint : BaseEndpoint<DeleteRoleRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(DeleteRoleRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Deleted> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Deleted> result = await _deleteRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRoles;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.Admin.Authorization.Roles.GetRo
|
||||
/// </summary>
|
||||
public class GetRolesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetRolesQuery, ErrorOr<IEnumerable<RoleResponse>>> _getRolesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetRolesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetRolesEndpoint(ISender sender)
|
||||
/// <param name="getRolesQueryHandler">Injected service for handling get roles queries.</param>
|
||||
public GetRolesEndpoint(IQueryHandler<GetRolesQuery, ErrorOr<IEnumerable<RoleResponse>>> getRolesQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getRolesQueryHandler = getRolesQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetRolesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Roles.GET_ROLES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class GetRolesEndpoint : 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<RoleResponse>> result = await _sender.Send(new GetRolesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<RoleResponse>> result = await _getRolesQueryHandler.HandleAsync(new GetRolesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.UpdateRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.Admin.Authorization.Roles.Updat
|
||||
/// </summary>
|
||||
public class UpdateRoleEndpoint : BaseEndpoint<UpdateRoleRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<UpdateRoleCommand, ErrorOr<RolePermissionsResponse>> _updateRoleCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public UpdateRoleEndpoint(ISender sender)
|
||||
/// <param name="updateRoleCommandHandler">Injected service for handling update role commands.</param>
|
||||
public UpdateRoleEndpoint(ICommandHandler<UpdateRoleCommand, ErrorOr<RolePermissionsResponse>> updateRoleCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_updateRoleCommandHandler = updateRoleCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class UpdateRoleEndpoint : BaseEndpoint<UpdateRoleRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Roles.UPDATE_ROLE);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class UpdateRoleEndpoint : BaseEndpoint<UpdateRoleRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateRoleRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RolePermissionsResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<RolePermissionsResponse> result = await _updateRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.AddLibrary;
|
||||
/// </summary>
|
||||
public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<AddLibraryCommand, ErrorOr<LibraryResponse>> _addLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public AddLibraryEndpoint(ISender sender)
|
||||
/// <param name="addLibraryCommandHandler">Injected service for handling add library commands.</param>
|
||||
public AddLibraryEndpoint(ICommandHandler<AddLibraryCommand, ErrorOr<LibraryResponse>> addLibraryCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_addLibraryCommandHandler = addLibraryCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Libraries.ADD_LIBRARY);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse> result = await _addLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{ApiRoutes.Libraries.ADD_LIBRARY}/{result.Value.Id}", result.Value), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibrariesScan;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -17,15 +17,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.CancelLibrar
|
||||
/// </summary>
|
||||
public class CancelLibrariesScanEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, ErrorOr<Success>> _cancelLibrariesScanCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CancelLibrariesScanEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public CancelLibrariesScanEndpoint(ISender sender)
|
||||
/// <param name="cancelLibrariesScanCommandHandler">Injected service for handling cancel libraries scan commands.</param>
|
||||
public CancelLibrariesScanEndpoint(Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, ErrorOr<Success>> cancelLibrariesScanCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_cancelLibrariesScanCommandHandler = cancelLibrariesScanCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ public class CancelLibrariesScanEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Libraries.CANCEL_LIBRARIES_SCAN);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -45,7 +45,7 @@ public class CancelLibrariesScanEndpoint : 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<Success> result = await _sender.Send(new CancelLibrariesScanCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Success> result = await _cancelLibrariesScanCommandHandler.HandleAsync(new CancelLibrariesScanCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -1,13 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibrariesScan;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -20,15 +19,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.CancelLibrar
|
||||
/// </summary>
|
||||
public class CancelLibraryScanEndpoint : BaseEndpoint<CancelLibraryScanRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<CancelLibraryScanCommand, ErrorOr<Success>> _cancelLibraryScanCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CancelLibraryScanEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public CancelLibraryScanEndpoint(ISender sender)
|
||||
/// <param name="cancelLibraryScanCommandHandler">Injected service for handling cancel library scan commands.</param>
|
||||
public CancelLibraryScanEndpoint(ICommandHandler<CancelLibraryScanCommand, ErrorOr<Success>> cancelLibraryScanCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_cancelLibraryScanCommandHandler = cancelLibraryScanCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +35,7 @@ public class CancelLibraryScanEndpoint : BaseEndpoint<CancelLibraryScanRequest,
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Libraries.CANCEL_LIBRARY_SCAN);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +47,7 @@ public class CancelLibraryScanEndpoint : BaseEndpoint<CancelLibraryScanRequest,
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CancelLibraryScanRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Success> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Success> result = await _cancelLibraryScanCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -18,15 +18,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.DeleteLibrar
|
||||
/// </summary>
|
||||
public class DeleteLibraryEndpoint : BaseEndpoint<DeleteLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<DeleteLibraryCommand, ErrorOr<Deleted>> _deleteLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeleteLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public DeleteLibraryEndpoint(ISender sender)
|
||||
/// <param name="deleteLibraryCommandHandler">Injected service for handling delete library commands.</param>
|
||||
public DeleteLibraryEndpoint(ICommandHandler<DeleteLibraryCommand, ErrorOr<Deleted>> deleteLibraryCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_deleteLibraryCommandHandler = deleteLibraryCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class DeleteLibraryEndpoint : BaseEndpoint<DeleteLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.DELETE);
|
||||
Verbs(FastEndpoints.Http.DELETE);
|
||||
Routes(ApiRoutes.Libraries.DELETE_LIBRARY);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class DeleteLibraryEndpoint : BaseEndpoint<DeleteLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(DeleteLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Deleted> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Deleted> result = await _deleteLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Queries.GetEnabledLibraries;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.GetEnabledLi
|
||||
/// </summary>
|
||||
public class GetEnabledLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetEnabledLibrariesQuery, ErrorOr<LibraryResponse[]>> _getEnabledLibrariesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetEnabledLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetEnabledLibrariesEndpoint(ISender sender)
|
||||
/// <param name="getEnabledLibrariesQueryHandler">Injected service for handling get enabled libraries queries.</param>
|
||||
public GetEnabledLibrariesEndpoint(IQueryHandler<GetEnabledLibrariesQuery, ErrorOr<LibraryResponse[]>> getEnabledLibrariesQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getEnabledLibrariesQueryHandler = getEnabledLibrariesQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class GetEnabledLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_ENABLED_LIBRARIES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -46,7 +46,7 @@ public class GetEnabledLibrariesEndpoint : 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<LibraryResponse[]> result = await _sender.Send(new GetEnabledLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse[]> result = await _getEnabledLibrariesQueryHandler.HandleAsync(new GetEnabledLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraries;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.GetLibraries
|
||||
/// </summary>
|
||||
public class GetLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetLibrariesQuery, ErrorOr<LibraryResponse[]>> _getLibrariesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetLibrariesEndpoint(ISender sender)
|
||||
/// <param name="getLibrariesQueryHandler">Injected service for handling get libraries queries.</param>
|
||||
public GetLibrariesEndpoint(IQueryHandler<GetLibrariesQuery, ErrorOr<LibraryResponse[]>> getLibrariesQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getLibrariesQueryHandler = getLibrariesQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class GetLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_LIBRARIES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -46,7 +46,7 @@ public class GetLibrariesEndpoint : 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<LibraryResponse[]> result = await _sender.Send(new GetLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse[]> result = await _getLibrariesQueryHandler.HandleAsync(new GetLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.GetLibrary;
|
||||
/// </summary>
|
||||
public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetLibraryQuery, ErrorOr<LibraryResponse>> _getLibraryQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetLibraryEndpoint(ISender sender)
|
||||
/// <param name="getLibraryQueryHandler">Injected service for handling get library queries.</param>
|
||||
public GetLibraryEndpoint(IQueryHandler<GetLibraryQuery, ErrorOr<LibraryResponse>> getLibraryQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getLibraryQueryHandler = getLibraryQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_LIBRARY_BY_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse> result = await _getLibraryQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.GetLibrarySc
|
||||
/// </summary>
|
||||
public class GetLibraryScanProgressEndpoint : BaseEndpoint<GetLibraryScanProgressRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetLibraryScanProgressQuery, ErrorOr<MediaLibraryScanProgressResponse>> _getLibraryScanProgressQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryScanProgressEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetLibraryScanProgressEndpoint(ISender sender)
|
||||
/// <param name="getLibraryScanProgressQueryHandler">Injected service for handling get library scan progress queries.</param>
|
||||
public GetLibraryScanProgressEndpoint(IQueryHandler<GetLibraryScanProgressQuery, ErrorOr<MediaLibraryScanProgressResponse>> getLibraryScanProgressQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getLibraryScanProgressQueryHandler = getLibraryScanProgressQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetLibraryScanProgressEndpoint : BaseEndpoint<GetLibraryScanProgres
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.LIBRARY_SCAN_PROGRESS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class GetLibraryScanProgressEndpoint : BaseEndpoint<GetLibraryScanProgres
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetLibraryScanProgressRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<MediaLibraryScanProgressResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<MediaLibraryScanProgressResponse> result = await _getLibraryScanProgressQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Queries.GetRunningLibraryScans;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.GetRunningLi
|
||||
/// </summary>
|
||||
public class GetRunningLibraryScansEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetRunningLibraryScansQuery, ErrorOr<IEnumerable<MediaLibraryScanProgressResponse>>> _getRunningLibraryScansQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetRunningLibraryScansEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetRunningLibraryScansEndpoint(ISender sender)
|
||||
/// <param name="getRunningLibraryScansQueryHandler">Injected service for handling get running library scans queries.</param>
|
||||
public GetRunningLibraryScansEndpoint(IQueryHandler<GetRunningLibraryScansQuery, ErrorOr<IEnumerable<MediaLibraryScanProgressResponse>>> getRunningLibraryScansQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getRunningLibraryScansQueryHandler = getRunningLibraryScansQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ public class GetRunningLibraryScansEndpoint : BaseEndpoint<EmptyRequest, IResult
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_RUNNING_LIBRARIES_SCAN);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class GetRunningLibraryScansEndpoint : 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<MediaLibraryScanProgressResponse>> result = await _sender.Send(new GetRunningLibraryScansQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<MediaLibraryScanProgressResponse>> result = await _getRunningLibraryScansQueryHandler.HandleAsync(new GetRunningLibraryScansQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+9
-10
@@ -1,11 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.ScanLibraries;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@@ -17,17 +16,17 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.ScanLibrarie
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/libraries/scans</c> route.
|
||||
/// </summary>
|
||||
public class ScanLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
public class ScanLibrariesEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<ScanLibrariesCommand, ErrorOr<IEnumerable<MediaLibraryScanResponse>>> _scanLibrariesCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScanLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public ScanLibrariesEndpoint(ISender sender)
|
||||
/// <param name="scanLibrariesCommandHandler">Injected service for handling scan libraries commands.</param>
|
||||
public ScanLibrariesEndpoint(ICommandHandler<ScanLibrariesCommand, ErrorOr<IEnumerable<MediaLibraryScanResponse>>> scanLibrariesCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_scanLibrariesCommandHandler = scanLibrariesCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +34,7 @@ public class ScanLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Libraries.SCAN_LIBRARIES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -45,9 +44,9 @@ public class ScanLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// Initiates a scan of all media libraries.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(EmptyRequest _, CancellationToken cancellationToken)
|
||||
public override async Task<IResult> ExecuteAsync(FastEndpoints.EmptyRequest _, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<MediaLibraryScanResponse>> result = await _sender.Send(new ScanLibrariesCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<MediaLibraryScanResponse>> result = await _scanLibrariesCommandHandler.HandleAsync(new ScanLibrariesCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.ScanLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.ScanLibrary;
|
||||
/// </summary>
|
||||
public class ScanLibraryEndpoint : BaseEndpoint<ScanLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<ScanLibraryCommand, ErrorOr<MediaLibraryScanResponse>> _scanLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScanLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public ScanLibraryEndpoint(ISender sender)
|
||||
/// <param name="scanLibraryCommandHandler">Injected service for handling scan library commands.</param>
|
||||
public ScanLibraryEndpoint(ICommandHandler<ScanLibraryCommand, ErrorOr<MediaLibraryScanResponse>> scanLibraryCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_scanLibraryCommandHandler = scanLibraryCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class ScanLibraryEndpoint : BaseEndpoint<ScanLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Libraries.SCAN_LIBRARY);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class ScanLibraryEndpoint : BaseEndpoint<ScanLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(ScanLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<MediaLibraryScanResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<MediaLibraryScanResponse> result = await _scanLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Library.Management.UpdateLibrar
|
||||
/// </summary>
|
||||
public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<UpdateLibraryCommand, ErrorOr<LibraryResponse>> _updateLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public UpdateLibraryEndpoint(ISender sender)
|
||||
/// <param name="updateLibraryCommandHandler">Injected service for handling update library commands.</param>
|
||||
public UpdateLibraryEndpoint(ICommandHandler<UpdateLibraryCommand, ErrorOr<LibraryResponse>> updateLibraryCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_updateLibraryCommandHandler = updateLibraryCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Libraries.UPDATE_LIBRARY);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateLibraryRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LibraryResponse> result = await _updateLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.WrittenContentLibrary.BookLibrary;
|
||||
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.Library.WrittenContentLibrary.B
|
||||
/// </summary>
|
||||
public class AddBookEndpoint : BaseEndpoint<AddBookRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<AddBookCommand, ErrorOr<BookResponse>> _addBookCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddBookEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public AddBookEndpoint(ISender sender)
|
||||
/// <param name="addBookCommandHandler">Injected service for handling add book commands.</param>
|
||||
public AddBookEndpoint(ICommandHandler<AddBookCommand, ErrorOr<BookResponse>> addBookCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_addBookCommandHandler = addBookCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class AddBookEndpoint : BaseEndpoint<AddBookRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Books.ADD_BOOK);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class AddBookEndpoint : BaseEndpoint<AddBookRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddBookRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<BookResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<BookResponse> result = await _addBookCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{ApiRoutes.Books.ADD_BOOK}/{result.Value.Id}", result.Value), Problem);
|
||||
}
|
||||
}
|
||||
+1
-14
@@ -1,9 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -16,23 +14,12 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.B
|
||||
/// </summary>
|
||||
public class GetBookEndpoint : BaseEndpoint<GetBookRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetBookEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetBookEndpoint(ISender sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the API endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Books.GET_BOOK_BY_ID);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
|
||||
+7
-8
@@ -1,13 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Queries.GetBooks;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@@ -21,15 +20,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.B
|
||||
/// </summary>
|
||||
public class GetBooksEndpoint : BaseEndpoint<GetBooksRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetBooksQuery, ErrorOr<IEnumerable<BookResponse>>> _getBooksQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetBooksEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetBooksEndpoint(ISender sender)
|
||||
/// <param name="getBooksQueryHandler">Injected service for handling get books queries.</param>
|
||||
public GetBooksEndpoint(IQueryHandler<GetBooksQuery, ErrorOr<IEnumerable<BookResponse>>> getBooksQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getBooksQueryHandler = getBooksQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +36,7 @@ public class GetBooksEndpoint : BaseEndpoint<GetBooksRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Books.GET_BOOKS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +49,7 @@ public class GetBooksEndpoint : BaseEndpoint<GetBooksRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetBooksRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<BookResponse>> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<BookResponse>> result = await _getBooksQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Maintenance.ApplicationSetup.Queries.CheckInitialization;
|
||||
using Lumina.Contracts.Responses.UsersManagement;
|
||||
using Lumina.Presentation.Api.Common.Routes.Maintenance;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -17,15 +17,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance.ApplicationSetup;
|
||||
/// </summary>
|
||||
public class CheckInitializationEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<CheckInitializationQuery, InitializationResponse> _checkInitializationQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckInitializationEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public CheckInitializationEndpoint(ISender sender)
|
||||
/// <param name="checkInitializationQueryHandler">Injected service for handling check initialization queries.</param>
|
||||
public CheckInitializationEndpoint(IQueryHandler<CheckInitializationQuery, InitializationResponse> checkInitializationQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_checkInitializationQueryHandler = checkInitializationQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ public class CheckInitializationEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Initialization.CHECK_INITIALIZATION);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -46,7 +46,7 @@ public class CheckInitializationEndpoint : 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)
|
||||
{
|
||||
InitializationResponse result = await _sender.Send(new CheckInitializationQuery(), cancellationToken).ConfigureAwait(false);
|
||||
InitializationResponse result = await _checkInitializationQueryHandler.HandleAsync(new CheckInitializationQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return TypedResults.Ok(result);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Core.Maintenance.ApplicationSetup.Commands.SetupApplication;
|
||||
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.Maintenance.ApplicationSetup;
|
||||
/// </summary>
|
||||
public class SetupApplicationEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<SetupApplicationCommand, ErrorOr<RegistrationResponse>> _setupApplicationCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetupApplicationEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public SetupApplicationEndpoint(ISender sender)
|
||||
/// <param name="setupApplicationCommandHandler">Injected service for handling setup application commands.</param>
|
||||
public SetupApplicationEndpoint(ICommandHandler<SetupApplicationCommand, ErrorOr<RegistrationResponse>> setupApplicationCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_setupApplicationCommandHandler = setupApplicationCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class SetupApplicationEndpoint : BaseEndpoint<RegistrationRequest, IResul
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Initialization.SETUP_APPLICATION);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -49,7 +49,7 @@ public class SetupApplicationEndpoint : BaseEndpoint<RegistrationRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(RegistrationRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RegistrationResponse> result = await _sender.Send(request.ToSetupCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<RegistrationResponse> result = await _setupApplicationCommandHandler.HandleAsync(request.ToSetupCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{Api.Common.Routes.UsersManagement.ApiRoutes.Users.GET_USER_BY_ID.Replace("{id}", success.Id.ToString())}", result.Value), Problem);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Common.Routes.Maintenance;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance;
|
||||
@@ -21,23 +14,12 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance;
|
||||
/// </summary>
|
||||
public class CheckHealthEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckHealthEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public CheckHealthEndpoint(ISender sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the API endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Health.CHECK_HEALTH);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Application.Core.Plugins.Queries.GetLibraryMetadataProviders;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using Lumina.Contracts.Responses.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Plugins.GetLibraryMetadataProvi
|
||||
/// </summary>
|
||||
public class GetLibraryMetadataProvidersEndpoint : BaseEndpoint<GetLibraryMetadataProvidersRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetLibraryMetadataProvidersQuery, ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>>> _getLibraryMetadataProvidersQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryMetadataProvidersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetLibraryMetadataProvidersEndpoint(ISender sender)
|
||||
/// <param name="getLibraryMetadataProvidersQueryHandler">Injected service for handling get library metadata providers queries.</param>
|
||||
public GetLibraryMetadataProvidersEndpoint(IQueryHandler<GetLibraryMetadataProvidersQuery, ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>>> getLibraryMetadataProvidersQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getLibraryMetadataProvidersQueryHandler = getLibraryMetadataProvidersQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ public class GetLibraryMetadataProvidersEndpoint : BaseEndpoint<GetLibraryMetada
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_LIBRARY_METADATA_PROVIDERS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +49,7 @@ public class GetLibraryMetadataProvidersEndpoint : BaseEndpoint<GetLibraryMetada
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetLibraryMetadataProvidersRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>> result = await _getLibraryMetadataProvidersQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Application.Core.Plugins.Queries.GetPluginSettings;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using Lumina.Contracts.Responses.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
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.Plugins.GetPluginSettings;
|
||||
/// </summary>
|
||||
public class GetPluginSettingsEndpoint : BaseEndpoint<GetPluginSettingsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetPluginSettingsQuery, ErrorOr<PluginSettingsResponse>> _getPluginSettingsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPluginSettingsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetPluginSettingsEndpoint(ISender sender)
|
||||
/// <param name="getPluginSettingsQueryHandler">Injected service for handling get plugin settings queries.</param>
|
||||
public GetPluginSettingsEndpoint(IQueryHandler<GetPluginSettingsQuery, ErrorOr<PluginSettingsResponse>> getPluginSettingsQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getPluginSettingsQueryHandler = getPluginSettingsQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetPluginSettingsEndpoint : BaseEndpoint<GetPluginSettingsRequest,
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Plugins.GET_PLUGIN_SETTINGS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class GetPluginSettingsEndpoint : BaseEndpoint<GetPluginSettingsRequest,
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetPluginSettingsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<PluginSettingsResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<PluginSettingsResponse> result = await _getPluginSettingsQueryHandler.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.Plugins.Queries.GetPlugins;
|
||||
using Lumina.Contracts.Responses.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
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.Plugins.GetPlugins;
|
||||
/// </summary>
|
||||
public class GetPluginsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetPluginsQuery, ErrorOr<IReadOnlyList<PluginResponse>>> _getPluginsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPluginsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetPluginsEndpoint(ISender sender)
|
||||
/// <param name="getPluginsQueryHandler">Injected service for handling get plugins queries.</param>
|
||||
public GetPluginsEndpoint(IQueryHandler<GetPluginsQuery, ErrorOr<IReadOnlyList<PluginResponse>>> getPluginsQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getPluginsQueryHandler = getPluginsQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetPluginsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Plugins.GET_PLUGINS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class GetPluginsEndpoint : 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<IReadOnlyList<PluginResponse>> result = await _sender.Send(new GetPluginsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IReadOnlyList<PluginResponse>> result = await _getPluginsQueryHandler.HandleAsync(new GetPluginsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Application.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Plugins.ReorderLibraryMetadataP
|
||||
/// </summary>
|
||||
public class ReorderLibraryMetadataProvidersEndpoint : BaseEndpoint<ReorderLibraryMetadataProvidersRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<ReorderLibraryMetadataProvidersCommand, ErrorOr<Success>> _reorderLibraryMetadataProvidersCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReorderLibraryMetadataProvidersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public ReorderLibraryMetadataProvidersEndpoint(ISender sender)
|
||||
/// <param name="reorderLibraryMetadataProvidersCommandHandler">Injected service for handling reorder library metadata providers commands.</param>
|
||||
public ReorderLibraryMetadataProvidersEndpoint(ICommandHandler<ReorderLibraryMetadataProvidersCommand, ErrorOr<Success>> reorderLibraryMetadataProvidersCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_reorderLibraryMetadataProvidersCommandHandler = reorderLibraryMetadataProvidersCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class ReorderLibraryMetadataProvidersEndpoint : BaseEndpoint<ReorderLibra
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Libraries.REORDER_LIBRARY_METADATA_PROVIDERS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class ReorderLibraryMetadataProvidersEndpoint : BaseEndpoint<ReorderLibra
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(ReorderLibraryMetadataProvidersRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Success> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Success> result = await _reorderLibraryMetadataProvidersCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Application.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
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.Plugins.SetLibraryMetadataProvi
|
||||
/// </summary>
|
||||
public class SetLibraryMetadataProviderEnabledEndpoint : BaseEndpoint<SetLibraryMetadataProviderEnabledRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<SetLibraryMetadataProviderEnabledCommand, ErrorOr<Success>> _setLibraryMetadataProviderEnabledCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetLibraryMetadataProviderEnabledEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public SetLibraryMetadataProviderEnabledEndpoint(ISender sender)
|
||||
/// <param name="setLibraryMetadataProviderEnabledCommandHandler">Injected service for handling set library metadata provider enabled commands.</param>
|
||||
public SetLibraryMetadataProviderEnabledEndpoint(ICommandHandler<SetLibraryMetadataProviderEnabledCommand, ErrorOr<Success>> setLibraryMetadataProviderEnabledCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_setLibraryMetadataProviderEnabledCommandHandler = setLibraryMetadataProviderEnabledCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class SetLibraryMetadataProviderEnabledEndpoint : BaseEndpoint<SetLibrary
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Libraries.SET_LIBRARY_METADATA_PROVIDER_ENABLED);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class SetLibraryMetadataProviderEnabledEndpoint : BaseEndpoint<SetLibrary
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(SetLibraryMetadataProviderEnabledRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Success> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Success> result = await _setLibraryMetadataProviderEnabledCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Application.Core.Plugins.Commands.UpdatePluginSettings;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
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.Plugins.UpdatePluginSettings;
|
||||
/// </summary>
|
||||
public class UpdatePluginSettingsEndpoint : BaseEndpoint<UpdatePluginSettingsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<UpdatePluginSettingsCommand, ErrorOr<Success>> _updatePluginSettingsCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdatePluginSettingsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public UpdatePluginSettingsEndpoint(ISender sender)
|
||||
/// <param name="updatePluginSettingsCommandHandler">Injected service for handling update plugin settings commands.</param>
|
||||
public UpdatePluginSettingsEndpoint(ICommandHandler<UpdatePluginSettingsCommand, ErrorOr<Success>> updatePluginSettingsCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_updatePluginSettingsCommandHandler = updatePluginSettingsCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ public class UpdatePluginSettingsEndpoint : BaseEndpoint<UpdatePluginSettingsReq
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Plugins.UPDATE_PLUGIN_SETTINGS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class UpdatePluginSettingsEndpoint : BaseEndpoint<UpdatePluginSettingsReq
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdatePluginSettingsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Success> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<Success> result = await _updatePluginSettingsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.ChangePassword;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class ChangePasswordEndpoint : BaseEndpoint<ChangePasswordRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<ChangePasswordCommand, ErrorOr<ChangePasswordResponse>> _changePasswordCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChangePasswordEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public ChangePasswordEndpoint(ISender sender)
|
||||
/// <param name="changePasswordCommandHandler">Injected service for handling change password commands.</param>
|
||||
public ChangePasswordEndpoint(ICommandHandler<ChangePasswordCommand, ErrorOr<ChangePasswordResponse>> changePasswordCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_changePasswordCommandHandler = changePasswordCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class ChangePasswordEndpoint : BaseEndpoint<ChangePasswordRequest, IResul
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Authentication.CHANGE_PASSWORD);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class ChangePasswordEndpoint : BaseEndpoint<ChangePasswordRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(ChangePasswordRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<ChangePasswordResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<ChangePasswordResponse> result = await _changePasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Queries.GetUsers;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Users;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class GetUsersEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetUsersQuery, ErrorOr<IEnumerable<UserResponse>>> _getUsersQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUsersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetUsersEndpoint(ISender sender)
|
||||
/// <param name="getUsersQueryHandler">Injected service for handling get users queries.</param>
|
||||
public GetUsersEndpoint(IQueryHandler<GetUsersQuery, ErrorOr<IEnumerable<UserResponse>>> getUsersQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getUsersQueryHandler = getUsersQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class GetUsersEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Authentication.USERS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class GetUsersEndpoint : 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<UserResponse>> result = await _sender.Send(new GetUsersQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<UserResponse>> result = await _getUsersQueryHandler.HandleAsync(new GetUsersQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Errors;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Queries.LoginUser;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
@@ -23,15 +23,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class LoginEndpoint : BaseEndpoint<LoginRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<LoginUserQuery, ErrorOr<LoginResponse>> _loginQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LoginEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public LoginEndpoint(ISender sender)
|
||||
/// <param name="loginQueryHandler">Injected service for handling login queries.</param>
|
||||
public LoginEndpoint(IQueryHandler<LoginUserQuery, ErrorOr<LoginResponse>> loginQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_loginQueryHandler = loginQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,7 +39,7 @@ public class LoginEndpoint : BaseEndpoint<LoginRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Authentication.LOGIN_ACCOUNT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -54,7 +54,7 @@ public class LoginEndpoint : BaseEndpoint<LoginRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(LoginRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<LoginResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<LoginResponse> result = await _loginQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.RecoverPassword;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
@@ -20,15 +20,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class RecoverPasswordEndpoint : BaseEndpoint<RecoverPasswordRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<RecoverPasswordCommand, ErrorOr<RecoverPasswordResponse>> _recoverPasswordCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RecoverPasswordEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public RecoverPasswordEndpoint(ISender sender)
|
||||
/// <param name="recoverPasswordCommandHandler">Injected service for handling recover password commands.</param>
|
||||
public RecoverPasswordEndpoint(ICommandHandler<RecoverPasswordCommand, ErrorOr<RecoverPasswordResponse>> recoverPasswordCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_recoverPasswordCommandHandler = recoverPasswordCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ public class RecoverPasswordEndpoint : BaseEndpoint<RecoverPasswordRequest, IRes
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Authentication.RECOVER_PASSWORD);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -51,7 +51,7 @@ public class RecoverPasswordEndpoint : BaseEndpoint<RecoverPasswordRequest, IRes
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(RecoverPasswordRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RecoverPasswordResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<RecoverPasswordResponse> result = await _recoverPasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.RegisterUser;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
@@ -20,15 +20,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class RegisterEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<RegisterUserCommand, ErrorOr<RegistrationResponse>> _registerUserCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RegisterEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public RegisterEndpoint(ISender sender)
|
||||
/// <param name="registerUserCommandHandler">Injected service for handling register user commands.</param>
|
||||
public RegisterEndpoint(ICommandHandler<RegisterUserCommand, ErrorOr<RegistrationResponse>> registerUserCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_registerUserCommandHandler = registerUserCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ public class RegisterEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.POST);
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Routes(ApiRoutes.Authentication.REGISTER_ACCOUNT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -51,7 +51,7 @@ public class RegisterEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(RegistrationRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RegistrationResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<RegistrationResponse> result = await _registerUserCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{ApiRoutes.Users.GET_USER_BY_ID.Replace("{id}", success.Id.ToString())}", result.Value), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetAuthorization;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -20,15 +20,15 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetAuthorizationEndpoint : BaseEndpoint<GetAuthorizationRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetAuthorizationQuery, ErrorOr<AuthorizationResponse>> _getAuthorizationQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetAuthorizationEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetAuthorizationEndpoint(ISender sender)
|
||||
/// <param name="getAuthorizationQueryHandler">Injected service for handling get authorization queries.</param>
|
||||
public GetAuthorizationEndpoint(IQueryHandler<GetAuthorizationQuery, ErrorOr<AuthorizationResponse>> getAuthorizationQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getAuthorizationQueryHandler = getAuthorizationQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ public class GetAuthorizationEndpoint : BaseEndpoint<GetAuthorizationRequest, IR
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_AUTHORIZATION);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +49,7 @@ public class GetAuthorizationEndpoint : BaseEndpoint<GetAuthorizationRequest, IR
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetAuthorizationRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<AuthorizationResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<AuthorizationResponse> result = await _getAuthorizationQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetUserPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> _getUserPermissionsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetUserPermissionsEndpoint(ISender sender)
|
||||
/// <param name="getUserPermissionsQueryHandler">Injected service for handling get user permissions queries.</param>
|
||||
public GetUserPermissionsEndpoint(IQueryHandler<GetUserPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> getUserPermissionsQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getUserPermissionsQueryHandler = getUserPermissionsQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +37,7 @@ public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_USER_PERMISSIONS_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +50,7 @@ public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetUserPermissionsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PermissionResponse>> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<IEnumerable<PermissionResponse>> result = await _getUserPermissionsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly IQueryHandler<GetUserRoleQuery, ErrorOr<RoleResponse?>> _getUserRoleQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetUserRoleEndpoint(ISender sender)
|
||||
/// <param name="getUserRoleQueryHandler">Injected service for handling get user role queries.</param>
|
||||
public GetUserRoleEndpoint(IQueryHandler<GetUserRoleQuery, ErrorOr<RoleResponse?>> getUserRoleQueryHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_getUserRoleQueryHandler = getUserRoleQueryHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +37,7 @@ public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_USER_ROLE_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +50,7 @@ public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetUserRoleRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RoleResponse?> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<RoleResponse?> result = await _getUserRoleQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
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.UsersManagement.Authorization.U
|
||||
/// </summary>
|
||||
public class UpdateUserRoleAndPermissionsEndpoint : BaseEndpoint<UpdateUserRoleAndPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
private readonly ICommandHandler<UpdateUserRoleAndPermissionsCommand, ErrorOr<AuthorizationResponse>> _updateUserRoleAndPermissionsCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public UpdateUserRoleAndPermissionsEndpoint(ISender sender)
|
||||
/// <param name="updateUserRoleAndPermissionsCommandHandler">Injected service for handling update user role and permissions commands.</param>
|
||||
public UpdateUserRoleAndPermissionsEndpoint(ICommandHandler<UpdateUserRoleAndPermissionsCommand, ErrorOr<AuthorizationResponse>> updateUserRoleAndPermissionsCommandHandler)
|
||||
{
|
||||
_sender = sender;
|
||||
_updateUserRoleAndPermissionsCommandHandler = updateUserRoleAndPermissionsCommandHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ public class UpdateUserRoleAndPermissionsEndpoint : BaseEndpoint<UpdateUserRoleA
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Verbs(FastEndpoints.Http.PUT);
|
||||
Routes(ApiRoutes.Authorization.UPDATE_USER_ROLE_AND_PERMISSIONS_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +48,7 @@ public class UpdateUserRoleAndPermissionsEndpoint : BaseEndpoint<UpdateUserRoleA
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateUserRoleAndPermissionsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<AuthorizationResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
ErrorOr<AuthorizationResponse> result = await _updateUserRoleAndPermissionsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,6 @@
|
||||
<PackageReference Include="FastEndpoints" Version="5.31.0.6-beta" />
|
||||
<PackageReference Include="FastEndpoints.Swagger" Version="5.31.0.6-beta" />
|
||||
<PackageReference Include="Mediator.Abstractions" Version="3.0.0-preview.27" />
|
||||
<PackageReference Include="Mediator.SourceGenerator" Version="3.0.0-preview.27">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
|
||||
@@ -62,9 +58,4 @@
|
||||
<ProjectReference Include="..\Lumina.Infrastructure\Lumina.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\Lumina.DataAccess\Lumina.DataAccess.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--disable warnings generated by Mediator source generator-->
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CS0436</NoWarn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in new issue
Block a user