mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Replaces ErrorOr library with a custom implementation.
This commit is contained in:
1 parent
8fe90a4dde
commit
3b772d68ca
436 files changed
+4234
-3922
No files matched your search
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Admin.Authorization.Permissions.Queries.GetPermissions;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Permissions
|
||||
/// </summary>
|
||||
public class GetPermissionsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> _getPermissionsQueryHandler;
|
||||
private readonly IQueryHandler<GetPermissionsQuery, Result<IEnumerable<PermissionResponse>>> _getPermissionsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getPermissionsQueryHandler">Injected service for handling get permissions queries.</param>
|
||||
public GetPermissionsEndpoint(IQueryHandler<GetPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> getPermissionsQueryHandler)
|
||||
public GetPermissionsEndpoint(IQueryHandler<GetPermissionsQuery, Result<IEnumerable<PermissionResponse>>> getPermissionsQueryHandler)
|
||||
{
|
||||
_getPermissionsQueryHandler = getPermissionsQueryHandler;
|
||||
}
|
||||
@@ -47,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 _getPermissionsQueryHandler.HandleAsync(new GetPermissionsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<PermissionResponse>> result = await _getPermissionsQueryHandler.HandleAsync(new GetPermissionsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.AddRole;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Roles.AddRo
|
||||
/// </summary>
|
||||
public class AddRoleEndpoint : BaseEndpoint<AddRoleRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<AddRoleCommand, ErrorOr<RolePermissionsResponse>> _addRoleCommandHandler;
|
||||
private readonly ICommandHandler<AddRoleCommand, Result<RolePermissionsResponse>> _addRoleCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="addRoleCommandHandler">Injected service for handling add role commands.</param>
|
||||
public AddRoleEndpoint(ICommandHandler<AddRoleCommand, ErrorOr<RolePermissionsResponse>> addRoleCommandHandler)
|
||||
public AddRoleEndpoint(ICommandHandler<AddRoleCommand, Result<RolePermissionsResponse>> addRoleCommandHandler)
|
||||
{
|
||||
_addRoleCommandHandler = addRoleCommandHandler;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class AddRoleEndpoint : BaseEndpoint<AddRoleRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(AddRoleRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RolePermissionsResponse> result = await _addRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<RolePermissionsResponse> result = await _addRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.DeleteRole;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Roles.Delet
|
||||
/// </summary>
|
||||
public class DeleteRoleEndpoint : BaseEndpoint<DeleteRoleRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<DeleteRoleCommand, ErrorOr<Deleted>> _deleteRoleCommandHandler;
|
||||
private readonly ICommandHandler<DeleteRoleCommand, Result<Deleted>> _deleteRoleCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeleteRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deleteRoleCommandHandler">Injected service for handling delete role commands.</param>
|
||||
public DeleteRoleEndpoint(ICommandHandler<DeleteRoleCommand, ErrorOr<Deleted>> deleteRoleCommandHandler)
|
||||
public DeleteRoleEndpoint(ICommandHandler<DeleteRoleCommand, Result<Deleted>> deleteRoleCommandHandler)
|
||||
{
|
||||
_deleteRoleCommandHandler = deleteRoleCommandHandler;
|
||||
}
|
||||
@@ -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 _deleteRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Deleted> result = await _deleteRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRolePermissions;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Roles.GetRo
|
||||
/// </summary>
|
||||
public class GetRolePermissionsEndpoint : BaseEndpoint<GetRolePermissionsRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetRolePermissionsQuery, ErrorOr<RolePermissionsResponse>> _addRoleQueryHandler;
|
||||
private readonly IQueryHandler<GetRolePermissionsQuery, Result<RolePermissionsResponse>> _addRoleQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetRolePermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="addRoleQueryHandler">Injected service for handling add role commands.</param>
|
||||
public GetRolePermissionsEndpoint(IQueryHandler<GetRolePermissionsQuery, ErrorOr<RolePermissionsResponse>> addRoleQueryHandler)
|
||||
public GetRolePermissionsEndpoint(IQueryHandler<GetRolePermissionsQuery, Result<RolePermissionsResponse>> addRoleQueryHandler)
|
||||
{
|
||||
_addRoleQueryHandler = addRoleQueryHandler;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class GetRolePermissionsEndpoint : BaseEndpoint<GetRolePermissionsRequest
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetRolePermissionsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RolePermissionsResponse> result = await _addRoleQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<RolePermissionsResponse> result = await _addRoleQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRoles;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Roles.GetRo
|
||||
/// </summary>
|
||||
public class GetRolesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetRolesQuery, ErrorOr<IEnumerable<RoleResponse>>> _getRolesQueryHandler;
|
||||
private readonly IQueryHandler<GetRolesQuery, Result<IEnumerable<RoleResponse>>> _getRolesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetRolesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getRolesQueryHandler">Injected service for handling get roles queries.</param>
|
||||
public GetRolesEndpoint(IQueryHandler<GetRolesQuery, ErrorOr<IEnumerable<RoleResponse>>> getRolesQueryHandler)
|
||||
public GetRolesEndpoint(IQueryHandler<GetRolesQuery, Result<IEnumerable<RoleResponse>>> getRolesQueryHandler)
|
||||
{
|
||||
_getRolesQueryHandler = getRolesQueryHandler;
|
||||
}
|
||||
@@ -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 _getRolesQueryHandler.HandleAsync(new GetRolesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<RoleResponse>> result = await _getRolesQueryHandler.HandleAsync(new GetRolesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.UpdateRole;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Admin.Authorization.Roles.Updat
|
||||
/// </summary>
|
||||
public class UpdateRoleEndpoint : BaseEndpoint<UpdateRoleRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<UpdateRoleCommand, ErrorOr<RolePermissionsResponse>> _updateRoleCommandHandler;
|
||||
private readonly ICommandHandler<UpdateRoleCommand, Result<RolePermissionsResponse>> _updateRoleCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateRoleCommandHandler">Injected service for handling update role commands.</param>
|
||||
public UpdateRoleEndpoint(ICommandHandler<UpdateRoleCommand, ErrorOr<RolePermissionsResponse>> updateRoleCommandHandler)
|
||||
public UpdateRoleEndpoint(ICommandHandler<UpdateRoleCommand, Result<RolePermissionsResponse>> updateRoleCommandHandler)
|
||||
{
|
||||
_updateRoleCommandHandler = updateRoleCommandHandler;
|
||||
}
|
||||
@@ -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 _updateRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<RolePermissionsResponse> result = await _updateRoleCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
|
||||
+10
-9
@@ -1,17 +1,18 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectories;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directories.GetDirectories;
|
||||
@@ -21,13 +22,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directorie
|
||||
/// </summary>
|
||||
public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<DirectoryResponse>>> _getDirectoriesQueryHandler;
|
||||
private readonly IQueryHandler<GetDirectoriesQuery, Result<IEnumerable<DirectoryResponse>>> _getDirectoriesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetDirectoriesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getDirectoriesQueryHandler">Injected service for handling get directories queries.</param>
|
||||
public GetDirectoriesEndpoint(IQueryHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<DirectoryResponse>>> getDirectoriesQueryHandler)
|
||||
public GetDirectoriesEndpoint(IQueryHandler<GetDirectoriesQuery, Result<IEnumerable<DirectoryResponse>>> getDirectoriesQueryHandler)
|
||||
{
|
||||
_getDirectoriesQueryHandler = getDirectoriesQueryHandler;
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Directories.GET_DIRECTORIES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +51,7 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetDirectoriesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<DirectoryResponse>> result = await _getDirectoriesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<DirectoryResponse>> result = await _getDirectoriesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.FileSystemManagement.Drives.Queries.GetDrives;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Drives.Get
|
||||
/// </summary>
|
||||
public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> _getDrivesQueryHandler;
|
||||
private readonly IQueryHandler<GetDrivesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> _getDrivesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetDrivesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getDrivesQueryHandler">Injected service for handling get drives queries.</param>
|
||||
public GetDrivesEndpoint(IQueryHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> getDrivesQueryHandler)
|
||||
public GetDrivesEndpoint(IQueryHandler<GetDrivesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> getDrivesQueryHandler)
|
||||
{
|
||||
_getDrivesQueryHandler = getDrivesQueryHandler;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Drives.GET_DRIVES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -47,7 +47,7 @@ public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(EmptyRequest _, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _getDrivesQueryHandler.HandleAsync(new GetDrivesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<FileSystemTreeNodeResponse>> result = await _getDrivesQueryHandler.HandleAsync(new GetDrivesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -1,15 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Application.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -37,7 +33,7 @@ public class GetTypeEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.FileSystem.GET_TYPES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetF
|
||||
/// </summary>
|
||||
public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetFilesQuery, ErrorOr<IEnumerable<FileResponse>>> _getFilesQueryHandler;
|
||||
private readonly IQueryHandler<GetFilesQuery, Result<IEnumerable<FileResponse>>> _getFilesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetFilesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getFilesQueryHandler">Injected service for handling get files queries.</param>
|
||||
public GetFilesEndpoint(IQueryHandler<GetFilesQuery, ErrorOr<IEnumerable<FileResponse>>> getFilesQueryHandler)
|
||||
public GetFilesEndpoint(IQueryHandler<GetFilesQuery, Result<IEnumerable<FileResponse>>> getFilesQueryHandler)
|
||||
{
|
||||
_getFilesQueryHandler = getFilesQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Files.GET_FILES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,7 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetFilesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<FileResponse>> result = await _getFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<FileResponse>> result = await _getFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetT
|
||||
/// </summary>
|
||||
public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetTreeFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> _getTreeFilesQueryHandler;
|
||||
private readonly IQueryHandler<GetTreeFilesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> _getTreeFilesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetTreeFilesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getTreeFilesQueryHandler">Injected service for handling get tree files queries.</param>
|
||||
public GetTreeFilesEndpoint(IQueryHandler<GetTreeFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> getTreeFilesQueryHandler)
|
||||
public GetTreeFilesEndpoint(IQueryHandler<GetTreeFilesQuery, Result<IEnumerable<FileSystemTreeNodeResponse>>> getTreeFilesQueryHandler)
|
||||
{
|
||||
_getTreeFilesQueryHandler = getTreeFilesQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Files.GET_TREE_FILES);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,7 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetTreeFilesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _getTreeFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<FileSystemTreeNodeResponse>> result = await _getTreeFilesQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Check
|
||||
/// </summary>
|
||||
public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<CheckPathExistsQuery, ErrorOr<PathExistsResponse>> _checkPathExistsQueryHandler;
|
||||
private readonly IQueryHandler<CheckPathExistsQuery, Result<PathExistsResponse>> _checkPathExistsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckPathExistsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="checkPathExistsQueryHandler">Injected service for handling check path exists queries.</param>
|
||||
public CheckPathExistsEndpoint(IQueryHandler<CheckPathExistsQuery, ErrorOr<PathExistsResponse>> checkPathExistsQueryHandler)
|
||||
public CheckPathExistsEndpoint(IQueryHandler<CheckPathExistsQuery, Result<PathExistsResponse>> checkPathExistsQueryHandler)
|
||||
{
|
||||
_checkPathExistsQueryHandler = checkPathExistsQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.CHECK_PATH_EXISTS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CheckPathExistsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<PathExistsResponse> result = await _checkPathExistsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<PathExistsResponse> result = await _checkPathExistsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Combi
|
||||
/// </summary>
|
||||
public class CombinePathEndpoint : BaseEndpoint<CombinePathRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>> _combinePathCommandHandler;
|
||||
private readonly ICommandHandler<CombinePathCommand, Result<PathSegmentResponse>> _combinePathCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CombinePathEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="combinePathCommandHandler">Injected service for handling combine path commands.</param>
|
||||
public CombinePathEndpoint(ICommandHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>> combinePathCommandHandler)
|
||||
public CombinePathEndpoint(ICommandHandler<CombinePathCommand, Result<PathSegmentResponse>> combinePathCommandHandler)
|
||||
{
|
||||
_combinePathCommandHandler = combinePathCommandHandler;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class CombinePathEndpoint : BaseEndpoint<CombinePathRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CombinePathRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<PathSegmentResponse> result = await _combinePathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<PathSegmentResponse> result = await _combinePathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPa
|
||||
/// </summary>
|
||||
public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>> _getPathParentQueryHandler;
|
||||
private readonly IQueryHandler<GetPathParentQuery, Result<IEnumerable<PathSegmentResponse>>> _getPathParentQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathParentEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getPathParentQueryHandler">Injected service for handling get path parent queries.</param>
|
||||
public GetPathParentEndpoint(IQueryHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>> getPathParentQueryHandler)
|
||||
public GetPathParentEndpoint(IQueryHandler<GetPathParentQuery, Result<IEnumerable<PathSegmentResponse>>> getPathParentQueryHandler)
|
||||
{
|
||||
_getPathParentQueryHandler = getPathParentQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.GET_PATH_PARENT);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,7 @@ public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetPathParentRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _getPathParentQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<PathSegmentResponse>> result = await _getPathParentQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPa
|
||||
/// </summary>
|
||||
public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>> _getPathRootQueryHandler;
|
||||
private readonly IQueryHandler<GetPathRootQuery, Result<PathSegmentResponse>> _getPathRootQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathRootEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getPathRootQueryHandler">Injected service for handling get path root queries.</param>
|
||||
public GetPathRootEndpoint(IQueryHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>> getPathRootQueryHandler)
|
||||
public GetPathRootEndpoint(IQueryHandler<GetPathRootQuery, Result<PathSegmentResponse>> getPathRootQueryHandler)
|
||||
{
|
||||
_getPathRootQueryHandler = getPathRootQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.GET_PATH_ROOT);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,7 @@ public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetPathRootRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<PathSegmentResponse> result = await _getPathRootQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<PathSegmentResponse> result = await _getPathRootQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
|
||||
@@ -20,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Split
|
||||
/// </summary>
|
||||
public class SplitPathEndpoint : BaseEndpoint<SplitPathRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>> _splitPathCommandHandler;
|
||||
private readonly ICommandHandler<SplitPathCommand, Result<IEnumerable<PathSegmentResponse>>> _splitPathCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SplitPathEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="splitPathCommandHandler">Injected service for handling split path commands.</param>
|
||||
public SplitPathEndpoint(ICommandHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>> splitPathCommandHandler)
|
||||
public SplitPathEndpoint(ICommandHandler<SplitPathCommand, Result<IEnumerable<PathSegmentResponse>>> splitPathCommandHandler)
|
||||
{
|
||||
_splitPathCommandHandler = splitPathCommandHandler;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class SplitPathEndpoint : BaseEndpoint<SplitPathRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(SplitPathRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _splitPathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<PathSegmentResponse>> result = await _splitPathCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Valid
|
||||
/// </summary>
|
||||
public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<ValidatePathQuery, ErrorOr<PathValidResponse>> _validatePathQueryHandler;
|
||||
private readonly IQueryHandler<ValidatePathQuery, Result<PathValidResponse>> _validatePathQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValidatePathEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="validatePathQueryHandler">Injected service for handling validate path queries.</param>
|
||||
public ValidatePathEndpoint(IQueryHandler<ValidatePathQuery, ErrorOr<PathValidResponse>> validatePathQueryHandler)
|
||||
public ValidatePathEndpoint(IQueryHandler<ValidatePathQuery, Result<PathValidResponse>> validatePathQueryHandler)
|
||||
{
|
||||
_validatePathQueryHandler = validatePathQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.VALIDATE);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,7 @@ public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(ValidatePathRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<PathValidResponse> result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<PathValidResponse> result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,11 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.FileSystemManagement;
|
||||
using Lumina.Presentation.Api.Common.Utilities;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
@@ -21,13 +22,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Thumbnails
|
||||
/// </summary>
|
||||
public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>> _getThumbnailQueryHandler;
|
||||
private readonly IQueryHandler<GetThumbnailQuery, Result<ThumbnailResponse>> _getThumbnailQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetThumbnailEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getThumbnailQueryHandler">Injected service for handling get thumbnail queries.</param>
|
||||
public GetThumbnailEndpoint(IQueryHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>> getThumbnailQueryHandler)
|
||||
public GetThumbnailEndpoint(IQueryHandler<GetThumbnailQuery, Result<ThumbnailResponse>> getThumbnailQueryHandler)
|
||||
{
|
||||
_getThumbnailQueryHandler = getThumbnailQueryHandler;
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Thumbnails.GET_THUMBNAIL);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +51,7 @@ public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetThumbnailRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<ThumbnailResponse> result = await _getThumbnailQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<ThumbnailResponse> result = await _getThumbnailQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.File(success.Bytes, MimeTypes.GetMimeType(success.Type)), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.AddLibrary;
|
||||
/// </summary>
|
||||
public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<AddLibraryCommand, ErrorOr<LibraryResponse>> _addLibraryCommandHandler;
|
||||
private readonly ICommandHandler<AddLibraryCommand, Result<LibraryResponse>> _addLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="addLibraryCommandHandler">Injected service for handling add library commands.</param>
|
||||
public AddLibraryEndpoint(ICommandHandler<AddLibraryCommand, ErrorOr<LibraryResponse>> addLibraryCommandHandler)
|
||||
public AddLibraryEndpoint(ICommandHandler<AddLibraryCommand, Result<LibraryResponse>> addLibraryCommandHandler)
|
||||
{
|
||||
_addLibraryCommandHandler = addLibraryCommandHandler;
|
||||
}
|
||||
@@ -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 _addLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<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);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibrariesScan;
|
||||
@@ -17,13 +17,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.CancelLibrar
|
||||
/// </summary>
|
||||
public class CancelLibrariesScanEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, ErrorOr<Success>> _cancelLibrariesScanCommandHandler;
|
||||
private readonly Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, Result<Success>> _cancelLibrariesScanCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CancelLibrariesScanEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="cancelLibrariesScanCommandHandler">Injected service for handling cancel libraries scan commands.</param>
|
||||
public CancelLibrariesScanEndpoint(Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, ErrorOr<Success>> cancelLibrariesScanCommandHandler)
|
||||
public CancelLibrariesScanEndpoint(Lumina.Application.Common.CQRS.ICommandHandler<CancelLibrariesScanCommand, Result<Success>> cancelLibrariesScanCommandHandler)
|
||||
{
|
||||
_cancelLibrariesScanCommandHandler = cancelLibrariesScanCommandHandler;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class CancelLibrariesScanEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Verbs(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 _cancelLibrariesScanCommandHandler.HandleAsync(new CancelLibrariesScanCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Success> result = await _cancelLibrariesScanCommandHandler.HandleAsync(new CancelLibrariesScanCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -1,10 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.CancelLibrar
|
||||
/// </summary>
|
||||
public class CancelLibraryScanEndpoint : BaseEndpoint<CancelLibraryScanRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<CancelLibraryScanCommand, ErrorOr<Success>> _cancelLibraryScanCommandHandler;
|
||||
private readonly ICommandHandler<CancelLibraryScanCommand, Result<Success>> _cancelLibraryScanCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CancelLibraryScanEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="cancelLibraryScanCommandHandler">Injected service for handling cancel library scan commands.</param>
|
||||
public CancelLibraryScanEndpoint(ICommandHandler<CancelLibraryScanCommand, ErrorOr<Success>> cancelLibraryScanCommandHandler)
|
||||
public CancelLibraryScanEndpoint(ICommandHandler<CancelLibraryScanCommand, Result<Success>> cancelLibraryScanCommandHandler)
|
||||
{
|
||||
_cancelLibraryScanCommandHandler = cancelLibraryScanCommandHandler;
|
||||
}
|
||||
@@ -47,7 +46,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 _cancelLibraryScanCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Success> result = await _cancelLibraryScanCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.NoContent(), Problem);
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
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,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.DeleteLibrar
|
||||
/// </summary>
|
||||
public class DeleteLibraryEndpoint : BaseEndpoint<DeleteLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<DeleteLibraryCommand, ErrorOr<Deleted>> _deleteLibraryCommandHandler;
|
||||
private readonly ICommandHandler<DeleteLibraryCommand, Result<Deleted>> _deleteLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeleteLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deleteLibraryCommandHandler">Injected service for handling delete library commands.</param>
|
||||
public DeleteLibraryEndpoint(ICommandHandler<DeleteLibraryCommand, ErrorOr<Deleted>> deleteLibraryCommandHandler)
|
||||
public DeleteLibraryEndpoint(ICommandHandler<DeleteLibraryCommand, Result<Deleted>> deleteLibraryCommandHandler)
|
||||
{
|
||||
_deleteLibraryCommandHandler = deleteLibraryCommandHandler;
|
||||
}
|
||||
@@ -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 _deleteLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Deleted> result = await _deleteLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetEnabledLi
|
||||
/// </summary>
|
||||
public class GetEnabledLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetEnabledLibrariesQuery, ErrorOr<LibraryResponse[]>> _getEnabledLibrariesQueryHandler;
|
||||
private readonly IQueryHandler<GetEnabledLibrariesQuery, Result<LibraryResponse[]>> _getEnabledLibrariesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetEnabledLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getEnabledLibrariesQueryHandler">Injected service for handling get enabled libraries queries.</param>
|
||||
public GetEnabledLibrariesEndpoint(IQueryHandler<GetEnabledLibrariesQuery, ErrorOr<LibraryResponse[]>> getEnabledLibrariesQueryHandler)
|
||||
public GetEnabledLibrariesEndpoint(IQueryHandler<GetEnabledLibrariesQuery, Result<LibraryResponse[]>> getEnabledLibrariesQueryHandler)
|
||||
{
|
||||
_getEnabledLibrariesQueryHandler = getEnabledLibrariesQueryHandler;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class GetEnabledLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(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 _getEnabledLibrariesQueryHandler.HandleAsync(new GetEnabledLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<LibraryResponse[]> result = await _getEnabledLibrariesQueryHandler.HandleAsync(new GetEnabledLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibraries
|
||||
/// </summary>
|
||||
public class GetLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetLibrariesQuery, ErrorOr<LibraryResponse[]>> _getLibrariesQueryHandler;
|
||||
private readonly IQueryHandler<GetLibrariesQuery, Result<LibraryResponse[]>> _getLibrariesQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getLibrariesQueryHandler">Injected service for handling get libraries queries.</param>
|
||||
public GetLibrariesEndpoint(IQueryHandler<GetLibrariesQuery, ErrorOr<LibraryResponse[]>> getLibrariesQueryHandler)
|
||||
public GetLibrariesEndpoint(IQueryHandler<GetLibrariesQuery, Result<LibraryResponse[]>> getLibrariesQueryHandler)
|
||||
{
|
||||
_getLibrariesQueryHandler = getLibrariesQueryHandler;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class GetLibrariesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(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 _getLibrariesQueryHandler.HandleAsync(new GetLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<LibraryResponse[]> result = await _getLibrariesQueryHandler.HandleAsync(new GetLibrariesQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibrary;
|
||||
/// </summary>
|
||||
public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetLibraryQuery, ErrorOr<LibraryResponse>> _getLibraryQueryHandler;
|
||||
private readonly IQueryHandler<GetLibraryQuery, Result<LibraryResponse>> _getLibraryQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getLibraryQueryHandler">Injected service for handling get library queries.</param>
|
||||
public GetLibraryEndpoint(IQueryHandler<GetLibraryQuery, ErrorOr<LibraryResponse>> getLibraryQueryHandler)
|
||||
public GetLibraryEndpoint(IQueryHandler<GetLibraryQuery, Result<LibraryResponse>> getLibraryQueryHandler)
|
||||
{
|
||||
_getLibraryQueryHandler = getLibraryQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_LIBRARY_BY_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,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 _getLibraryQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<LibraryResponse> result = await _getLibraryQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibrarySc
|
||||
/// </summary>
|
||||
public class GetLibraryScanProgressEndpoint : BaseEndpoint<GetLibraryScanProgressRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetLibraryScanProgressQuery, ErrorOr<MediaLibraryScanProgressResponse>> _getLibraryScanProgressQueryHandler;
|
||||
private readonly IQueryHandler<GetLibraryScanProgressQuery, Result<MediaLibraryScanProgressResponse>> _getLibraryScanProgressQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryScanProgressEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getLibraryScanProgressQueryHandler">Injected service for handling get library scan progress queries.</param>
|
||||
public GetLibraryScanProgressEndpoint(IQueryHandler<GetLibraryScanProgressQuery, ErrorOr<MediaLibraryScanProgressResponse>> getLibraryScanProgressQueryHandler)
|
||||
public GetLibraryScanProgressEndpoint(IQueryHandler<GetLibraryScanProgressQuery, Result<MediaLibraryScanProgressResponse>> getLibraryScanProgressQueryHandler)
|
||||
{
|
||||
_getLibraryScanProgressQueryHandler = getLibraryScanProgressQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class GetLibraryScanProgressEndpoint : BaseEndpoint<GetLibraryScanProgres
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Libraries.LIBRARY_SCAN_PROGRESS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,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 _getLibraryScanProgressQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<MediaLibraryScanProgressResponse> result = await _getLibraryScanProgressQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -1,10 +1,9 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetRunningLi
|
||||
/// </summary>
|
||||
public class GetRunningLibraryScansEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetRunningLibraryScansQuery, ErrorOr<IEnumerable<MediaLibraryScanProgressResponse>>> _getRunningLibraryScansQueryHandler;
|
||||
private readonly IQueryHandler<GetRunningLibraryScansQuery, Result<IEnumerable<MediaLibraryScanProgressResponse>>> _getRunningLibraryScansQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetRunningLibraryScansEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getRunningLibraryScansQueryHandler">Injected service for handling get running library scans queries.</param>
|
||||
public GetRunningLibraryScansEndpoint(IQueryHandler<GetRunningLibraryScansQuery, ErrorOr<IEnumerable<MediaLibraryScanProgressResponse>>> getRunningLibraryScansQueryHandler)
|
||||
public GetRunningLibraryScansEndpoint(IQueryHandler<GetRunningLibraryScansQuery, Result<IEnumerable<MediaLibraryScanProgressResponse>>> getRunningLibraryScansQueryHandler)
|
||||
{
|
||||
_getRunningLibraryScansQueryHandler = getRunningLibraryScansQueryHandler;
|
||||
}
|
||||
@@ -36,7 +35,7 @@ public class GetRunningLibraryScansEndpoint : BaseEndpoint<EmptyRequest, IResult
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_RUNNING_LIBRARIES_SCAN);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +47,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 _getRunningLibraryScansQueryHandler.HandleAsync(new GetRunningLibraryScansQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<MediaLibraryScanProgressResponse>> result = await _getRunningLibraryScansQueryHandler.HandleAsync(new GetRunningLibraryScansQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.ScanLibraries;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.ScanLibrarie
|
||||
/// </summary>
|
||||
public class ScanLibrariesEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<ScanLibrariesCommand, ErrorOr<IEnumerable<MediaLibraryScanResponse>>> _scanLibrariesCommandHandler;
|
||||
private readonly ICommandHandler<ScanLibrariesCommand, Result<IEnumerable<MediaLibraryScanResponse>>> _scanLibrariesCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScanLibrariesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="scanLibrariesCommandHandler">Injected service for handling scan libraries commands.</param>
|
||||
public ScanLibrariesEndpoint(ICommandHandler<ScanLibrariesCommand, ErrorOr<IEnumerable<MediaLibraryScanResponse>>> scanLibrariesCommandHandler)
|
||||
public ScanLibrariesEndpoint(ICommandHandler<ScanLibrariesCommand, Result<IEnumerable<MediaLibraryScanResponse>>> scanLibrariesCommandHandler)
|
||||
{
|
||||
_scanLibrariesCommandHandler = scanLibrariesCommandHandler;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class ScanLibrariesEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IR
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(FastEndpoints.EmptyRequest _, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<MediaLibraryScanResponse>> result = await _scanLibrariesCommandHandler.HandleAsync(new ScanLibrariesCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<MediaLibraryScanResponse>> result = await _scanLibrariesCommandHandler.HandleAsync(new ScanLibrariesCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.ScanLibrary;
|
||||
/// </summary>
|
||||
public class ScanLibraryEndpoint : BaseEndpoint<ScanLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<ScanLibraryCommand, ErrorOr<MediaLibraryScanResponse>> _scanLibraryCommandHandler;
|
||||
private readonly ICommandHandler<ScanLibraryCommand, Result<MediaLibraryScanResponse>> _scanLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScanLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="scanLibraryCommandHandler">Injected service for handling scan library commands.</param>
|
||||
public ScanLibraryEndpoint(ICommandHandler<ScanLibraryCommand, ErrorOr<MediaLibraryScanResponse>> scanLibraryCommandHandler)
|
||||
public ScanLibraryEndpoint(ICommandHandler<ScanLibraryCommand, Result<MediaLibraryScanResponse>> scanLibraryCommandHandler)
|
||||
{
|
||||
_scanLibraryCommandHandler = scanLibraryCommandHandler;
|
||||
}
|
||||
@@ -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 _scanLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<MediaLibraryScanResponse> result = await _scanLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.UpdateLibrar
|
||||
/// </summary>
|
||||
public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<UpdateLibraryCommand, ErrorOr<LibraryResponse>> _updateLibraryCommandHandler;
|
||||
private readonly ICommandHandler<UpdateLibraryCommand, Result<LibraryResponse>> _updateLibraryCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateLibraryEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateLibraryCommandHandler">Injected service for handling update library commands.</param>
|
||||
public UpdateLibraryEndpoint(ICommandHandler<UpdateLibraryCommand, ErrorOr<LibraryResponse>> updateLibraryCommandHandler)
|
||||
public UpdateLibraryEndpoint(ICommandHandler<UpdateLibraryCommand, Result<LibraryResponse>> updateLibraryCommandHandler)
|
||||
{
|
||||
_updateLibraryCommandHandler = updateLibraryCommandHandler;
|
||||
}
|
||||
@@ -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 _updateLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<LibraryResponse> result = await _updateLibraryCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.B
|
||||
/// </summary>
|
||||
public class AddBookEndpoint : BaseEndpoint<AddBookRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<AddBookCommand, ErrorOr<BookResponse>> _addBookCommandHandler;
|
||||
private readonly ICommandHandler<AddBookCommand, Result<BookResponse>> _addBookCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddBookEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="addBookCommandHandler">Injected service for handling add book commands.</param>
|
||||
public AddBookEndpoint(ICommandHandler<AddBookCommand, ErrorOr<BookResponse>> addBookCommandHandler)
|
||||
public AddBookEndpoint(ICommandHandler<AddBookCommand, Result<BookResponse>> addBookCommandHandler)
|
||||
{
|
||||
_addBookCommandHandler = addBookCommandHandler;
|
||||
}
|
||||
@@ -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 _addBookCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<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
-1
@@ -33,7 +33,7 @@ public class GetBookEndpoint : BaseEndpoint<GetBookRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetBookRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
//ErrorOr<Book> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
//Result<Book> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
//return result.Match(success => TypedResults.CreatedAtRoute($"/api/v1/books/{success.Id}", success), Problem);
|
||||
return await Task.FromResult(TypedResults.Ok());
|
||||
}
|
||||
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.B
|
||||
/// </summary>
|
||||
public class GetBooksEndpoint : BaseEndpoint<GetBooksRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetBooksQuery, ErrorOr<IEnumerable<BookResponse>>> _getBooksQueryHandler;
|
||||
private readonly IQueryHandler<GetBooksQuery, Result<IEnumerable<BookResponse>>> _getBooksQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetBooksEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getBooksQueryHandler">Injected service for handling get books queries.</param>
|
||||
public GetBooksEndpoint(IQueryHandler<GetBooksQuery, ErrorOr<IEnumerable<BookResponse>>> getBooksQueryHandler)
|
||||
public GetBooksEndpoint(IQueryHandler<GetBooksQuery, Result<IEnumerable<BookResponse>>> getBooksQueryHandler)
|
||||
{
|
||||
_getBooksQueryHandler = getBooksQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetBooksEndpoint : BaseEndpoint<GetBooksRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Books.GET_BOOKS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,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 _getBooksQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<BookResponse>> result = await _getBooksQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,15 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Contracts.Requests.Authentication;
|
||||
using Lumina.Contracts.Responses.Authentication;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Maintenance;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Lumina.Presentation.Api.Common.Routes.Maintenance;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance.ApplicationSetup;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance.ApplicationSetup;
|
||||
/// </summary>
|
||||
public class SetupApplicationEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<SetupApplicationCommand, ErrorOr<RegistrationResponse>> _setupApplicationCommandHandler;
|
||||
private readonly ICommandHandler<SetupApplicationCommand, Result<RegistrationResponse>> _setupApplicationCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetupApplicationEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="setupApplicationCommandHandler">Injected service for handling setup application commands.</param>
|
||||
public SetupApplicationEndpoint(ICommandHandler<SetupApplicationCommand, ErrorOr<RegistrationResponse>> setupApplicationCommandHandler)
|
||||
public SetupApplicationEndpoint(ICommandHandler<SetupApplicationCommand, Result<RegistrationResponse>> setupApplicationCommandHandler)
|
||||
{
|
||||
_setupApplicationCommandHandler = setupApplicationCommandHandler;
|
||||
}
|
||||
@@ -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 _setupApplicationCommandHandler.HandleAsync(request.ToSetupCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<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);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.GetLibraryMetadataProvi
|
||||
/// </summary>
|
||||
public class GetLibraryMetadataProvidersEndpoint : BaseEndpoint<GetLibraryMetadataProvidersRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetLibraryMetadataProvidersQuery, ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>>> _getLibraryMetadataProvidersQueryHandler;
|
||||
private readonly IQueryHandler<GetLibraryMetadataProvidersQuery, Result<IReadOnlyList<LibraryMetadataProviderResponse>>> _getLibraryMetadataProvidersQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibraryMetadataProvidersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getLibraryMetadataProvidersQueryHandler">Injected service for handling get library metadata providers queries.</param>
|
||||
public GetLibraryMetadataProvidersEndpoint(IQueryHandler<GetLibraryMetadataProvidersQuery, ErrorOr<IReadOnlyList<LibraryMetadataProviderResponse>>> getLibraryMetadataProvidersQueryHandler)
|
||||
public GetLibraryMetadataProvidersEndpoint(IQueryHandler<GetLibraryMetadataProvidersQuery, Result<IReadOnlyList<LibraryMetadataProviderResponse>>> getLibraryMetadataProvidersQueryHandler)
|
||||
{
|
||||
_getLibraryMetadataProvidersQueryHandler = getLibraryMetadataProvidersQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetLibraryMetadataProvidersEndpoint : BaseEndpoint<GetLibraryMetada
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Libraries.GET_LIBRARY_METADATA_PROVIDERS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,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 _getLibraryMetadataProvidersQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IReadOnlyList<LibraryMetadataProviderResponse>> result = await _getLibraryMetadataProvidersQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,10 +1,11 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.GetPluginSettings;
|
||||
/// </summary>
|
||||
public class GetPluginSettingsEndpoint : BaseEndpoint<GetPluginSettingsRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetPluginSettingsQuery, ErrorOr<PluginSettingsResponse>> _getPluginSettingsQueryHandler;
|
||||
private readonly IQueryHandler<GetPluginSettingsQuery, Result<PluginSettingsResponse>> _getPluginSettingsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPluginSettingsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getPluginSettingsQueryHandler">Injected service for handling get plugin settings queries.</param>
|
||||
public GetPluginSettingsEndpoint(IQueryHandler<GetPluginSettingsQuery, ErrorOr<PluginSettingsResponse>> getPluginSettingsQueryHandler)
|
||||
public GetPluginSettingsEndpoint(IQueryHandler<GetPluginSettingsQuery, Result<PluginSettingsResponse>> getPluginSettingsQueryHandler)
|
||||
{
|
||||
_getPluginSettingsQueryHandler = getPluginSettingsQueryHandler;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class GetPluginSettingsEndpoint : BaseEndpoint<GetPluginSettingsRequest,
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Plugins.GET_PLUGIN_SETTINGS);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -48,7 +49,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 _getPluginSettingsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<PluginSettingsResponse> result = await _getPluginSettingsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.Plugins.Queries.GetPlugins;
|
||||
using Lumina.Contracts.Responses.Plugins;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.GetPlugins;
|
||||
/// </summary>
|
||||
public class GetPluginsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetPluginsQuery, ErrorOr<IReadOnlyList<PluginResponse>>> _getPluginsQueryHandler;
|
||||
private readonly IQueryHandler<GetPluginsQuery, Result<IReadOnlyList<PluginResponse>>> _getPluginsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPluginsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getPluginsQueryHandler">Injected service for handling get plugins queries.</param>
|
||||
public GetPluginsEndpoint(IQueryHandler<GetPluginsQuery, ErrorOr<IReadOnlyList<PluginResponse>>> getPluginsQueryHandler)
|
||||
public GetPluginsEndpoint(IQueryHandler<GetPluginsQuery, Result<IReadOnlyList<PluginResponse>>> getPluginsQueryHandler)
|
||||
{
|
||||
_getPluginsQueryHandler = getPluginsQueryHandler;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class GetPluginsEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(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 _getPluginsQueryHandler.HandleAsync(new GetPluginsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IReadOnlyList<PluginResponse>> result = await _getPluginsQueryHandler.HandleAsync(new GetPluginsQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.ReorderLibraryMetadataP
|
||||
/// </summary>
|
||||
public class ReorderLibraryMetadataProvidersEndpoint : BaseEndpoint<ReorderLibraryMetadataProvidersRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<ReorderLibraryMetadataProvidersCommand, ErrorOr<Success>> _reorderLibraryMetadataProvidersCommandHandler;
|
||||
private readonly ICommandHandler<ReorderLibraryMetadataProvidersCommand, Result<Success>> _reorderLibraryMetadataProvidersCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReorderLibraryMetadataProvidersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="reorderLibraryMetadataProvidersCommandHandler">Injected service for handling reorder library metadata providers commands.</param>
|
||||
public ReorderLibraryMetadataProvidersEndpoint(ICommandHandler<ReorderLibraryMetadataProvidersCommand, ErrorOr<Success>> reorderLibraryMetadataProvidersCommandHandler)
|
||||
public ReorderLibraryMetadataProvidersEndpoint(ICommandHandler<ReorderLibraryMetadataProvidersCommand, Result<Success>> reorderLibraryMetadataProvidersCommandHandler)
|
||||
{
|
||||
_reorderLibraryMetadataProvidersCommandHandler = reorderLibraryMetadataProvidersCommandHandler;
|
||||
}
|
||||
@@ -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 _reorderLibraryMetadataProvidersCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Success> result = await _reorderLibraryMetadataProvidersCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Library.Management;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.SetLibraryMetadataProvi
|
||||
/// </summary>
|
||||
public class SetLibraryMetadataProviderEnabledEndpoint : BaseEndpoint<SetLibraryMetadataProviderEnabledRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<SetLibraryMetadataProviderEnabledCommand, ErrorOr<Success>> _setLibraryMetadataProviderEnabledCommandHandler;
|
||||
private readonly ICommandHandler<SetLibraryMetadataProviderEnabledCommand, Result<Success>> _setLibraryMetadataProviderEnabledCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetLibraryMetadataProviderEnabledEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="setLibraryMetadataProviderEnabledCommandHandler">Injected service for handling set library metadata provider enabled commands.</param>
|
||||
public SetLibraryMetadataProviderEnabledEndpoint(ICommandHandler<SetLibraryMetadataProviderEnabledCommand, ErrorOr<Success>> setLibraryMetadataProviderEnabledCommandHandler)
|
||||
public SetLibraryMetadataProviderEnabledEndpoint(ICommandHandler<SetLibraryMetadataProviderEnabledCommand, Result<Success>> setLibraryMetadataProviderEnabledCommandHandler)
|
||||
{
|
||||
_setLibraryMetadataProviderEnabledCommandHandler = setLibraryMetadataProviderEnabledCommandHandler;
|
||||
}
|
||||
@@ -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 _setLibraryMetadataProviderEnabledCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Success> result = await _setLibraryMetadataProviderEnabledCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.Plugins;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -18,13 +18,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.Plugins.UpdatePluginSettings;
|
||||
/// </summary>
|
||||
public class UpdatePluginSettingsEndpoint : BaseEndpoint<UpdatePluginSettingsRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<UpdatePluginSettingsCommand, ErrorOr<Success>> _updatePluginSettingsCommandHandler;
|
||||
private readonly ICommandHandler<UpdatePluginSettingsCommand, Result<Success>> _updatePluginSettingsCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdatePluginSettingsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updatePluginSettingsCommandHandler">Injected service for handling update plugin settings commands.</param>
|
||||
public UpdatePluginSettingsEndpoint(ICommandHandler<UpdatePluginSettingsCommand, ErrorOr<Success>> updatePluginSettingsCommandHandler)
|
||||
public UpdatePluginSettingsEndpoint(ICommandHandler<UpdatePluginSettingsCommand, Result<Success>> updatePluginSettingsCommandHandler)
|
||||
{
|
||||
_updatePluginSettingsCommandHandler = updatePluginSettingsCommandHandler;
|
||||
}
|
||||
@@ -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 _updatePluginSettingsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<Success> result = await _updatePluginSettingsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class ChangePasswordEndpoint : BaseEndpoint<ChangePasswordRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<ChangePasswordCommand, ErrorOr<ChangePasswordResponse>> _changePasswordCommandHandler;
|
||||
private readonly ICommandHandler<ChangePasswordCommand, Result<ChangePasswordResponse>> _changePasswordCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChangePasswordEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="changePasswordCommandHandler">Injected service for handling change password commands.</param>
|
||||
public ChangePasswordEndpoint(ICommandHandler<ChangePasswordCommand, ErrorOr<ChangePasswordResponse>> changePasswordCommandHandler)
|
||||
public ChangePasswordEndpoint(ICommandHandler<ChangePasswordCommand, Result<ChangePasswordResponse>> changePasswordCommandHandler)
|
||||
{
|
||||
_changePasswordCommandHandler = changePasswordCommandHandler;
|
||||
}
|
||||
@@ -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 _changePasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<ChangePasswordResponse> result = await _changePasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class GetUsersEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetUsersQuery, ErrorOr<IEnumerable<UserResponse>>> _getUsersQueryHandler;
|
||||
private readonly IQueryHandler<GetUsersQuery, Result<IEnumerable<UserResponse>>> _getUsersQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUsersEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getUsersQueryHandler">Injected service for handling get users queries.</param>
|
||||
public GetUsersEndpoint(IQueryHandler<GetUsersQuery, ErrorOr<IEnumerable<UserResponse>>> getUsersQueryHandler)
|
||||
public GetUsersEndpoint(IQueryHandler<GetUsersQuery, Result<IEnumerable<UserResponse>>> getUsersQueryHandler)
|
||||
{
|
||||
_getUsersQueryHandler = getUsersQueryHandler;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class GetUsersEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(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 _getUsersQueryHandler.HandleAsync(new GetUsersQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<UserResponse>> result = await _getUsersQueryHandler.HandleAsync(new GetUsersQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -1,17 +1,15 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -23,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class LoginEndpoint : BaseEndpoint<LoginRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<LoginUserQuery, ErrorOr<LoginResponse>> _loginQueryHandler;
|
||||
private readonly IQueryHandler<LoginUserQuery, Result<LoginResponse>> _loginQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LoginEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="loginQueryHandler">Injected service for handling login queries.</param>
|
||||
public LoginEndpoint(IQueryHandler<LoginUserQuery, ErrorOr<LoginResponse>> loginQueryHandler)
|
||||
public LoginEndpoint(IQueryHandler<LoginUserQuery, Result<LoginResponse>> loginQueryHandler)
|
||||
{
|
||||
_loginQueryHandler = loginQueryHandler;
|
||||
}
|
||||
@@ -39,7 +37,7 @@ public class LoginEndpoint : BaseEndpoint<LoginRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.POST);
|
||||
Verbs(Http.POST);
|
||||
Routes(ApiRoutes.Authentication.LOGIN_ACCOUNT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
@@ -54,7 +52,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 _loginQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<LoginResponse> result = await _loginQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -20,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class RecoverPasswordEndpoint : BaseEndpoint<RecoverPasswordRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<RecoverPasswordCommand, ErrorOr<RecoverPasswordResponse>> _recoverPasswordCommandHandler;
|
||||
private readonly ICommandHandler<RecoverPasswordCommand, Result<RecoverPasswordResponse>> _recoverPasswordCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RecoverPasswordEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="recoverPasswordCommandHandler">Injected service for handling recover password commands.</param>
|
||||
public RecoverPasswordEndpoint(ICommandHandler<RecoverPasswordCommand, ErrorOr<RecoverPasswordResponse>> recoverPasswordCommandHandler)
|
||||
public RecoverPasswordEndpoint(ICommandHandler<RecoverPasswordCommand, Result<RecoverPasswordResponse>> recoverPasswordCommandHandler)
|
||||
{
|
||||
_recoverPasswordCommandHandler = recoverPasswordCommandHandler;
|
||||
}
|
||||
@@ -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 _recoverPasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<RecoverPasswordResponse> result = await _recoverPasswordCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -20,13 +20,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.
|
||||
/// </summary>
|
||||
public class RegisterEndpoint : BaseEndpoint<RegistrationRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<RegisterUserCommand, ErrorOr<RegistrationResponse>> _registerUserCommandHandler;
|
||||
private readonly ICommandHandler<RegisterUserCommand, Result<RegistrationResponse>> _registerUserCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RegisterEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="registerUserCommandHandler">Injected service for handling register user commands.</param>
|
||||
public RegisterEndpoint(ICommandHandler<RegisterUserCommand, ErrorOr<RegistrationResponse>> registerUserCommandHandler)
|
||||
public RegisterEndpoint(ICommandHandler<RegisterUserCommand, Result<RegistrationResponse>> registerUserCommandHandler)
|
||||
{
|
||||
_registerUserCommandHandler = registerUserCommandHandler;
|
||||
}
|
||||
@@ -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 _registerUserCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<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);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,11 +1,12 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -20,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetAuthorizationEndpoint : BaseEndpoint<GetAuthorizationRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetAuthorizationQuery, ErrorOr<AuthorizationResponse>> _getAuthorizationQueryHandler;
|
||||
private readonly IQueryHandler<GetAuthorizationQuery, Result<AuthorizationResponse>> _getAuthorizationQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetAuthorizationEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getAuthorizationQueryHandler">Injected service for handling get authorization queries.</param>
|
||||
public GetAuthorizationEndpoint(IQueryHandler<GetAuthorizationQuery, ErrorOr<AuthorizationResponse>> getAuthorizationQueryHandler)
|
||||
public GetAuthorizationEndpoint(IQueryHandler<GetAuthorizationQuery, Result<AuthorizationResponse>> getAuthorizationQueryHandler)
|
||||
{
|
||||
_getAuthorizationQueryHandler = getAuthorizationQueryHandler;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GetAuthorizationEndpoint : BaseEndpoint<GetAuthorizationRequest, IR
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_AUTHORIZATION);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -49,7 +50,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 _getAuthorizationQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<AuthorizationResponse> result = await _getAuthorizationQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,11 +1,12 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -21,13 +22,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetUserPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> _getUserPermissionsQueryHandler;
|
||||
private readonly IQueryHandler<GetUserPermissionsQuery, Result<IEnumerable<PermissionResponse>>> _getUserPermissionsQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getUserPermissionsQueryHandler">Injected service for handling get user permissions queries.</param>
|
||||
public GetUserPermissionsEndpoint(IQueryHandler<GetUserPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>> getUserPermissionsQueryHandler)
|
||||
public GetUserPermissionsEndpoint(IQueryHandler<GetUserPermissionsQuery, Result<IEnumerable<PermissionResponse>>> getUserPermissionsQueryHandler)
|
||||
{
|
||||
_getUserPermissionsQueryHandler = getUserPermissionsQueryHandler;
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_USER_PERMISSIONS_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
@@ -50,7 +51,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 _getUserPermissionsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<IEnumerable<PermissionResponse>> result = await _getUserPermissionsQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,15 +1,15 @@
|
||||
#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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -21,13 +21,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.G
|
||||
/// </summary>
|
||||
public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
{
|
||||
private readonly IQueryHandler<GetUserRoleQuery, ErrorOr<RoleResponse?>> _getUserRoleQueryHandler;
|
||||
private readonly IQueryHandler<GetUserRoleQuery, Result<RoleResponse?>> _getUserRoleQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="getUserRoleQueryHandler">Injected service for handling get user role queries.</param>
|
||||
public GetUserRoleEndpoint(IQueryHandler<GetUserRoleQuery, ErrorOr<RoleResponse?>> getUserRoleQueryHandler)
|
||||
public GetUserRoleEndpoint(IQueryHandler<GetUserRoleQuery, Result<RoleResponse?>> getUserRoleQueryHandler)
|
||||
{
|
||||
_getUserRoleQueryHandler = getUserRoleQueryHandler;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(FastEndpoints.Http.GET);
|
||||
Verbs(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 _getUserRoleQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
Result<RoleResponse?> result = await _getUserRoleQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
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.Domain.Common.Primitives;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -19,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.U
|
||||
/// </summary>
|
||||
public class UpdateUserRoleAndPermissionsEndpoint : BaseEndpoint<UpdateUserRoleAndPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly ICommandHandler<UpdateUserRoleAndPermissionsCommand, ErrorOr<AuthorizationResponse>> _updateUserRoleAndPermissionsCommandHandler;
|
||||
private readonly ICommandHandler<UpdateUserRoleAndPermissionsCommand, Result<AuthorizationResponse>> _updateUserRoleAndPermissionsCommandHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateUserRoleAndPermissionsCommandHandler">Injected service for handling update user role and permissions commands.</param>
|
||||
public UpdateUserRoleAndPermissionsEndpoint(ICommandHandler<UpdateUserRoleAndPermissionsCommand, ErrorOr<AuthorizationResponse>> updateUserRoleAndPermissionsCommandHandler)
|
||||
public UpdateUserRoleAndPermissionsEndpoint(ICommandHandler<UpdateUserRoleAndPermissionsCommand, Result<AuthorizationResponse>> updateUserRoleAndPermissionsCommandHandler)
|
||||
{
|
||||
_updateUserRoleAndPermissionsCommandHandler = updateUserRoleAndPermissionsCommandHandler;
|
||||
}
|
||||
@@ -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 _updateUserRoleAndPermissionsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
Result<AuthorizationResponse> result = await _updateUserRoleAndPermissionsCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.DependencyInjection;
|
||||
using Lumina.DataAccess.Common.DependencyInjection;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Domain.Common.DependencyInjection;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Infrastructure.Common.DependencyInjection;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Progress;
|
||||
@@ -151,8 +151,8 @@ public class Program
|
||||
{
|
||||
IServiceProvider services = scope.ServiceProvider;
|
||||
IFileSystemStructureSeedService context = services.GetRequiredService<IFileSystemStructureSeedService>();
|
||||
ErrorOr<Created> setDefaultDirectoriesResult = context.SetDefaultDirectories(mediaRootPath);
|
||||
if (setDefaultDirectoriesResult.IsError)
|
||||
Result<Created> setDefaultDirectoriesResult = context.SetDefaultDirectories(mediaRootPath);
|
||||
if (setDefaultDirectoriesResult.IsFailure)
|
||||
throw new InvalidOperationException("Could not create default file system directories structure: " + setDefaultDirectoriesResult.FirstError.Description);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user