diff --git a/src/Lumina.Contracts/Requests/Authentication/ChangePasswordRequest.cs b/src/Lumina.Contracts/Requests/Authentication/ChangePasswordRequest.cs
index 0f75f0b3..e6cf4dc8 100644
--- a/src/Lumina.Contracts/Requests/Authentication/ChangePasswordRequest.cs
+++ b/src/Lumina.Contracts/Requests/Authentication/ChangePasswordRequest.cs
@@ -1,3 +1,7 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
namespace Lumina.Contracts.Requests.Authentication;
///
@@ -7,6 +11,7 @@ namespace Lumina.Contracts.Requests.Authentication;
/// The current password of the account. Required.
/// The new password of the account. Required.
/// The confirmation of the new password of the account. Required.
+[DebuggerDisplay("Username: {Username}")]
public record ChangePasswordRequest(
string? Username,
string? CurrentPassword,
diff --git a/src/Lumina.Contracts/Requests/Authorization/GetUserPermissionsRequest.cs b/src/Lumina.Contracts/Requests/Authorization/GetUserPermissionsRequest.cs
index c7fa452b..5a0b894f 100644
--- a/src/Lumina.Contracts/Requests/Authorization/GetUserPermissionsRequest.cs
+++ b/src/Lumina.Contracts/Requests/Authorization/GetUserPermissionsRequest.cs
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using System;
+using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Authorization;
@@ -8,6 +9,7 @@ namespace Lumina.Contracts.Requests.Authorization;
/// Represents the request model for retrieving the authorization permissions of a user identified by .
///
/// The unique identifier of the user for whom to get the authorization permissions. Required.
+[DebuggerDisplay("UserId: {UserId}")]
public record GetUserPermissionsRequest(
Guid? UserId
);
diff --git a/src/Lumina.Contracts/Requests/Authorization/GetUserRoleRequest.cs b/src/Lumina.Contracts/Requests/Authorization/GetUserRoleRequest.cs
index fbb2faf2..3aa541af 100644
--- a/src/Lumina.Contracts/Requests/Authorization/GetUserRoleRequest.cs
+++ b/src/Lumina.Contracts/Requests/Authorization/GetUserRoleRequest.cs
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using System;
+using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Authorization;
@@ -8,6 +9,7 @@ namespace Lumina.Contracts.Requests.Authorization;
/// Represents the request model for retrieving the authorization role of a user identified by .
///
/// The unique identifier of the user for whom to get the authorization role. Required.
+[DebuggerDisplay("UserId: {UserId}")]
public record GetUserRoleRequest(
Guid? UserId
);
diff --git a/src/Lumina.Contracts/Requests/FileSystemManagement/Path/GetPathParentRequest.cs b/src/Lumina.Contracts/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
index 38538c11..23503311 100644
--- a/src/Lumina.Contracts/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
+++ b/src/Lumina.Contracts/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
@@ -6,9 +6,9 @@ using System.Text.Json.Serialization;
namespace Lumina.Contracts.Requests.FileSystemManagement.Path;
///
-/// Represents a request to get the root of a file system path.
+/// Represents the request for retrieving the parent path of a file system path.
///
-/// The file system path for which to get the root. Required.
+/// The path for which the parent path is retrieved.
[DebuggerDisplay("Path: {Path}")]
public record GetPathParentRequest(
string? Path
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs
index 8d0bd33a..f2989736 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs
@@ -42,7 +42,7 @@ public class AddRoleEndpoint : BaseEndpoint
}
///
- /// Creates a new authorization role.
+ /// Adds a new authorization role.
///
/// The request containing the authorization role to be created.
/// Cancellation token that can be used to stop the execution.
diff --git a/src/Lumina.Presentation.Web/Common/Api/ApiHttpClient.cs b/src/Lumina.Presentation.Web/Common/Api/ApiHttpClient.cs
index 350dce6b..f0651b05 100644
--- a/src/Lumina.Presentation.Web/Common/Api/ApiHttpClient.cs
+++ b/src/Lumina.Presentation.Web/Common/Api/ApiHttpClient.cs
@@ -1,8 +1,8 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.DTO.Configuration;
+using Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
using Lumina.Presentation.Web.Common.Exceptions;
-using Lumina.Presentation.Web.Common.Models.Common;
-using Lumina.Presentation.Web.Common.Models.Configuration;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using System;
@@ -35,13 +35,13 @@ public class ApiHttpClient : IApiHttpClient
/// Injected HttpClient for interacting with the API.
/// Injected service for providing the current HTTP context.
/// Injected server configuration application settings.
- public ApiHttpClient(HttpClient httpClient, IHttpContextAccessor httpContextAccessor, IOptionsSnapshot serverConfigurationOptions)
+ public ApiHttpClient(HttpClient httpClient, IHttpContextAccessor httpContextAccessor, IOptionsSnapshot serverConfigurationOptions)
{
_httpClient = httpClient;
_httpContext = httpContextAccessor.HttpContext;
// read the API server configuration values from the configuration, and assign them to the injected client
- ServerConfigurationModel serverConfigurationModel = serverConfigurationOptions.Value;
- httpClient.BaseAddress = new Uri($"{serverConfigurationModel.BaseAddress}:{serverConfigurationModel.Port}/api/v{serverConfigurationModel.ApiVersion}/");
+ ServerConfigurationDto serverConfiguration = serverConfigurationOptions.Value;
+ httpClient.BaseAddress = new Uri($"{serverConfiguration.BaseAddress}:{serverConfiguration.Port}/api/v{serverConfiguration.ApiVersion}/");
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
@@ -101,7 +101,7 @@ public class ApiHttpClient : IApiHttpClient
/// The API endpoint where the request is being sent.
/// Cancellation token that can be used to stop the execution.
/// A model containing the deserialized blob.
- public async Task GetBlobAsync(string endpoint, CancellationToken cancellationToken = default)
+ public async Task GetBlobAsync(string endpoint, CancellationToken cancellationToken = default)
{
using HttpRequestMessage request = new(HttpMethod.Get, endpoint);
AuthenticationHeaderValue? authenticationHeader = GetAuthenticationHeader();
@@ -112,10 +112,10 @@ public class ApiHttpClient : IApiHttpClient
{
// read the content as a string, for error messages
string content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- ProblemDetailsModel? problemDetails = null;
+ ProblemDetailsDto? problemDetails = null;
try
{
- problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
+ problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
}
catch { /* if we can't deserialize to ProblemDetails, we'll just use the status code */ }
throw new ApiException(problemDetails, response.StatusCode);
@@ -123,7 +123,7 @@ public class ApiHttpClient : IApiHttpClient
// if the response is successful, read it as a byte array
byte[] responseContent = await response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false);
string contentType = response.Content.Headers.ContentType?.ToString() ?? "application/octet-stream";
- return new BlobDataModel { Data = responseContent, ContentType = contentType };
+ return new BlobDataDto { Data = responseContent, ContentType = contentType };
}
///
@@ -142,12 +142,12 @@ public class ApiHttpClient : IApiHttpClient
HttpResponseMessage response = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
if (!response.IsSuccessStatusCode)
{
- ProblemDetailsModel? problemDetails = null;
+ ProblemDetailsDto? problemDetails = null;
string content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- // attempt to deserialize the response content to ProblemDetailsModel if the request fails
+ // attempt to deserialize the response content to ProblemDetailsDto if the request fails
try
{
- problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
+ problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
}
catch { /* if we can't deserialize to ProblemDetails, we'll just use the status code */ }
throw new ApiException(problemDetails, response.StatusCode, request.RequestUri?.AbsolutePath);
@@ -194,13 +194,13 @@ public class ApiHttpClient : IApiHttpClient
///
/// Sends an HTTP request and deserializes the response into the specified type if the request is successful.
- /// If the request fails, it attempts to deserialize the response content into a and throws an .
+ /// If the request fails, it attempts to deserialize the response content into a and throws an .
///
/// The expected type of the response content.
/// The to be sent.
/// Cancellation token that can be used to stop the execution.
/// The deserialized response content as an object of type .
- /// Thrown if the response is not successful, with the if available.
+ /// Thrown if the response is not successful, with the if available.
private async Task SendRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
// send the HTTP request and read the response
@@ -216,11 +216,11 @@ public class ApiHttpClient : IApiHttpClient
}
else
{
- ProblemDetailsModel? problemDetails = null;
- // attempt to deserialize the response content to ProblemDetailsModel if the request fails
+ ProblemDetailsDto? problemDetails = null;
+ // attempt to deserialize the response content to ProblemDetailsDto if the request fails
try
{
- problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
+ problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
}
catch { /* if we can't deserialize to ProblemDetails, we'll just use the status code */ }
throw new ApiException(problemDetails, response.StatusCode, request.RequestUri?.AbsolutePath);
diff --git a/src/Lumina.Presentation.Web/Common/Api/IApiHttpClient.cs b/src/Lumina.Presentation.Web/Common/Api/IApiHttpClient.cs
index 86a1e71d..cfbb30ad 100644
--- a/src/Lumina.Presentation.Web/Common/Api/IApiHttpClient.cs
+++ b/src/Lumina.Presentation.Web/Common/Api/IApiHttpClient.cs
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
+using Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -36,7 +36,7 @@ public interface IApiHttpClient
/// The API endpoint where the request is being sent.
/// Cancellation token that can be used to stop the execution.
/// A model containing the deserialized blob.
- Task GetBlobAsync(string endpoint, CancellationToken cancellationToken = default);
+ Task GetBlobAsync(string endpoint, CancellationToken cancellationToken = default);
///
/// Sends a DELETE request to the specified as an asynchronous operation.
diff --git a/src/Lumina.Presentation.Web/Common/Attributes/RequirePermissionAttribute.cs b/src/Lumina.Presentation.Web/Common/Attributes/RequirePermissionAttribute.cs
deleted file mode 100644
index 177ce393..00000000
--- a/src/Lumina.Presentation.Web/Common/Attributes/RequirePermissionAttribute.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Enums.Authorization;
-using Lumina.Presentation.Web.Common.Filters.TypeFilters;
-using Lumina.Presentation.Web.Common.Models.Authorization;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Attributes;
-
-///
-/// Attribute that restricts endpoint access to users with specified permissions.
-///
-///
-/// Can be applied to controllers or individual actions. Multiple permissions create an OR condition.
-///
-public class RequirePermissionAttribute : ApiAuthorizationAttribute
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// One or more permissions that are allowed to access the endpoint.
- public RequirePermissionAttribute(params AuthorizationPermission[] permissions) : base()
- {
- Arguments = [new AuthorizationRequirementModel { Permissions = permissions }];
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Attributes/RequirePolicyAttribute.cs b/src/Lumina.Presentation.Web/Common/Attributes/RequirePolicyAttribute.cs
deleted file mode 100644
index 549a01f7..00000000
--- a/src/Lumina.Presentation.Web/Common/Attributes/RequirePolicyAttribute.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Filters.TypeFilters;
-using Lumina.Presentation.Web.Common.Models.Authorization;
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Attributes;
-
-///
-/// Attribute that restricts endpoint access based on a custom authorization policy.
-///
-///
-/// Can be applied to controllers or individual actions.
-///
-public class RequirePolicyAttribute : ApiAuthorizationAttribute
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The type of the authorization policy to apply.
- public RequirePolicyAttribute(Type policyType) : base()
- {
- Arguments = [new AuthorizationRequirementModel { PolicyType = policyType }];
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Attributes/RequireRoleAttribute.cs b/src/Lumina.Presentation.Web/Common/Attributes/RequireRoleAttribute.cs
deleted file mode 100644
index 8221d78d..00000000
--- a/src/Lumina.Presentation.Web/Common/Attributes/RequireRoleAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Filters.TypeFilters;
-using Lumina.Presentation.Web.Common.Models.Authorization;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Attributes;
-
-///
-/// Attribute that restricts endpoint access to users with specified roles.
-///
-///
-/// Can be applied to controllers or individual actions. Multiple roles create an OR condition.
-///
-public class RequireRoleAttribute : ApiAuthorizationAttribute
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// One or more roles that are allowed to access the endpoint.
- public RequireRoleAttribute(params string[] roles) : base()
- {
- Arguments = [new AuthorizationRequirementModel { Roles = roles }];
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationPolicies.cs b/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationPolicies.cs
new file mode 100644
index 00000000..87034320
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationPolicies.cs
@@ -0,0 +1,11 @@
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// Contains the names of the authorization policies defined in the Web application.
+///
+public static class AuthorizationPolicies
+{
+ public const string REQUIRE_ADMIN_ROLE = "RequireAdminRole";
+ public const string REQUIRE_CREATE_LIBRARIES_PERMISSION = "RequireCreateLibrariesPermission";
+ public const string REQUIRE_INITIALIZATION = "RequireInitialization";
+}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationService.cs b/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationService.cs
index f6357404..0237af63 100644
--- a/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationService.cs
+++ b/src/Lumina.Presentation.Web/Common/Authorization/AuthorizationService.cs
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Enums.Authorization;
-using Lumina.Presentation.Web.Common.Models.Authorization;
+using Lumina.Presentation.Web.Common.Responses.Authorization;
using Microsoft.AspNetCore.Http;
using System;
using System.Linq;
@@ -55,42 +55,6 @@ public class AuthorizationService : IAuthorizationService
return authorization.Role == role;
}
- ///
- /// Evaluates whether the currently logged in user meets the conditions defined in the specified authorization policy.
- ///
- /// The type of authorization policy to evaluate.
- /// Cancellation token that can be used to stop the execution.
- /// if the currently logged in user satisfies the policy, otherwise.
- public Task EvaluatePolicyAsync(CancellationToken cancellationToken)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Evaluates whether the currently logged in user meets the conditions defined in the specified authorization requirement.
- ///
- /// The authorization requirements to check.
- /// if the currently logged in user satisfies the requirement, otherwise.
- public async Task EvaluateAuthorizationAsync(AuthorizationRequirementModel requirement)
- {
- GetAuthorizationResponse authorization = await GetUserAuthorizationAsync(CancellationToken.None);
-
- if (requirement.Roles?.Length > 0 && !requirement.Roles.Any(role => authorization.Role?.Contains(role) == true))
- return false;
-
- if (requirement.Permissions?.Length > 0 && !requirement.Permissions.Any(permission => authorization.Permissions.Contains(permission)))
- return false;
-
- //if (_requirement.PolicyType is not null)
- //{
- // bool response = await _apiHttpClient.PostAsync($"auth/evaluate-policy/{_requirement.PolicyType.Name}", null!);
- // if (!response)
- // return false;
- //}
-
- return true;
- }
-
///
/// Retrieves user authorization details from the authorization service.
///
@@ -98,8 +62,10 @@ public class AuthorizationService : IAuthorizationService
/// The user's authorization details.
private async Task GetUserAuthorizationAsync(CancellationToken cancellationToken)
{
- // get the id of the currently logged in user
- string userId = _httpContextAccessor.HttpContext!.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
- return await _apiHttpClient.GetAsync($"auth/get-authorization?userId={Uri.EscapeDataString(userId.ToString())}", cancellationToken);
+ // anonymous users and users without an identifier claim have no role or permissions, so deny without querying the API
+ string? userId = _httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
+ if (string.IsNullOrEmpty(userId))
+ return new GetAuthorizationResponse(Guid.Empty, string.Empty, []);
+ return await _apiHttpClient.GetAsync($"auth/get-authorization?userId={Uri.EscapeDataString(userId)}", cancellationToken);
}
}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/IAuthorizationService.cs b/src/Lumina.Presentation.Web/Common/Authorization/IAuthorizationService.cs
index 7a0481be..462ab82d 100644
--- a/src/Lumina.Presentation.Web/Common/Authorization/IAuthorizationService.cs
+++ b/src/Lumina.Presentation.Web/Common/Authorization/IAuthorizationService.cs
@@ -1,6 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Authorization;
-using Lumina.Presentation.Web.Common.Models.Authorization;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -27,19 +26,4 @@ public interface IAuthorizationService
/// Cancellation token that can be used to stop the execution.
/// if the currently logged in user is in the specified role, otherwise.
Task IsInRoleAsync(string role, CancellationToken cancellationToken);
-
- ///
- /// Evaluates whether the currently logged in user meets the conditions defined in the specified authorization policy.
- ///
- /// The type of authorization policy to evaluate.
- /// Cancellation token that can be used to stop the execution.
- /// if the currently logged in user satisfies the policy, otherwise.
- Task EvaluatePolicyAsync(CancellationToken cancellationToken);
-
- ///
- /// Evaluates whether the currently logged in user meets the conditions defined in the specified authorization requirement.
- ///
- /// The authorization requirements to check.
- /// if the currently logged in user satisfies the requirement, otherwise.
- Task EvaluateAuthorizationAsync(AuthorizationRequirementModel requirement);
}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/InitializationCheckPreProcessor.cs b/src/Lumina.Presentation.Web/Common/Authorization/InitializationCheckPreProcessor.cs
new file mode 100644
index 00000000..3e84c97d
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/InitializationCheckPreProcessor.cs
@@ -0,0 +1,32 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// FastEndpoints pre-processor that runs the application initialization check before the endpoint handler executes.
+///
+///
+/// The check runs the RequireInitialization authorization policy, which queries the remote API and records the pending super admin setup state in the session.
+/// Its result is deliberately ignored, because the pages that use this processor must be reachable both before and after the application is initialized.
+///
+/// The type of the request of the endpoint to which this pre-processor is applied.
+public class InitializationCheckPreProcessor : IPreProcessor where TRequest : notnull
+{
+ ///
+ /// Runs the initialization check for the current request.
+ ///
+ /// The pre-processor context for the current request.
+ /// Cancellation token that can be used to stop the execution.
+ public async Task PreProcessAsync(IPreProcessorContext preProcessorContext, CancellationToken cancellationToken)
+ {
+ HttpContext httpContext = preProcessorContext.HttpContext;
+ Microsoft.AspNetCore.Authorization.IAuthorizationService authorizationService = httpContext.RequestServices.GetRequiredService();
+ await authorizationService.AuthorizeAsync(httpContext.User, httpContext, AuthorizationPolicies.REQUIRE_INITIALIZATION).ConfigureAwait(false);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs b/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs
index 51dd850c..02788de9 100644
--- a/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs
+++ b/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Http;
-using Lumina.Presentation.Web.Common.Models.UsersManagement;
+using Lumina.Presentation.Web.Common.Responses.UsersManagement;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
@@ -28,17 +28,17 @@ public class InitializationHandler : AuthorizationHandler
/// Checks the application initialization status and authorizes the requirement if initialized.
///
- /// The authorization context.
- /// The initialization requirement to be evaluated.
- protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, InitializationRequirement requirement)
+ /// The authorization context.
+ /// The initialization requirement to be evaluated.
+ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext authorizationHandlerContext, InitializationRequirement initializationRequirement)
{
- InitializationModel result = await _apiHttpClient.GetAsync("initialization/").ConfigureAwait(false);
- HttpContext? httpContext = context.Resource as HttpContext;
+ InitializationResponse result = await _apiHttpClient.GetAsync("initialization/").ConfigureAwait(false);
+ HttpContext? httpContext = authorizationHandlerContext.Resource as HttpContext;
if (result.IsInitialized)
{
// admin account was registered, remove this requirement from the session
httpContext?.Session.Remove(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP);
- context.Succeed(requirement);
+ authorizationHandlerContext.Succeed(initializationRequirement);
}
else // store in session that super admin setup is needed
httpContext?.Session.SetString(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP, "true");
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/PermissionAuthorizationHandler.cs b/src/Lumina.Presentation.Web/Common/Authorization/PermissionAuthorizationHandler.cs
new file mode 100644
index 00000000..ce4b912b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/PermissionAuthorizationHandler.cs
@@ -0,0 +1,42 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Enums.Authorization;
+using Microsoft.AspNetCore.Authorization;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// Handles the by checking the currently logged in user's permissions against the remote API.
+///
+public class PermissionAuthorizationHandler : AuthorizationHandler
+{
+ private readonly IAuthorizationService _authorizationService;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for authorization checks against the remote API.
+ public PermissionAuthorizationHandler(IAuthorizationService authorizationService)
+ {
+ _authorizationService = authorizationService;
+ }
+
+ ///
+ /// Succeeds the requirement when the currently logged in user holds any of the required permissions.
+ ///
+ /// The authorization context.
+ /// The permission requirement to evaluate.
+ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext authorizationHandlerContext, PermissionRequirement permissionRequirement)
+ {
+ foreach (AuthorizationPermission permission in permissionRequirement.Permissions)
+ {
+ if (await _authorizationService.HasPermissionAsync(permission, CancellationToken.None).ConfigureAwait(false))
+ {
+ authorizationHandlerContext.Succeed(permissionRequirement);
+ return;
+ }
+ }
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/PermissionRequirement.cs b/src/Lumina.Presentation.Web/Common/Authorization/PermissionRequirement.cs
new file mode 100644
index 00000000..8eb80a9c
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/PermissionRequirement.cs
@@ -0,0 +1,26 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Enums.Authorization;
+using Microsoft.AspNetCore.Authorization;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// Defines a requirement that the user must hold at least one of the specified permissions.
+///
+public class PermissionRequirement : IAuthorizationRequirement
+{
+ ///
+ /// Gets the permissions that allow access, of which the user must hold at least one.
+ ///
+ public AuthorizationPermission[] Permissions { get; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The permissions that allow access.
+ public PermissionRequirement(params AuthorizationPermission[] permissions)
+ {
+ Permissions = permissions;
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/RoleAuthorizationHandler.cs b/src/Lumina.Presentation.Web/Common/Authorization/RoleAuthorizationHandler.cs
new file mode 100644
index 00000000..30657694
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/RoleAuthorizationHandler.cs
@@ -0,0 +1,42 @@
+#region ========================================================================= USING =====================================================================================
+using Microsoft.AspNetCore.Authorization;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// Handles the by checking the currently logged in user's role against the remote API.
+///
+public class RoleAuthorizationHandler : AuthorizationHandler
+{
+ private readonly IAuthorizationService _authorizationService;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for authorization checks against the remote API.
+ public RoleAuthorizationHandler(IAuthorizationService authorizationService)
+ {
+ _authorizationService = authorizationService;
+ }
+
+ ///
+ /// Succeeds the requirement when the currently logged in user belongs to any of the required roles.
+ ///
+ /// The authorization context.
+ /// The role requirement to evaluate.
+ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext authorizationHandlerContext, RoleRequirement roleRequirement)
+ {
+ foreach (string role in roleRequirement.Roles)
+ {
+ if (await _authorizationService.IsInRoleAsync(role, CancellationToken.None).ConfigureAwait(false))
+ {
+ authorizationHandlerContext.Succeed(roleRequirement);
+ return;
+ }
+ }
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Authorization/RoleRequirement.cs b/src/Lumina.Presentation.Web/Common/Authorization/RoleRequirement.cs
new file mode 100644
index 00000000..eb82ef3c
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Authorization/RoleRequirement.cs
@@ -0,0 +1,25 @@
+#region ========================================================================= USING =====================================================================================
+using Microsoft.AspNetCore.Authorization;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Authorization;
+
+///
+/// Defines a requirement that the user must belong to at least one of the specified roles.
+///
+public class RoleRequirement : IAuthorizationRequirement
+{
+ ///
+ /// Gets the roles that allow access, of which the user must belong to at least one.
+ ///
+ public string[] Roles { get; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The roles that allow access.
+ public RoleRequirement(params string[] roles)
+ {
+ Roles = roles;
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Authorization/PermissionDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Authorization/PermissionDto.cs
new file mode 100644
index 00000000..f2c78c77
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Authorization/PermissionDto.cs
@@ -0,0 +1,18 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Enums.Authorization;
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Authorization;
+
+///
+/// Data transfer object for an authorization permission.
+///
+/// The unique identifier of the permission.
+/// The name of the permission.
+[DebuggerDisplay("Id: {Id}, PermissionName: {PermissionName}")]
+public record PermissionDto(
+ Guid Id,
+ AuthorizationPermission PermissionName
+);
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Authorization/RoleDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Authorization/RoleDto.cs
new file mode 100644
index 00000000..d815d97f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Authorization/RoleDto.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Authorization;
+
+///
+/// Data transfer object for an authorization role.
+///
+/// The unique identifier of the role.
+/// The name of the role.
+[DebuggerDisplay("Id: {Id}, RoleName: {RoleName}")]
+public record RoleDto(
+ Guid Id,
+ string RoleName
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/RolePermissionsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Authorization/RolePermissionsDto.cs
similarity index 55%
rename from src/Lumina.Presentation.Web/Common/Models/Authorization/RolePermissionsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Authorization/RolePermissionsDto.cs
index ac0496e4..218bbb79 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/RolePermissionsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Authorization/RolePermissionsDto.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
+namespace Lumina.Presentation.Web.Common.DTO.Authorization;
///
-/// Represents a model for an authorization role with its permissions.
+/// Data transfer object for a model for an authorization role with its permissions.
///
/// The authorization role.
/// The permissions of the authorization role.
-public record RolePermissionsModel(
- RoleModel Role,
- PermissionModel[] Permissions
+[DebuggerDisplay("Role: {Role}")]
+public record RolePermissionsDto(
+ RoleDto Role,
+ PermissionDto[] Permissions
);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/UserPermissionsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Authorization/UserPermissionsDto.cs
similarity index 50%
rename from src/Lumina.Presentation.Web/Common/Models/Authorization/UserPermissionsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Authorization/UserPermissionsDto.cs
index 71f0e249..1dc5a417 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/UserPermissionsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Authorization/UserPermissionsDto.cs
@@ -1,15 +1,17 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.UsersManagement;
+using Lumina.Presentation.Web.Common.DTO.UsersManagement;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
+namespace Lumina.Presentation.Web.Common.DTO.Authorization;
///
-/// Represents a model for a user with its authorization permissions.
+/// Data transfer object for a user with its authorization permissions.
///
/// The user.
/// The authorization permissions of the user.
-public record UserPermissionsModel(
- UserModel User,
- PermissionModel[] Permissions
+[DebuggerDisplay("User: {User}")]
+public record UserPermissionsDto(
+ UserDto User,
+ PermissionDto[] Permissions
);
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/ErrorViewDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/ErrorViewDto.cs
new file mode 100644
index 00000000..2790c5b0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/ErrorViewDto.cs
@@ -0,0 +1,20 @@
+using System.Diagnostics;
+
+namespace Lumina.Presentation.Web.Common.DTO.Common;
+
+///
+/// Data transfer object for the data shown on the error page.
+///
+[DebuggerDisplay("RequestId: {RequestId}, ShowRequestId: {ShowRequestId}")]
+public class ErrorViewDto
+{
+ ///
+ /// Gets or sets the request identifier to display.
+ ///
+ public string? RequestId { get; set; }
+
+ ///
+ /// Gets a value indicating whether the request identifier should be shown.
+ ///
+ public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/GenreModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/GenreDto.cs
similarity index 74%
rename from src/Lumina.Presentation.Web/Common/Models/Common/GenreModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/GenreDto.cs
index 720293c9..5bda54a8 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/GenreModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/GenreDto.cs
@@ -2,16 +2,16 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Represents a request to get genre information.
+/// Data transfer object for a request to get genre information.
///
[DebuggerDisplay("{Name}")]
-public class GenreModel
+public class GenreDto
{
///
/// Gets the name of the genre element of the media item.
///
public string? Name { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/LanguageInfoModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/LanguageInfoDto.cs
similarity index 81%
rename from src/Lumina.Presentation.Web/Common/Models/Common/LanguageInfoModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/LanguageInfoDto.cs
index b37f37fa..9d2689a4 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/LanguageInfoModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/LanguageInfoDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Represents a request to get language information.
+/// Data transfer object for a request to get language information.
///
[DebuggerDisplay("{LanguageName}")]
-public class LanguageInfoModel
+public class LanguageInfoDto
{
///
/// Gets the ISO 639-1 two-letter language code.
@@ -24,4 +24,4 @@ public class LanguageInfoModel
/// Gets an optional native name of the language.
///
public string? NativeName { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/NotificationModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/NotificationDto.cs
similarity index 71%
rename from src/Lumina.Presentation.Web/Common/Models/Common/NotificationModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/NotificationDto.cs
index 1540d60a..3131e6e3 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/NotificationModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/NotificationDto.cs
@@ -1,17 +1,19 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Notifications;
using System;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Model for notifications.
+/// Data transfer object for notifications.
///
/// The id of the notification.
/// The message of the notification.
/// The type of the notification.
-public record struct NotificationModel(
+[DebuggerDisplay("Id: {Id}, Message: {Message}")]
+public record struct NotificationDto(
Guid Id,
string Message,
NotificationType Type
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/ProblemDetailsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/ProblemDetailsDto.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/Common/ProblemDetailsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/ProblemDetailsDto.cs
index 548d4d91..915399b4 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/ProblemDetailsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/ProblemDetailsDto.cs
@@ -1,17 +1,17 @@
-#region ========================================================================= USING =====================================================================================
+#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.Json;
using System.Text.Json.Serialization;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Model that follows the RFC 7807 standard for problem details in HTTP APIs.
+/// Data transfer object that follows the RFC 7807 standard for problem details in HTTP APIs.
///
[DebuggerDisplay("{Title} ({Status})")]
-public class ProblemDetailsModel
+public class ProblemDetailsDto
{
///
/// Gets or sets the URI reference that identifies the problem type.
@@ -49,4 +49,4 @@ public class ProblemDetailsModel
///
[JsonExtensionData]
public IDictionary? Extensions { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/RatingModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/RatingDto.cs
similarity index 77%
rename from src/Lumina.Presentation.Web/Common/Models/Common/RatingModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/RatingDto.cs
index f5058da3..a9202026 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/RatingModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/RatingDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Represents a rating.
+/// Data transfer object for a rating.
///
-[DebuggerDisplay("{Value}/{MaxValue}")]
-public abstract class RatingModel
+[DebuggerDisplay("Value: {Value}, MaxValue: {MaxValue}")]
+public abstract class RatingDto
{
///
/// Gets the numeric value of the rating.
@@ -24,4 +24,4 @@ public abstract class RatingModel
/// Gets the optional number of votes or reviews this rating is based on.
///
public int? VoteCount { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/ReleaseInfoModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/ReleaseInfoDto.cs
similarity index 85%
rename from src/Lumina.Presentation.Web/Common/Models/Common/ReleaseInfoModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/ReleaseInfoDto.cs
index 8aa2881d..9050347c 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/ReleaseInfoModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/ReleaseInfoDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Represents a request to get release information.
+/// Data transfer object for a request to get release information.
///
-[DebuggerDisplay("{OriginalReleaseDate}")]
-public class ReleaseInfoModel
+[DebuggerDisplay("OriginalReleaseDate: {OriginalReleaseDate}")]
+public class ReleaseInfoDto
{
///
/// Gets the optional original release date of the media item.
@@ -41,4 +41,4 @@ public class ReleaseInfoModel
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
///
public string? ReleaseVersion { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponse.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponse.cs
new file mode 100644
index 00000000..b776c4e1
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponse.cs
@@ -0,0 +1,13 @@
+#region ========================================================================= USING =====================================================================================
+using System.Text.Json.Serialization;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Common;
+
+///
+/// Response data transfer object for the JSON responses of the web application that do not carry a payload.
+///
+/// Whether the operation succeeded or not.
+public record SuccessResponse(
+ [property: JsonPropertyName("success")] bool Success
+);
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponseOfT.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponseOfT.cs
new file mode 100644
index 00000000..70e8e767
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/SuccessResponseOfT.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Text.Json.Serialization;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Common;
+
+///
+/// Response data transfer object for the JSON responses of the web application that carry a payload.
+///
+/// The type of the payload of the response.
+/// Whether the operation succeeded or not.
+/// The payload of the response.
+public record SuccessResponse(
+ [property: JsonPropertyName("success")] bool Success,
+ [property: JsonPropertyName("data")] TData? Data
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/TagModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/TagDto.cs
similarity index 68%
rename from src/Lumina.Presentation.Web/Common/Models/Common/TagModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Common/TagDto.cs
index d4df4e14..ebb1b0f2 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/TagModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/TagDto.cs
@@ -2,16 +2,16 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.DTO.Common;
///
-/// Represents a request to get tag information.
+/// Data transfer object for a request to get tag information.
///
-[DebuggerDisplay("{Name}")]
-public class TagModel
+[DebuggerDisplay("Name: {Name}")]
+public class TagDto
{
///
/// Gets the name of the tag element of the media item.
///
public string? Name { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Configuration/EncryptionSettingsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Configuration/EncryptionSettingsDto.cs
similarity index 69%
rename from src/Lumina.Presentation.Web/Common/Models/Configuration/EncryptionSettingsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Configuration/EncryptionSettingsDto.cs
index 7f8ebbbf..50c288b1 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Configuration/EncryptionSettingsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Configuration/EncryptionSettingsDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Configuration;
+namespace Lumina.Presentation.Web.Common.DTO.Configuration;
///
-/// Model for deserializing media settings.
+/// Data transfer object for deserializing media settings.
///
-[DebuggerDisplay("{SECTION_NAME}")]
-public class EncryptionSettingsModel
+[DebuggerDisplay("Section name: {SECTION_NAME}")]
+public class EncryptionSettingsDto
{
public const string SECTION_NAME = "EncryptionSettings";
diff --git a/src/Lumina.Presentation.Web/Common/Models/Configuration/ServerConfigurationModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Configuration/ServerConfigurationDto.cs
similarity index 76%
rename from src/Lumina.Presentation.Web/Common/Models/Configuration/ServerConfigurationModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Configuration/ServerConfigurationDto.cs
index 14810584..43dbc4f1 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Configuration/ServerConfigurationModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Configuration/ServerConfigurationDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Configuration;
+namespace Lumina.Presentation.Web.Common.DTO.Configuration;
///
-/// Model for deserializing server configuration settings.
+/// Data transfer object for deserializing server configuration settings.
///
-[DebuggerDisplay("{SECTION_NAME}")]
-public class ServerConfigurationModel
+[DebuggerDisplay("Section name: {SECTION_NAME}")]
+public class ServerConfigurationDto
{
public const string SECTION_NAME = "ServerConfiguration";
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/BlobDataModel.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/BlobDataDto.cs
similarity index 52%
rename from src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/BlobDataModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/BlobDataDto.cs
index 2811b0b4..d88611f4 100644
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/BlobDataModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/BlobDataDto.cs
@@ -1,14 +1,14 @@
-#region ========================================================================= USING =====================================================================================
+#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
///
-/// Represents a model for storing binary data (blob).
+/// Data transfer object for a model for storing binary data (blob).
///
-[DebuggerDisplay("{ContentType} (Data.Length)")]
-public class BlobDataModel
+[DebuggerDisplay("ContentType: {ContentType} (Data.Length)")]
+public class BlobDataDto
{
///
/// Gets or sets the binary data as a byte array.
@@ -19,4 +19,4 @@ public class BlobDataModel
/// Gets or sets the content type (MIME type) of the blob data, such as "image/png" for an image or "application/pdf" for a PDF document.
///
public string ContentType { get; set; } = null!;
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/DirectoryDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/DirectoryDto.cs
new file mode 100644
index 00000000..831c2ccb
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/DirectoryDto.cs
@@ -0,0 +1,18 @@
+#region ========================================================================= USING =====================================================================================
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object for directories displayed in custom directory/file browser dialogs.
+///
+[DebuggerDisplay("Path: {Path}")]
+public class DirectoryDto : FileSystemItemDto
+{
+ ///
+ /// Gets or sets the children items of the directory.
+ ///
+ public List Items { get; set; } = [];
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs
new file mode 100644
index 00000000..690451ea
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object for files displayed in custom directory/file browser dialogs.
+///
+[DebuggerDisplay("Path: {Path}")]
+public class FileDto : FileSystemItemDto
+{
+ ///
+ /// Gets or sets the size of the file, in bytes
+ ///
+ public long Size { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemItemModel.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemItemDto.cs
similarity index 60%
rename from src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemItemModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemItemDto.cs
index 4b2d334f..e5cad9fd 100644
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemItemModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemItemDto.cs
@@ -1,15 +1,15 @@
-#region ========================================================================= USING =====================================================================================
+#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
///
-/// Base model for files and directories displayed in custom directory/file browser dialogs.
+/// Base data transfer object for files and directories displayed in custom directory/file browser dialogs.
///
-[DebuggerDisplay("{Path}")]
-public abstract class FileSystemItemModel
+[DebuggerDisplay("Path: {Path}")]
+public abstract class FileSystemItemDto
{
///
/// Gets or sets the full path to the file system item.
@@ -30,4 +30,4 @@ public abstract class FileSystemItemModel
/// Gets or sets the modification date of the file system item.
///
public DateTime DateModified { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTreeNodeModel.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTreeNodeDto.cs
similarity index 70%
rename from src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTreeNodeModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTreeNodeDto.cs
index fec72137..1188fda8 100644
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTreeNodeModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTreeNodeDto.cs
@@ -1,16 +1,16 @@
-#region ========================================================================= USING =====================================================================================
+#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.FileSystem;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
///
-/// Generic file system node.
+/// Data transfer object for a file system node.
///
-[DebuggerDisplay("{Path}")]
-public class FileSystemTreeNodeModel
+[DebuggerDisplay("Path: {Path}")]
+public class FileSystemTreeNodeDto
{
///
/// Gets or sets the full path of the file or directory.
@@ -40,5 +40,5 @@ public class FileSystemTreeNodeModel
///
/// Gets or sets the list of child nodes.
///
- public List Children { get; set; } = [];
-}
\ No newline at end of file
+ public List Children { get; set; } = [];
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTypeDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTypeDto.cs
new file mode 100644
index 00000000..3f7e83b3
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileSystemTypeDto.cs
@@ -0,0 +1,18 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Enums.FileSystem;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object containing the file system platform type.
+/// `
+[DebuggerDisplay("PlatformType: {PlatformType}")]
+public class FileSystemTypeDto
+{
+ ///
+ /// Gets or sets the file system platform type.
+ ///
+ public PlatformType PlatformType { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathExistsDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathExistsDto.cs
new file mode 100644
index 00000000..ed2d13da
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathExistsDto.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object for a response to the inquiry about the existence of a file system path.
+///
+/// Whether a file system path exists or not.
+[DebuggerDisplay("Exists: {Exists}")]
+public record PathExistsDto(
+ bool Exists
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSegmentModel.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSegmentDto.cs
similarity index 64%
rename from src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSegmentModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSegmentDto.cs
index 82da26d3..12a5cdb9 100644
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSegmentModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSegmentDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
///
-/// Represents a response containing a file system path.
+/// Data transfer object for a response containing a file system path.
///
-[DebuggerDisplay("{Path}")]
-public class PathSegmentModel
+[DebuggerDisplay("Path: {Path}")]
+public class PathSegmentDto
{
///
/// Gets or sets the returned path.
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSeparatorDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSeparatorDto.cs
new file mode 100644
index 00000000..1db9134e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathSeparatorDto.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object for a file system path separator.
+///
+/// The system's path separator.
+[DebuggerDisplay("Separator: {Separator}")]
+public record PathSeparatorDto(
+ string Separator
+);
diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathValidDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathValidDto.cs
new file mode 100644
index 00000000..c29d4085
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/PathValidDto.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement;
+
+///
+/// Data transfer object for a response to the inquiry about the validity of a file system path.
+///
+/// Whether a file system path is valid or not.
+[DebuggerDisplay("IsValid: {IsValid}")]
+public record PathValidDto(
+ bool IsValid
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/BookLiteModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/BookLiteDto.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/BookLiteModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/BookLiteDto.cs
index ee124a74..091bd10e 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/BookLiteModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/BookLiteDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a lightweight book element, containing only the properties needed by the client for card-style navigation.
+/// Data transfer object for a lightweight book element, containing only the properties needed by the client for card-style navigation.
///
[DebuggerDisplay("Title: {Title}")]
-public class BookLiteModel
+public class BookLiteDto
{
///
/// Gets or sets the Id of the book.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryDto.cs
similarity index 94%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryDto.cs
index e52dfb97..bc43dad9 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryDto.cs
@@ -5,13 +5,13 @@ using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a library element.
+/// Data transfer object for a library element.
///
-[DebuggerDisplay("{Title}")]
-public class LibraryModel
+[DebuggerDisplay("Title: {Title}")]
+public class LibraryDto
{
///
/// Gets or sets the unique identifier of the media library.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanJobProgressModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanJobProgressDto.cs
similarity index 86%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanJobProgressModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanJobProgressDto.cs
index b961d4d9..bdf38653 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanJobProgressModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanJobProgressDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a media library scan job progress model.
+/// Data transfer object for a media library scan job progress model.
///
[DebuggerDisplay("CompletedItems: {CompletedItems}; TotalItems: {TotalItems}")]
-public class LibraryScanJobProgressModel
+public class LibraryScanJobProgressDto
{
///
/// Gets or sets the number of completed items of the media library scan job.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanProgressModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanProgressDto.cs
similarity index 87%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanProgressModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanProgressDto.cs
index d9a8462e..579a5cc4 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/LibraryScanProgressModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/LibraryScanProgressDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a media library scan progress model.
+/// Data transfer object for a media library scan progress model.
///
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}; LibraryId: {LibraryId}")]
-public class LibraryScanProgressModel
+public class LibraryScanProgressDto
{
///
/// Gets or sets the unique identifier of the media library scan.
@@ -39,7 +39,7 @@ public class LibraryScanProgressModel
///
/// Gets or sets the optional current job progress of the media library scan.
///
- public LibraryScanJobProgressModel? CurrentJobProgress { get; set; }
+ public LibraryScanJobProgressDto? CurrentJobProgress { get; set; }
///
/// Gets or sets the status of the media library scan.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/PaginatedBookLiteModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/PaginatedBookLiteDto.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/PaginatedBookLiteModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/PaginatedBookLiteDto.cs
index daed24fd..763276e0 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/PaginatedBookLiteModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/PaginatedBookLiteDto.cs
@@ -3,18 +3,18 @@ using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a paginated collection of lightweight book elements, together with pagination metadata.
+/// Data transfer object for a paginated collection of lightweight book elements, together with pagination metadata.
///
[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
-public class PaginatedBookLiteModel
+public class PaginatedBookLiteDto
{
///
/// Gets or sets the collection of lightweight book elements associated with this instance.
///
- public IReadOnlyList Data { get; set; } = [];
+ public IReadOnlyList Data { get; set; } = [];
///
/// Gets or sets the current page number in a paginated collection.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/ScanLibraryModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Libraries/ScanLibraryDto.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/ScanLibraryModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Libraries/ScanLibraryDto.cs
index eadddf2d..2f99ef7b 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/ScanLibraryModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Libraries/ScanLibraryDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.DTO.Libraries;
///
-/// Represents a media library scan response.
+/// Data transfer object for a media library scan response.
///
[DebuggerDisplay("ScanId: {ScanId} LibraryId: {LibraryId}")]
-public class ScanLibraryModel
+public class ScanLibraryDto
{
///
/// Gets or sets the Id of the media library scan.
diff --git a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorModel.cs b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs
similarity index 58%
rename from src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs
index c1e3a418..97587776 100644
--- a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs
@@ -2,21 +2,21 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
+namespace Lumina.Presentation.Web.Common.DTO.MediaContributors;
///
-/// Represents a media contributor.
+/// Data transfer object for a media contributor.
///
-[DebuggerDisplay("{Name}")]
-public class MediaContributorModel
+[DebuggerDisplay("Name: {Name}")]
+public class MediaContributorDto
{
///
/// Gets the name of the contributor.
///
- public MediaContributorNameModel? Name { get; set; }
+ public MediaContributorNameDto? Name { get; set; }
///
/// Gets the role of the contributor.
///
- public MediaContributorRoleModel? Role { get; set; }
+ public MediaContributorRoleDto? Role { get; set; }
}
diff --git a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorNameModel.cs b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs
similarity index 71%
rename from src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorNameModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs
index 37b211c4..23831e71 100644
--- a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorNameModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
+namespace Lumina.Presentation.Web.Common.DTO.MediaContributors;
///
-/// Represents a media contributor name.
+/// Data transfer object for a media contributor name.
///
-[DebuggerDisplay("{DisplayName}")]
-public class MediaContributorNameModel
+[DebuggerDisplay("DisplayName: {DisplayName}")]
+public class MediaContributorNameDto
{
///
/// Gets the name by which the contributor is popularly known.
@@ -19,4 +19,4 @@ public class MediaContributorNameModel
/// Gets the legal name of the contributor.
///
public string? LegalName { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorRoleModel.cs b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorRoleDto.cs
similarity index 71%
rename from src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorRoleModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorRoleDto.cs
index a735b674..74eaf370 100644
--- a/src/Lumina.Presentation.Web/Common/Models/MediaContributors/MediaContributorRoleModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorRoleDto.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
+namespace Lumina.Presentation.Web.Common.DTO.MediaContributors;
///
-/// Represents a media contributor role.
+/// Data transfer object for a media contributor role.
///
-[DebuggerDisplay("{Name}")]
-public class MediaContributorRoleModel
+[DebuggerDisplay("Name: {Name}")]
+public class MediaContributorRoleDto
{
///
/// Gets the value representing this object.
@@ -19,4 +19,4 @@ public class MediaContributorRoleModel
/// Gets the category of this object.
///
public string? Category { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/LibraryMetadataProviderModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryMetadataProviderDto.cs
similarity index 84%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/LibraryMetadataProviderModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryMetadataProviderDto.cs
index 04f5e442..787e8562 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/LibraryMetadataProviderModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryMetadataProviderDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.DTO.Plugins;
///
-/// Represents a metadata provider configured for a media library.
+/// Data transfer object for a metadata provider configured for a media library.
///
[DebuggerDisplay("Name: {Name}")]
-public class LibraryMetadataProviderModel
+public class LibraryMetadataProviderDto
{
///
/// Gets or sets the unique identifier of the plugin providing the metadata.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginDto.cs
similarity index 92%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/PluginModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginDto.cs
index 3b1bbbfa..9c67faae 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginDto.cs
@@ -5,13 +5,13 @@ using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.DTO.Plugins;
///
-/// Represents a detected plugin.
+/// Data transfer object for a detected plugin.
///
[DebuggerDisplay("Name: {Name}")]
-public class PluginModel
+public class PluginDto
{
///
/// Gets or sets the unique identifier of the plugin.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingDescriptorModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingDescriptorDto.cs
similarity index 82%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingDescriptorModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingDescriptorDto.cs
index 3bc6a917..a5e4c206 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingDescriptorModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingDescriptorDto.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Plugins;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.DTO.Plugins;
///
-/// Describes a single setting of a plugin.
+/// Data transfer object for a single setting of a plugin.
///
-public class PluginSettingDescriptorModel
+[DebuggerDisplay("Key: {Key}, Label: {Label}")]
+public class PluginSettingDescriptorDto
{
///
/// Gets or sets the unique key of the setting.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingsDto.cs
similarity index 69%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingsDto.cs
index ac6ea9ad..75fd0900 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/PluginSettingsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/Plugins/PluginSettingsDto.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.DTO.Plugins;
///
-/// Represents the settings of a plugin and their schema.
+/// Data transfer object for the settings of a plugin and their schema.
///
-public class PluginSettingsModel
+[DebuggerDisplay("PluginId: {PluginId}")]
+public class PluginSettingsDto
{
///
/// Gets or sets the unique identifier of the plugin.
@@ -18,7 +20,7 @@ public class PluginSettingsModel
///
/// Gets or sets the schema of the plugin settings.
///
- public List Schema { get; set; } = [];
+ public List Schema { get; set; } = [];
///
/// Gets or sets the current values of the plugin settings.
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserModel.cs b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserDto.cs
similarity index 66%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserDto.cs
index bee24edf..4a2abdd0 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserDto.cs
@@ -1,15 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.DTO.UsersManagement;
///
-/// Represents a model for a user.
+/// Data transfer object for a user.
///
/// The unique identifier of the user.
/// The username of the user.
-public record UserModel(
+[DebuggerDisplay("Id: {Id}, Username: {Username}")]
+public record UserDto(
Guid Id,
string Username
);
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserSettingsModel.cs b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs
similarity index 88%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserSettingsModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs
index e72cc0d8..ad009888 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/UserSettingsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.DTO.UsersManagement;
///
-/// Represents the settings of a user.
+/// Data transfer object for the settings of a user.
///
[DebuggerDisplay("IsPaginationEnabled: {IsPaginationEnabled}; ItemsPerPage: {ItemsPerPage}")]
-public class UserSettingsModel
+public class UserSettingsDto
{
///
/// Gets or sets the unique identifier of the user that owns these settings.
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs
similarity index 93%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs
index d5780444..b746cff9 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs
@@ -1,17 +1,17 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Common;
+using Lumina.Presentation.Web.Common.DTO.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
///
-/// Represents a book.
+/// Data transfer object for a book.
///
-[DebuggerDisplay("{Title}")]
-public class BookModel
+[DebuggerDisplay("Title: {Title}")]
+public class BookDto
{
///
/// Gets the Id of the media item.
@@ -107,12 +107,12 @@ public class BookModel
///
/// Gets the list of tags associated with the media item.
///
- public HashSet Tags { get; set; } = [];
+ public HashSet Tags { get; set; } = [];
///
/// Gets the list of genres associated with the media item.
///
- public HashSet Genres { get; set; } = [];
+ public HashSet Genres { get; set; } = [];
///
/// Gets the publisher of the written content.
@@ -192,7 +192,7 @@ public class BookModel
///
/// Gets the list of ISBN (International Standard Book Number) of the book.
///
- public List ISBNs { get; set; } = [];
+ public List ISBNs { get; set; } = [];
///
/// Gets the list of media contributors (actors, directors, etc) starring in this book.
@@ -202,7 +202,7 @@ public class BookModel
///
/// Gets the list of ratings for this book.
///
- public List Ratings { get; init; } = [];
+ public List Ratings { get; init; } = [];
///
/// Gets the time and date when the entity was added.
@@ -213,4 +213,4 @@ public class BookModel
/// Gets the optional time and date when the entity was updated.
///
public DateTime? Updated { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookRatingModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDto.cs
similarity index 63%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookRatingModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDto.cs
index 3370d93a..488dfa33 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookRatingModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDto.cs
@@ -1,19 +1,19 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.BookLibrary;
-using Lumina.Presentation.Web.Common.Models.Common;
using System.Diagnostics;
+using Lumina.Presentation.Web.Common.DTO.Common;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
///
-/// Represents a book rating.
+/// Data transfer object for a book rating.
///
-[DebuggerDisplay("{Value}/{MaxValue}")]
-public class BookRatingModel : RatingModel
+[DebuggerDisplay("Value: {Value}, MaxValue: {MaxValue}")]
+public class BookRatingDto : RatingDto
{
///
/// Gets or sets the source of the book rating (e.g., a specific website or platform).
///
public BookRatingSource? Source { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookSeriesModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDto.cs
similarity index 63%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookSeriesModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDto.cs
index ef9ba60c..70d36931 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BookSeriesModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDto.cs
@@ -2,16 +2,16 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
///
-/// Represents a request to get book series information.
+/// Data transfer object for a request to get book series information.
///
-[DebuggerDisplay("{Title}")]
-public class BookSeriesModel
+[DebuggerDisplay("Title: {Title}")]
+public class BookSeriesDto
{
///
/// Gets or sets the title of the book series.
///
public string? Title { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/IsbnModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDto.cs
similarity index 72%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/IsbnModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDto.cs
index f0defca0..8df5e093 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/IsbnModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDto.cs
@@ -3,13 +3,13 @@ using Lumina.Presentation.Web.Common.Enums.BookLibrary;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
///
-/// Represents a request to get ISBN information.
+/// Data transfer object for a request to get ISBN information.
///
-[DebuggerDisplay("{Value} ({Format})")]
-public class IsbnModel
+[DebuggerDisplay("Value: {Value} ({Format})")]
+public class IsbnDto
{
///
/// Gets or sets the ISBN value.
@@ -20,4 +20,4 @@ public class IsbnModel
/// Gets or sets the format of the ISBN (e.g., ISBN-10 or ISBN-13).
///
public IsbnFormat? Format { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/LightBookModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/LightBookDto.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/LightBookModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/LightBookDto.cs
index 0da7e882..047a8dd4 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/LightBookModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/LightBookDto.cs
@@ -3,13 +3,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
///
-/// Represents a preview of important properties of a book.
+/// Data transfer object for a preview of important properties of a book.
///
-[DebuggerDisplay("{Title}")]
-public class LightBookModel
+[DebuggerDisplay("Title: {Title}")]
+public class LightBookDto
{
///
/// Gets the Id of the media item.
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/WrittenContentMetadataModel.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDto.cs
similarity index 76%
rename from src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/WrittenContentMetadataModel.cs
rename to src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDto.cs
index 36e33e09..49ebd592 100644
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/WrittenContentMetadataModel.cs
+++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDto.cs
@@ -1,16 +1,16 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Common;
+using Lumina.Presentation.Web.Common.DTO.Common;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary;
+namespace Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary;
///
-/// Represents written content metadata.
+/// Data transfer object for written content metadata.
///
-[DebuggerDisplay("{Title}")]
-public class WrittenContentMetadataModel
+[DebuggerDisplay("Title: {Title}")]
+public class WrittenContentMetadataDto
{
///
/// Gets or sets the title of the written content.
@@ -30,27 +30,27 @@ public class WrittenContentMetadataModel
///
/// Gets or sets the release information, including release date and other relevant details.
///
- public ReleaseInfoModel? ReleaseInfo { get; set; }
+ public ReleaseInfoDto? ReleaseInfo { get; set; }
///
/// Gets or sets the list of genres associated with the written content.
///
- public List? Genres { get; set; }
+ public List? Genres { get; set; }
///
/// Gets or sets the list of tags that further describe or categorize the written content.
///
- public List? Tags { get; set; }
+ public List? Tags { get; set; }
///
/// Gets or sets the language in which the written content is written.
///
- public LanguageInfoModel? Language { get; set; }
+ public LanguageInfoDto? Language { get; set; }
///
/// Gets or sets the original language of the written content, if it has been translated.
///
- public LanguageInfoModel? OriginalLanguage { get; set; }
+ public LanguageInfoDto? OriginalLanguage { get; set; }
///
/// Gets or sets the name of the publisher of the written content.
@@ -61,4 +61,4 @@ public class WrittenContentMetadataModel
/// Gets or sets the number of pages in the written content.
///
public int? PageCount { get; set; }
-}
\ No newline at end of file
+}
diff --git a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs
index d0dc667e..8bea5b86 100644
--- a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs
+++ b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Configuration;
+using Lumina.Presentation.Web.Common.DTO.Configuration;
using Lumina.Presentation.Web.Common.Utilities;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -26,13 +26,13 @@ internal static class PresentationWebLayerConfiguration
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true);
- serviceCollection.AddOptions()
- .Bind(configuration.GetRequiredSection(ServerConfigurationModel.SECTION_NAME))
+ serviceCollection.AddOptions()
+ .Bind(configuration.GetRequiredSection(ServerConfigurationDto.SECTION_NAME))
.ValidateFluently()
.ValidateOnStart();
- serviceCollection.AddOptions()
- .Bind(configuration.GetRequiredSection(EncryptionSettingsModel.SECTION_NAME))
+ serviceCollection.AddOptions()
+ .Bind(configuration.GetRequiredSection(EncryptionSettingsDto.SECTION_NAME))
.ValidateFluently()
.ValidateOnStart();
diff --git a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs
index 1264f93d..b2f52ee7 100644
--- a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs
+++ b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs
@@ -1,13 +1,13 @@
#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using FastEndpoints.Swagger;
using FluentValidation;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.Enums.Authorization;
using Lumina.Presentation.Web.Common.Exceptions;
-using Lumina.Presentation.Web.Common.Filters.ActionFilters;
-using Lumina.Presentation.Web.Common.Filters.AuthorizationFilters;
using Lumina.Presentation.Web.Common.Http;
-using Lumina.Presentation.Web.Common.MiddlewareFilters;
-using Lumina.Presentation.Web.Common.Models.Authorization;
+using Lumina.Presentation.Web.Common.Localization;
using Lumina.Presentation.Web.Common.Security;
using Lumina.Presentation.Web.Common.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Localization.Routing;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.DependencyInjection;
using Polly;
@@ -49,11 +50,7 @@ public static class PresentationWebLayerServices
/// The updated .
public static IServiceCollection AddPresentationWebLayerServices(this IServiceCollection services)
{
- services.AddControllersWithViews(mvcOptions =>
- {
- mvcOptions.Filters.Add(new MiddlewareFilterAttribute(typeof(LocalizationPipeline))); // add localization middleware filter
- mvcOptions.Filters.Add();
- })
+ services.AddControllersWithViews()
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization()
.AddJsonOptions(jsonOptions =>
@@ -62,11 +59,50 @@ public static class PresentationWebLayerServices
jsonOptions.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; // needed because file system API responses can have very nested structures
jsonOptions.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
+
+ // configure the locations where the Razor view engine looks for views and layouts, since the views live under the Core directory
+ services.Configure(razorViewEngineOptions =>
+ {
+ razorViewEngineOptions.ViewLocationFormats.Clear();
+ razorViewEngineOptions.ViewLocationFormats.Add("/Core/Views/{1}/{0}.cshtml");
+ razorViewEngineOptions.ViewLocationFormats.Add("/Core/Views/Shared/{0}.cshtml");
+ });
+
+ // configure the JSON serialization settings used by Results.Json, so that the JSON responses of the endpoints match the MVC responses they replace
+ services.Configure(jsonOptions =>
+ {
+ jsonOptions.SerializerOptions.MaxDepth = 256;
+ jsonOptions.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; // needed because file system API responses can have very nested structures
+ jsonOptions.SerializerOptions.Converters.Add(new JsonStringEnumConverter());
+ });
+
+ // register the FastEndpoints library, which replaces the MVC controllers for handling the application routes
+ services.AddFastEndpoints();
+ // add OpenAPI document generation, so that the endpoints exposed by the web application are discoverable and their contracts are visible
+ services.AddOpenApi();
+ services.SwaggerDocument(documentOptions =>
+ {
+ documentOptions.SerializerSettings = jsonSerializerOptions =>
+ {
+ jsonSerializerOptions.PropertyNamingPolicy = null;
+ jsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
+ };
+ documentOptions.DocumentSettings = aspNetCoreOpenApiDocumentGeneratorSettings =>
+ {
+ aspNetCoreOpenApiDocumentGeneratorSettings.DocumentName = "v1";
+ aspNetCoreOpenApiDocumentGeneratorSettings.Title = "Lumina Web";
+ aspNetCoreOpenApiDocumentGeneratorSettings.Version = "v1";
+ };
+ documentOptions.RemoveEmptyRequestSchema = true;
+ documentOptions.ShortSchemaNames = true;
+ });
// configure URL-based localization
services.AddLocalization(localizationOptions =>
{
- localizationOptions.ResourcesPath = "Resources";
+ localizationOptions.ResourcesPath = "Core/Resources";
});
+ // resolve the resources of the views that live under the Core/Views directory
+ services.AddSingleton();
services.Configure(requestLocalizationOptions =>
{
@@ -190,9 +226,20 @@ public static class PresentationWebLayerServices
};
});
- // add an authorization policy that ensures application is initialized with super admin account before allowing access
+ // add authorization policies that ensure the application is initialized with the super admin account before allowing access,
+ // and that restrict access based on the roles and permissions retrieved from the remote API
services.AddAuthorizationBuilder()
- .AddPolicy("RequireInitialization", authorizationPolicyBuilder => authorizationPolicyBuilder.Requirements.Add(new InitializationRequirement()));
+ .AddPolicy(AuthorizationPolicies.REQUIRE_INITIALIZATION, authorizationPolicyBuilder => authorizationPolicyBuilder.Requirements.Add(new InitializationRequirement()))
+ .AddPolicy(AuthorizationPolicies.REQUIRE_ADMIN_ROLE, authorizationPolicyBuilder =>
+ {
+ authorizationPolicyBuilder.Requirements.Add(new RoleRequirement("Admin"));
+ authorizationPolicyBuilder.RequireAuthenticatedUser();
+ })
+ .AddPolicy(AuthorizationPolicies.REQUIRE_CREATE_LIBRARIES_PERMISSION, authorizationPolicyBuilder =>
+ {
+ authorizationPolicyBuilder.Requirements.Add(new PermissionRequirement(AuthorizationPermission.CanCreateLibraries));
+ authorizationPolicyBuilder.RequireAuthenticatedUser();
+ });
// add forwarded headers middleware to handle reverse proxy scenarios
services.Configure(forwardedHeadersOptions =>
@@ -237,13 +284,13 @@ public static class PresentationWebLayerServices
.AddPolicyHandler(circuitBreakerPolicy);
services.AddScoped();
- services.AddScoped();
- services.AddScoped();
// enable access to the current HTTP context in non-controller classes
services.AddHttpContextAccessor();
services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
services.AddScoped();
services.AddSingleton();
services.AddSingleton();
diff --git a/src/Lumina.Presentation.Web/Common/Exceptions/ApiException.cs b/src/Lumina.Presentation.Web/Common/Exceptions/ApiException.cs
index 5557f482..95c75ae9 100644
--- a/src/Lumina.Presentation.Web/Common/Exceptions/ApiException.cs
+++ b/src/Lumina.Presentation.Web/Common/Exceptions/ApiException.cs
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Common;
+using Lumina.Presentation.Web.Common.DTO.Common;
using System;
using System.Net;
#endregion
@@ -19,7 +19,7 @@ public class ApiException : Exception
///
/// Gets or sets the problem details represented by this exception.
///
- public ProblemDetailsModel? ProblemDetails { get; }
+ public ProblemDetailsDto? ProblemDetails { get; }
///
/// Gets or sets the absolute path of the API endpoint that produced this exception.
@@ -32,7 +32,7 @@ public class ApiException : Exception
/// The problem details object returned by the API.
/// The HTTP status code returned by the API.
/// The absolute path of the API endpoint that produced this exception.
- public ApiException(ProblemDetailsModel? problemDetails, HttpStatusCode httpStatusCode, string? requestPath = null) : base(problemDetails?.Title ?? "An error occurred.")
+ public ApiException(ProblemDetailsDto? problemDetails, HttpStatusCode httpStatusCode, string? requestPath = null) : base(problemDetails?.Title ?? "An error occurred.")
{
ProblemDetails = problemDetails;
HttpStatusCode = httpStatusCode;
diff --git a/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/InitializationCheckAttribute.cs b/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/InitializationCheckAttribute.cs
deleted file mode 100644
index d19083da..00000000
--- a/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/InitializationCheckAttribute.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.Extensions.DependencyInjection;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Filters.ActionFilters;
-
-///
-/// Attribute that enforces application initialization checks on controller actions.
-///
-public class InitializationCheckAttribute : ActionFilterAttribute
-{
- ///
- /// Asynchronously executes the initialization check before the action executes.
- ///
- /// The context for the action being executed.
- /// Delegate to execute the next action filter in the pipeline.
- public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- IAuthorizationService authorizationService = context.HttpContext.RequestServices.GetRequiredService();
- await authorizationService.AuthorizeAsync(context.HttpContext.User, context.HttpContext, "RequireInitialization").ConfigureAwait(false);
- await next().ConfigureAwait(false);
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/StoreLastViewFilter.cs b/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/StoreLastViewFilter.cs
deleted file mode 100644
index 0f4bb8a0..00000000
--- a/src/Lumina.Presentation.Web/Common/Filters/ActionFilters/StoreLastViewFilter.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Http;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Filters.ActionFilters;
-
-///
-/// Stores the current view path in session, for actions that return ViewResult. This is needed because when JWT expires, user is redirected to Login view, with a returnUrl.
-/// This returnUrl needs to be that of the last displayed view, not of the call that triggered the re-authentication request, which can be an API call for data.
-///
-public class StoreLastViewFilter : IActionFilter
-{
- ///
- /// Executes before the action method is called.
- ///
- /// The action executing context.
- public void OnActionExecuting(ActionExecutingContext context)
- {
- // no action needed before execution
- }
-
- ///
- /// Executes after the action method is called.
- ///
- /// The action executed context containing the action result.
- public void OnActionExecuted(ActionExecutedContext context)
- {
- if (context.Result is ViewResult)
- {
- HttpContext httpContext = context.HttpContext;
- // ignore the login endpoint, because it is incorrect to be redirected to the login URL, with the login URL as the return URL
- if (httpContext.Request.Path != "/en-us/auth/login")
- httpContext.Session.SetString(HttpContextItemKeys.LAST_DISPLAYED_VIEW, $"{httpContext.Request.PathBase}{httpContext.Request.Path}{httpContext.Request.QueryString}");
- }
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Filters/AuthorizationFilters/ApiAuthorizationFilter.cs b/src/Lumina.Presentation.Web/Common/Filters/AuthorizationFilters/ApiAuthorizationFilter.cs
deleted file mode 100644
index 0375fb54..00000000
--- a/src/Lumina.Presentation.Web/Common/Filters/AuthorizationFilters/ApiAuthorizationFilter.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Authorization;
-using Lumina.Presentation.Web.Common.Exceptions;
-using Lumina.Presentation.Web.Common.Models.Authorization;
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Authentication.Cookies;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Filters.AuthorizationFilters;
-
-///
-/// Implements authorization filter logic for API endpoints by validating user roles, permissions, and policies.
-///
-public class ApiAuthorizationFilter : IAsyncAuthorizationFilter
-{
- private readonly IAuthorizationService _authorizationService;
- private readonly AuthorizationRequirementModel _requirement;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- /// Authorization requirements to evaluate.
- public ApiAuthorizationFilter(IAuthorizationService authorizationService, AuthorizationRequirementModel requirement)
- {
- _authorizationService = authorizationService;
- _requirement = requirement;
- }
-
- ///
- /// Performs authorization for the current request.
- ///
- /// The authorization filter context.
- public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
- {
- try
- {
- if (!await _authorizationService.EvaluateAuthorizationAsync(_requirement))
- context.Result = new ForbidResult();
- }
- catch (ApiException ex) // TODO: check if it should really catch exceptions here
- {
- if (ex.HttpStatusCode == System.Net.HttpStatusCode.Unauthorized)
- {
- await context.HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme).ConfigureAwait(false);
- context.HttpContext.Response.Cookies.Delete("Token");
- throw;
- }
- }
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Filters/TypeFilters/ApiAuthorizationAttribute.cs b/src/Lumina.Presentation.Web/Common/Filters/TypeFilters/ApiAuthorizationAttribute.cs
deleted file mode 100644
index 6d9838a6..00000000
--- a/src/Lumina.Presentation.Web/Common/Filters/TypeFilters/ApiAuthorizationAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Filters.AuthorizationFilters;
-using Microsoft.AspNetCore.Mvc;
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Filters.TypeFilters;
-
-///
-/// Authorization filter for API endpoints.
-///
-///
-/// This attribute can be applied to both classes and methods and supports multiple instances on the same target.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
-public class ApiAuthorizationAttribute : TypeFilterAttribute
-{
- ///
- /// Initializes a new instance of the class.
- ///
- public ApiAuthorizationAttribute() : base(typeof(ApiAuthorizationFilter))
- {
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs b/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs
new file mode 100644
index 00000000..cdb5bd98
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs
@@ -0,0 +1,65 @@
+#region ========================================================================= USING =====================================================================================
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Abstractions;
+using Microsoft.AspNetCore.Mvc.Infrastructure;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Http;
+
+///
+/// that renders a Razor view through the MVC view engine, enabling FastEndpoints endpoints to serve the Razor views of the application.
+///
+///
+/// The class does not expose a method for rendering Razor views, so this custom result reuses the MVC
+/// execution machinery, which preserves layouts, sections, view components and tag helpers.
+///
+public sealed class RazorViewResult : IResult
+{
+ private readonly string _viewName;
+ private readonly object? _model;
+ private readonly IReadOnlyDictionary _viewData;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name or path of the view to render.
+ /// The model to pass to the view.
+ /// Optional additional view data entries made available to the view via ViewData.
+ public RazorViewResult(string viewName, object? model = null, IReadOnlyDictionary? viewData = null)
+ {
+ _viewName = viewName;
+ _model = model;
+ _viewData = viewData ?? new Dictionary();
+ }
+
+ ///
+ /// Renders the configured Razor view to the response.
+ ///
+ /// The for the current request.
+ public async Task ExecuteAsync(HttpContext httpContext)
+ {
+ // the only accessible ViewDataDictionary constructors require either a model state or an existing dictionary, so start from an empty one and assign the model
+ // through the Model setter; the setter rebases the model metadata on the runtime type of the value, which is what makes the asp-for tag helpers resolve the
+ // properties of the actual model type instead of a plain object
+ IModelMetadataProvider metadataProvider = httpContext.RequestServices.GetRequiredService();
+ ViewDataDictionary viewData = new(metadataProvider, new ModelStateDictionary()) { Model = _model };
+ foreach ((string key, object? value) in _viewData)
+ viewData[key] = value;
+
+ // delegate to the MVC view execution machinery instead of rendering the view manually: it discovers the layout and _ViewStart, evaluates the sections,
+ // and resolves the view components and tag helpers, none of which the Results class can do since it has no view rendering support
+ ViewResult viewResult = new() { ViewName = _viewName, ViewData = viewData };
+ IActionResultExecutor executor = httpContext.RequestServices.GetRequiredService>();
+ // the view engine needs an ActionContext, which FastEndpoints does not provide; synthesize one that carries over the current route data, so that the
+ // culture route value (and therefore the URL-based localization) keeps working while the view is rendered
+ ActionContext actionContext = new(httpContext, httpContext.GetRouteData() ?? new RouteData(), new ActionDescriptor());
+ await executor.ExecuteAsync(actionContext, viewResult).ConfigureAwait(false);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Localization/CoreHtmlLocalizerFactory.cs b/src/Lumina.Presentation.Web/Common/Localization/CoreHtmlLocalizerFactory.cs
new file mode 100644
index 00000000..f560d7b5
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Localization/CoreHtmlLocalizerFactory.cs
@@ -0,0 +1,55 @@
+#region ========================================================================= USING =====================================================================================
+using Microsoft.AspNetCore.Mvc.Localization;
+using Microsoft.Extensions.Localization;
+using System;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Localization;
+
+///
+/// that resolves the resources of the views that live under the Core/Views directory.
+///
+///
+/// The view localizer derives the resource base name from the executing view path, so a view at /Core/Views/Auth/Login.cshtml produces the base name
+/// {ApplicationName}.Core.Views.Auth.Login. Because the Core segment is only the directory that hosts the views and not part of the resource path,
+/// it is stripped here, so that the resources are looked up at {ApplicationName}.Core.Resources.Views.Auth.Login, matching the resource files under
+/// Core/Resources/Views/Auth.
+///
+public class CoreHtmlLocalizerFactory : IHtmlLocalizerFactory
+{
+ private readonly HtmlLocalizerFactory _innerFactory;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected factory used to create the underlying string localizers.
+ public CoreHtmlLocalizerFactory(IStringLocalizerFactory stringLocalizerFactory)
+ {
+ _innerFactory = new HtmlLocalizerFactory(stringLocalizerFactory);
+ }
+
+ ///
+ /// Creates an for the specified base name and location.
+ ///
+ /// The base name of the resource to load strings from.
+ /// The location to load resources from.
+ /// The created .
+ public IHtmlLocalizer Create(string baseName, string location)
+ {
+ string prefix = location + ".Core.";
+ string resourceBaseName = baseName.StartsWith(prefix, StringComparison.Ordinal)
+ ? location + "." + baseName.Substring(prefix.Length)
+ : baseName;
+ return _innerFactory.Create(resourceBaseName, location);
+ }
+
+ ///
+ /// Creates an for the specified resource source type.
+ ///
+ /// The type of the resource to load strings from.
+ /// The created .
+ public IHtmlLocalizer Create(Type resourceSource)
+ {
+ return _innerFactory.Create(resourceSource);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/MiddlewareFilters/LocalizationPipeline.cs b/src/Lumina.Presentation.Web/Common/MiddlewareFilters/LocalizationPipeline.cs
deleted file mode 100644
index a10a2dfb..00000000
--- a/src/Lumina.Presentation.Web/Common/MiddlewareFilters/LocalizationPipeline.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Localization;
-using Microsoft.Extensions.Options;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.MiddlewareFilters;
-
-///
-/// Defines a pipeline for configuring middleware to handle localization.
-///
-///
-/// To use a MiddlewareFilter, you first need to create a pipeline. This acts as a mini startup configuration where you define an
-/// to specify the middleware that should run as part of the pipeline. Multiple middleware can be configured in this way.
-///
-public class LocalizationPipeline
-{
- ///
- /// Configures the middleware pipeline to include the for handling localization.
- ///
- /// The used to configure the middleware pipeline.
- /// The instance for , containing localization settings to be applied.
- public void Configure(IApplicationBuilder app, IOptions options)
- {
- // runs the RequestLocalizationMiddleware with the provided options
- app.UseRequestLocalization(options.Value);
- }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/AuthorizationRequirementModel.cs b/src/Lumina.Presentation.Web/Common/Models/Authorization/AuthorizationRequirementModel.cs
deleted file mode 100644
index 139981e2..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/AuthorizationRequirementModel.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Enums.Authorization;
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
-
-///
-/// Model for storing the authorization requirements for accessing a resource.
-///
-public class AuthorizationRequirementModel
-{
- ///
- /// The collection of roles required for accessing the resource.
- ///
- public string[]? Roles { get; set; }
-
- ///
- /// The collection of permissions required for accessing the resource.
- ///
- public AuthorizationPermission[]? Permissions { get; set; }
-
- ///
- /// The type of the policy required for accessing the resource.
- ///
- public Type? PolicyType { get; set; }
-}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/PermissionModel.cs b/src/Lumina.Presentation.Web/Common/Models/Authorization/PermissionModel.cs
deleted file mode 100644
index 7ace0b3d..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/PermissionModel.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Enums.Authorization;
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
-
-///
-/// Represents a model for an authorization permission.
-///
-/// The unique identifier of the authorization permission.
-/// The authorization permission.
-public record PermissionModel(
- Guid Id,
- AuthorizationPermission PermissionName
-);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/RoleModel.cs b/src/Lumina.Presentation.Web/Common/Models/Authorization/RoleModel.cs
deleted file mode 100644
index bc1a3ac4..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/RoleModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
-
-///
-/// Represents a model for an authorization role.
-///
-/// The unique identifier of the authorization role.
-/// The authorization role.
-public record RoleModel(
- Guid Id,
- string RoleName
-);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateRoleRequestModel.cs b/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateRoleRequestModel.cs
deleted file mode 100644
index f70a2f1f..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateRoleRequestModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System;
-using System.Collections.Generic;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
-
-///
-/// Represents the request model for updating an existing authorization role.
-///
-/// The unique identifier of the role.
-/// The name of the role.
-/// The collection of Ids of the permissions of the role.
-public record UpdateRoleRequestModel(
- Guid RoleId,
- string? RoleName,
- List? Permissions
-);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateUserRoleAndPermissionsRequestModel.cs b/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateUserRoleAndPermissionsRequestModel.cs
deleted file mode 100644
index a76ce7aa..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/UpdateUserRoleAndPermissionsRequestModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System;
-using System.Collections.Generic;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
-
-///
-/// Represents the request model for updating the authorization role and permissions of a user.
-///
-/// The unique identifier of the user.
-/// The unique identifier of the role.
-/// The collection of Ids of the permissions of the user.
-public record UpdateUserRoleAndPermissionsRequestModel(
- Guid UserId,
- Guid? RoleId,
- List? Permissions
-);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs b/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs
deleted file mode 100644
index 3bd1ef69..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Lumina.Presentation.Web.Common.Models.Common;
-
-///
-/// Record used for empty requests and responses.
-///
-public record struct EmptyModel();
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/DirectoryModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/DirectoryModel.cs
deleted file mode 100644
index a5cacc18..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/DirectoryModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Collections.Generic;
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// Model for directories displayed in custom directory/file browser dialogs.
-///
-[DebuggerDisplay("{Path}")]
-public class DirectoryModel : FileSystemItemModel
-{
- ///
- /// Gets or sets the children items of the directory.
- ///
- public List Items { get; set; } = [];
-}
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileModel.cs
deleted file mode 100644
index ff4fa39f..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileModel.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// Model for files displayed in custom directory/file browser dialogs.
-///
-[DebuggerDisplay("{Path}")]
-public class FileModel : FileSystemItemModel
-{
- ///
- /// Gets or sets the size of the file, in bytes
- ///
- public long Size { get; set; }
-}
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTypeModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTypeModel.cs
deleted file mode 100644
index 21794b67..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/FileSystemTypeModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Enums.FileSystem;
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// Model containing the file system platform type.
-/// `
-[DebuggerDisplay("{PlatformType}")]
-public class FileSystemTypeModel
-{
- ///
- /// Gets or sets the file system platform type.
- ///
- public PlatformType PlatformType { get; set; }
-}
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathExistsModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathExistsModel.cs
deleted file mode 100644
index 5eb3caee..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathExistsModel.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// Represents a response to the inquiry about the existence of a file system path.
-///
-/// Whether a file system path exists or not.
-[DebuggerDisplay("{Exists}")]
-public record PathExistsModel(
- bool Exists
-);
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSeparatorModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSeparatorModel.cs
deleted file mode 100644
index d778bea0..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathSeparatorModel.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// A model representing a file system path separator.
-///
-/// The system's path separator.
-[DebuggerDisplay("{Separator}")]
-public record PathSeparatorModel(
- string Separator
-);
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathValidModel.cs b/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathValidModel.cs
deleted file mode 100644
index 1954f357..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/FileSystemManagement/PathValidModel.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-
-///
-/// Represents a response to the inquiry about the validity of a file system path.
-///
-/// Whether a file system path is valid or not.
-[DebuggerDisplay("{IsValid}")]
-public record PathValidModel(
- bool IsValid
-);
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordRequestModel.cs b/src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordRequestModel.cs
deleted file mode 100644
index 85b51598..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordRequestModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
-
-///
-/// Represents the request model for account password change.
-///
-/// The username of the account.
-/// The current password of the account.
-/// The new password of the account.
-/// The confirmation of the new password of the account.
-public record ChangePasswordRequestModel(
- string? Username,
- string? CurrentPassword,
- string? NewPassword,
- string? NewPasswordConfirm
-);
diff --git a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BooksModel.cs b/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BooksModel.cs
deleted file mode 100644
index 96565d6e..00000000
--- a/src/Lumina.Presentation.Web/Common/Models/WrittenContentLibrary/BookLibrary/BooksModel.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Common;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
-
-///
-/// Represents a book.
-///
-[DebuggerDisplay("{Title}")]
-public class BooksModel
-{
-}
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/AddRoleRequestModel.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/AddRoleRequest.cs
similarity index 54%
rename from src/Lumina.Presentation.Web/Common/Models/Authorization/AddRoleRequestModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/Authorization/AddRoleRequest.cs
index 76b9c855..55d34f76 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/AddRoleRequestModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/AddRoleRequest.cs
@@ -1,16 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
///
-/// Represents the request model for adding an authorization role.
+/// Represents a request for adding an authorization role.
///
-/// The name of the role.
-/// The collection or permissions of the role.
-public record AddRoleRequestModel(
+/// The name of the role. Required.
+/// The collection or permissions of the role. Required.
+[DebuggerDisplay("RoleName: {RoleName}")]
+public record AddRoleRequest(
string? RoleName,
List? Permissions
);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/DeleteRoleRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/DeleteRoleRequest.cs
new file mode 100644
index 00000000..4becd239
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/DeleteRoleRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents a request for deleting an authorization role.
+///
+/// The unique identifier of the role. Required.
+[DebuggerDisplay("RoleId: {RoleId}")]
+public record DeleteRoleRequest(
+ Guid RoleId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetRolePermissionsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetRolePermissionsRequest.cs
new file mode 100644
index 00000000..738e1b4e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetRolePermissionsRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents a request to get the authorization permissions of a role identified by .
+///
+/// The Id of authorization role. Required.
+[DebuggerDisplay("RoleId: {RoleId}")]
+public record GetRolePermissionsRequest(
+ Guid RoleId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs
new file mode 100644
index 00000000..25758d63
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents the request model for retrieving the authorization permissions of a user identified by .
+///
+/// The unique identifier of the user for whom to get the authorization permissions. Required.
+[DebuggerDisplay("UserId: {UserId}")]
+public record GetUserPermissionsRequest(
+ Guid UserId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs
new file mode 100644
index 00000000..6080ba49
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents the request model for retrieving the authorization role of a user identified by .
+///
+/// The unique identifier of the user for whom to get the authorization role. Required.
+[DebuggerDisplay("UserId: {UserId}")]
+public record GetUserRoleRequest(
+ Guid UserId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateRoleRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateRoleRequest.cs
new file mode 100644
index 00000000..de8d4c45
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateRoleRequest.cs
@@ -0,0 +1,20 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents a request for updating an existing authorization role.
+///
+/// The unique identifier of the role. Required.
+/// The name of the role. Required.
+/// The collection of Ids of the permissions of the role. Required.
+[DebuggerDisplay("RoleName: {RoleName}")]
+public record UpdateRoleRequest(
+ Guid RoleId,
+ string? RoleName,
+ List? Permissions
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateUserRoleAndPermissionsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateUserRoleAndPermissionsRequest.cs
new file mode 100644
index 00000000..21e9ad06
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/UpdateUserRoleAndPermissionsRequest.cs
@@ -0,0 +1,20 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Authorization;
+
+///
+/// Represents a request for updating the authorization role and permissions of a user.
+///
+/// The unique identifier of the user. Required.
+/// The unique identifier of the role. Optional.
+/// The collection of Ids of the permissions of the role. Optional.
+[DebuggerDisplay("UserId: {UserId}")]
+public record UpdateUserRoleAndPermissionsRequest(
+ Guid UserId,
+ Guid? RoleId,
+ List? Permissions
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Common/EmptyRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Common/EmptyRequest.cs
new file mode 100644
index 00000000..12334e34
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Common/EmptyRequest.cs
@@ -0,0 +1,6 @@
+namespace Lumina.Presentation.Web.Common.Requests.Common;
+
+///
+/// Record used for empty requests and responses.
+///
+public record struct EmptyRequest();
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequest.cs
new file mode 100644
index 00000000..6319e090
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequest.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Directories;
+
+///
+/// Represents a request to get the directories of a file system path.
+///
+/// The file system path for which to get the directories. Required.
+/// Whether to include hidden file system elements or not. Optional.
+[DebuggerDisplay("Path: {Path}")]
+public record GetDirectoriesRequest(
+ string? Path,
+ bool IncludeHiddenElements
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetFilesRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetFilesRequest.cs
new file mode 100644
index 00000000..0448d103
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetFilesRequest.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
+
+///
+/// Represents a request to get the files at a file system path.
+///
+/// The file system path for which to get the files. Required.
+/// Whether to include hidden file system elements or not. Optional.
+[DebuggerDisplay("Path: {Path}")]
+public record GetFilesRequest(
+ string? Path,
+ bool IncludeHiddenElements
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetTreeFilesRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetTreeFilesRequest.cs
new file mode 100644
index 00000000..f78a9dcc
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Files/GetTreeFilesRequest.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
+
+///
+/// Represents a request to get the files of a file system path.
+///
+/// The file system path for which to get the tree files. Required.
+/// Whether to include hidden file system elements or not. Optional.
+[DebuggerDisplay("Path: {Path}")]
+public record GetTreeFilesRequest(
+ string? Path,
+ bool IncludeHiddenElements
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/CheckPathExistsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/CheckPathExistsRequest.cs
new file mode 100644
index 00000000..78fb23a8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/CheckPathExistsRequest.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
+
+///
+/// Represents a request to check the existence of a file system path.
+///
+/// The file system path to check the exitence of. Required.
+/// Whether to include hidden elements in the search results, or not. Optional.
+[DebuggerDisplay("Path: {Path}, IncludeHiddenElements: {IncludeHiddenElements}")]
+public record CheckPathExistsRequest(
+ string? Path,
+ bool IncludeHiddenElements
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
new file mode 100644
index 00000000..c3bb5a7c
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
+
+///
+/// Represents the request for retrieving the parent path of a file system path.
+///
+/// The path for which the parent path is retrieved.
+[DebuggerDisplay("Path: {Path}")]
+public record GetPathParentRequest(
+ string? Path
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathRootRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathRootRequest.cs
new file mode 100644
index 00000000..6c2660ae
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathRootRequest.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
+
+///
+/// Represents a request to get the root of a file system path.
+///
+/// The file system path for which to get the root. Required.
+[DebuggerDisplay("Path: {Path}")]
+public record GetPathRootRequest(
+ string? Path
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/SplitPathRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/SplitPathRequest.cs
new file mode 100644
index 00000000..f8454901
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/SplitPathRequest.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
+
+///
+/// Represents a request to split a file system path.
+///
+/// The file system path for which to get the path segments. Required.
+[DebuggerDisplay("Path: {Path}")]
+public record SplitPathRequest(
+ string? Path
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/ValidatePathRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/ValidatePathRequest.cs
new file mode 100644
index 00000000..b8664b9e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/ValidatePathRequest.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
+
+///
+/// Represents a request to check the validity of a file system path.
+///
+/// The file system path to validate. Required.
+[DebuggerDisplay("Path: {Path}")]
+public record ValidatePathRequest(
+ string? Path
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Libraries/BookLibraryItemsQueryModel.cs b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
similarity index 90%
rename from src/Lumina.Presentation.Web/Common/Models/Libraries/BookLibraryItemsQueryModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
index 3cfe6f3e..d6ccbcd7 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Libraries/BookLibraryItemsQueryModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
@@ -4,13 +4,13 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Libraries;
+namespace Lumina.Presentation.Web.Common.Requests.Libraries;
///
-/// Represents the query parameters used to retrieve the lightweight details of the books of a media library.
+/// Represents a request to get the lightweight details of the books of a media library.
///
[DebuggerDisplay("LibraryId: {LibraryId}")]
-public class BookLibraryItemsQueryModel
+public class GetBooksLiteRequest
{
///
/// Gets or sets the Id of the media library whose books are retrieved.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/CancelLibraryScanRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/CancelLibraryScanRequest.cs
new file mode 100644
index 00000000..bd358060
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/CancelLibraryScanRequest.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents a request to cancel the scan of a media library.
+///
+/// The unique identifier of the media library whose scan is cancelled. Required.
+/// The Id of scan to cancel. Required.
+[DebuggerDisplay("LibraryId: {LibraryId}; ScanId: {ScanId}")]
+public record CancelLibraryScanRequest(
+ Guid LibraryId,
+ Guid ScanId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/DeleteLibraryRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/DeleteLibraryRequest.cs
new file mode 100644
index 00000000..928c8ce7
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/DeleteLibraryRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents a request to delete a media library by its Id.
+///
+/// The unique identifier of the media library to be deleted. Required.
+[DebuggerDisplay("Id: {Id}")]
+public record DeleteLibraryRequest(
+ Guid Id
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs
new file mode 100644
index 00000000..93b666b7
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents the request for displaying the media library editing view.
+///
+/// The unique identifier of the media library to edit.
+[DebuggerDisplay("Id: {Id}")]
+public record EditLibraryRequest(
+ Guid Id
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs
new file mode 100644
index 00000000..ca866ef0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents the request for retrieving the metadata providers of a media library.
+///
+/// The unique identifier of the media library whose metadata providers are retrieved.
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public record GetMetadataProvidersRequest(
+ Guid LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/ScanLibraryRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/ScanLibraryRequest.cs
new file mode 100644
index 00000000..dbb07d0f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/ScanLibraryRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents a request to scan a media library.
+///
+/// The unique identifier of the media library to be scanned. Required.
+[DebuggerDisplay("Id: {Id}")]
+public record ScanLibraryRequest(
+ Guid Id
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequest.cs
new file mode 100644
index 00000000..79725234
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+
+///
+/// Represents a request to get a book by the specified Id.
+///
+/// The unique identifier of the book to retrieve.
+[DebuggerDisplay("Id: {Id}")]
+public record GetBookRequest(
+ Guid Id
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs
new file mode 100644
index 00000000..7ec4de40
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+
+///
+/// Represents the request for displaying the books browsing view.
+///
+/// The unique identifier of the media library whose books are browsed.
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public record GetBooksViewRequest(
+ Guid? LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/GetPluginSettingsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/GetPluginSettingsRequest.cs
new file mode 100644
index 00000000..cdbbe52a
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/GetPluginSettingsRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
+
+///
+/// Represents a request to get the settings of a plugin.
+///
+/// The unique identifier of the plugin. Required.
+[DebuggerDisplay("PluginId: {PluginId}")]
+public record GetPluginSettingsRequest(
+ Guid PluginId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/ReorderLibraryMetadataProvidersModel.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
similarity index 79%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/ReorderLibraryMetadataProvidersModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
index f4331250..a88953b3 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/ReorderLibraryMetadataProvidersModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to reorder the metadata providers of a media library.
///
-public class ReorderLibraryMetadataProvidersModel
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public class ReorderLibraryMetadataProvidersRequest
{
///
/// Gets or sets the Id of the media library whose metadata providers are reordered.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/SetLibraryMetadataProviderEnabledModel.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
similarity index 80%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/SetLibraryMetadataProviderEnabledModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
index 7d7a4eae..38046da0 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/SetLibraryMetadataProviderEnabledModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to enable or disable a metadata provider for a media library.
///
-public class SetLibraryMetadataProviderEnabledModel
+[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
+public class SetLibraryMetadataProviderEnabledRequest
{
///
/// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
diff --git a/src/Lumina.Presentation.Web/Common/Models/Plugins/UpdatePluginSettingsModel.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
similarity index 78%
rename from src/Lumina.Presentation.Web/Common/Models/Plugins/UpdatePluginSettingsModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
index 246211a4..c48bac46 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Plugins/UpdatePluginSettingsModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
@@ -1,14 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
+using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Plugins;
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to update the settings of a plugin.
///
-public class UpdatePluginSettingsModel
+[DebuggerDisplay("PluginId: {PluginId}")]
+public class UpdatePluginSettingsRequest
{
///
/// Gets or sets the unique identifier of the plugin.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs
new file mode 100644
index 00000000..2db72ecc
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs
@@ -0,0 +1,16 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Tools;
+
+///
+/// Represents the request for setting the culture used by the application.
+///
+/// The new culture to set.
+/// The URL to return to, after setting the new culture.
+[DebuggerDisplay("NewCulture: {NewCulture}, ReturnUrl: {ReturnUrl}")]
+public record SetLanguageRequest(
+ string? NewCulture,
+ string? ReturnUrl
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs
new file mode 100644
index 00000000..a9dda6d5
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.UsersManagement.Authentication;
+
+///
+/// Represents the request for displaying the account login view.
+///
+/// The URL to return to, after login.
+[DebuggerDisplay("ReturnUrl: {ReturnUrl}")]
+public record LoginViewRequest(
+ string? ReturnUrl = null
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs
new file mode 100644
index 00000000..b899d829
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs
@@ -0,0 +1,20 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
+
+///
+/// Represents the request model for account password change.
+///
+/// The username of the account. Required.
+/// The current password of the account. Required.
+/// The new password of the account. Required.
+/// The confirmation of the new password of the account. Required.
+[DebuggerDisplay("Username: {Username}")]
+public record ChangePasswordRequest(
+ string? Username,
+ string? CurrentPassword,
+ string? NewPassword,
+ string? NewPasswordConfirm
+);
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginRequestModel.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
similarity index 64%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginRequestModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
index 650ff42c..bca229e8 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginRequestModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
@@ -2,17 +2,17 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
/// Represents the request model for user authentication.
///
-/// The username used to authenticate.
-/// The password used to authenticate.
-/// The TOTP (Time-Based One-Time Password) code used for two-factor authentication.
+/// The username of the account to authenticate. Required.
+/// The password of the account to authenticate. Required.
+/// The TOTP (Time-Based One-Time Password) of the account to authenticate. Optional.
/// The URL to return to, after login.
[DebuggerDisplay("Username: {Username}")]
-public record LoginRequestModel(
+public record LoginRequest(
string? Username = null,
string? Password = null,
string? TotpCode = null,
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordRequestModel.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
similarity index 70%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordRequestModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
index 1668a464..e41f7e8a 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordRequestModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
@@ -2,15 +2,15 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
/// Represents the request model for account password recovery.
///
-/// The username of the account for which to recover the password.
-/// The TOTP (Time-Based One-Time Password) code used to recover the password.
+/// The username of the account for which to recover the password. Required.
+/// The TOTP (Time-Based One-Time Password) of the account for which to recover the password. Required.
[DebuggerDisplay("Username: {Username}")]
-public record RecoverPasswordRequestModel(
+public record RecoverPasswordRequest(
string? Username,
string? TotpCode
);
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterRequestModel.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
similarity index 65%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterRequestModel.cs
rename to src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
index 082b8108..9aa1c105 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterRequestModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
@@ -2,18 +2,18 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
/// Represents the request model for user registration.
///
-/// The desired username for the new account.
-/// The password for the new account.
-/// The confirmation of the entered password, used to ensure consistency.
-/// Specifies the type of registration, e.g., "Admin" or "User".
-/// Indicates whether two-factor authentication (2FA) should be enabled for the new account.
+/// The desired username for the new account. Required.
+/// The password for the new account. Required.
+/// The confirmation of the entered password, used to ensure consistency. Required.
+/// Specifies the type of registration, e.g., "Admin" or "User". Required.
+/// Indicates whether two-factor authentication (2FA) should be enabled for the new account. Optional.
[DebuggerDisplay("Username: {Username}")]
-public record RegisterRequestModel(
+public record RegisterRequest(
string? Username,
string? Password,
string? PasswordConfirm,
diff --git a/src/Lumina.Presentation.Web/Common/Models/Authorization/GetAuthorizationResponseModel.cs b/src/Lumina.Presentation.Web/Common/Responses/Authorization/GetAuthorizationResponse.cs
similarity index 92%
rename from src/Lumina.Presentation.Web/Common/Models/Authorization/GetAuthorizationResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/Authorization/GetAuthorizationResponse.cs
index 4436f3a9..3190ff2d 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Authorization/GetAuthorizationResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/Authorization/GetAuthorizationResponse.cs
@@ -4,7 +4,7 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Authorization;
+namespace Lumina.Presentation.Web.Common.Responses.Authorization;
///
/// Represents the response model for an account authorization request.
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordResponseModel.cs b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/ChangePasswordResponse.cs
similarity index 81%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/UsersManagement/ChangePasswordResponse.cs
index 4befdb83..7bd05bf6 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/ChangePasswordResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/ChangePasswordResponse.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Responses.UsersManagement;
///
/// Represents the response model for an account password change request.
///
/// Whether the password was changed or not.
[DebuggerDisplay("IsPasswordChanged: {IsPasswordChanged}")]
-public record ChangePasswordResponseModel(
+public record ChangePasswordResponse(
bool IsPasswordChanged
);
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/InitializationModel.cs b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/InitializationResponse.cs
similarity index 84%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/InitializationModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/UsersManagement/InitializationResponse.cs
index 68a0dc52..6f4582d7 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/InitializationModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/InitializationResponse.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Responses.UsersManagement;
///
/// Model for verifying the initialization status of the application.
///
[DebuggerDisplay("IsInitialized: {IsInitialized}")]
-public class InitializationModel
+public class InitializationResponse
{
///
/// Gets or sets a value indicating whether the application has been run before, and the super admin account has been created.
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginResponseModel.cs b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/LoginResponse.cs
similarity index 89%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/UsersManagement/LoginResponse.cs
index 18989cb0..0cd2dc7a 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/LoginResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/LoginResponse.cs
@@ -3,7 +3,7 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Responses.UsersManagement;
///
/// Represents the response model for a user authentication.
@@ -13,7 +13,7 @@ namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
/// The JWT authentication token, if authentication failed or TOTP is required.
/// Indicates whether the user has Two-Factor Authentication enabled, or not.
[DebuggerDisplay("Username: {Username}")]
-public record LoginResponseModel(
+public record LoginResponse(
Guid Id,
string? Username,
string? Token,
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordResponseModel.cs b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RecoverPasswordResponse.cs
similarity index 81%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RecoverPasswordResponse.cs
index 4a5703f1..514fc5dc 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RecoverPasswordResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RecoverPasswordResponse.cs
@@ -2,13 +2,13 @@
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Responses.UsersManagement;
///
/// Represents the response model for an account password reset request.
///
/// Whether the password was reset or not.
[DebuggerDisplay("IsPasswordReset: {IsPasswordReset}")]
-public record RecoverPasswordResponseModel(
+public record RecoverPasswordResponse(
bool IsPasswordReset
);
diff --git a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterResponseModel.cs b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RegisterResponse.cs
similarity index 85%
rename from src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RegisterResponse.cs
index 7a43ba88..be3fbf96 100644
--- a/src/Lumina.Presentation.Web/Common/Models/UsersManagement/RegisterResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Responses/UsersManagement/RegisterResponse.cs
@@ -3,7 +3,7 @@ using System;
using System.Diagnostics;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
+namespace Lumina.Presentation.Web.Common.Responses.UsersManagement;
///
/// Represents the response model for a successful registration.
@@ -11,7 +11,7 @@ namespace Lumina.Presentation.Web.Common.Models.UsersManagement;
/// The username of the registered user.
/// The TOTP (Time-Based One-Time Password) secret used for two-factor authentication.
[DebuggerDisplay("Username: {Username}")]
-public record RegisterResponseModel(
+public record RegisterResponse(
string? Username,
string? TotpSecret
);
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authentication.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authentication.cs
new file mode 100644
index 00000000..0d17674c
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authentication.cs
@@ -0,0 +1,19 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the authentication endpoints of the remote API.
+ ///
+ public static class Authentication
+ {
+ public const string REGISTER_ACCOUNT = "auth/register";
+ public const string LOGIN_ACCOUNT = "auth/login";
+ public const string RECOVER_PASSWORD = "auth/recover-password";
+ public const string CHANGE_PASSWORD = "auth/change-password";
+ public const string USERS = "auth/users";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authorization.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authorization.cs
new file mode 100644
index 00000000..d1b2a239
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Authorization.cs
@@ -0,0 +1,18 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the authorization endpoints of the remote API.
+ ///
+ public static class Authorization
+ {
+ public const string UPDATE_USER_ROLE_AND_PERMISSIONS_BY_USER_ID = "auth/users/{userId}/role-and-permissions";
+ public const string GET_USER_PERMISSIONS_BY_USER_ID = "auth/users/{userId}/permissions";
+ public const string GET_USER_ROLE_BY_USER_ID = "auth/users/{userId}/role";
+ public const string GET_AUTHORIZATION = "auth/get-authorization";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Books.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Books.cs
new file mode 100644
index 00000000..c3aa70eb
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Books.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the books endpoints of the remote API.
+ ///
+ public static class Books
+ {
+ public const string GET_BOOKS_LITE = "books/lite";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Directories.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Directories.cs
new file mode 100644
index 00000000..f79175fb
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Directories.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the directories endpoints of the remote API.
+ ///
+ public static class Directories
+ {
+ public const string GET_DIRECTORIES = "directories/get-directories";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Drives.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Drives.cs
new file mode 100644
index 00000000..288d9d14
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Drives.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the drives endpoints of the remote API.
+ ///
+ public static class Drives
+ {
+ public const string GET_DRIVES = "drives/get-drives";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.FileSystem.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.FileSystem.cs
new file mode 100644
index 00000000..b317b02b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.FileSystem.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the file system endpoints of the remote API.
+ ///
+ public static class FileSystem
+ {
+ public const string GET_TYPES = "file-system/get-type";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Files.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Files.cs
new file mode 100644
index 00000000..2d5d3c78
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Files.cs
@@ -0,0 +1,16 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the files endpoints of the remote API.
+ ///
+ public static class Files
+ {
+ public const string GET_TREE_FILES = "files/get-tree-files";
+ public const string GET_FILES = "files/get-files";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Initialization.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Initialization.cs
new file mode 100644
index 00000000..7f7921c0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Initialization.cs
@@ -0,0 +1,16 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the initialization endpoint of the remote API.
+ ///
+ public static class Initialization
+ {
+ public const string SETUP_APPLICATION = "initialization";
+ public const string CHECK_INITIALIZATION = "initialization";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs
new file mode 100644
index 00000000..ceef0553
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs
@@ -0,0 +1,28 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the media libraries endpoints of the remote API.
+ ///
+ public static class Libraries
+ {
+ public const string GET_LIBRARY_BY_ID = "libraries/{id}";
+ public const string GET_LIBRARIES = "libraries";
+ public const string GET_ENABLED_LIBRARIES = "libraries/enabled";
+ public const string ADD_LIBRARY = "libraries";
+ public const string UPDATE_LIBRARY = "libraries/{id}";
+ public const string DELETE_LIBRARY = "libraries/{id}";
+ public const string SCAN_LIBRARIES = "libraries/scans";
+ public const string SCAN_LIBRARY = "libraries/{id}/scans";
+ public const string GET_RUNNING_LIBRARIES_SCAN = "libraries/scans/running";
+ public const string CANCEL_LIBRARIES_SCAN = "libraries/scans/cancel";
+ public const string CANCEL_LIBRARY_SCAN = "libraries/{libraryId}/scans/{scanId}/cancel";
+ public const string GET_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers";
+ public const string SET_LIBRARY_METADATA_PROVIDER_ENABLED = "libraries/{libraryId}/metadata-providers/{pluginId}/enabled";
+ public const string REORDER_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers/reorder";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Path.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Path.cs
new file mode 100644
index 00000000..4e056a6a
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Path.cs
@@ -0,0 +1,20 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the paths endpoints of the remote API.
+ ///
+ public static class Path
+ {
+ public const string GET_PATH_ROOT = "path/get-path-root";
+ public const string GET_PATH_SEPARATOR = "path/get-path-separator";
+ public const string GET_PATH_PARENT = "path/get-path-parent";
+ public const string SPLIT = "path/split";
+ public const string VALIDATE = "path/validate";
+ public const string CHECK_PATH_EXISTS = "path/check-path-exists";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Permissions.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Permissions.cs
new file mode 100644
index 00000000..5ccaf316
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Permissions.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the permissions endpoints of the remote API.
+ ///
+ public static class Permissions
+ {
+ public const string GET_PERMISSIONS = "auth/permissions";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Plugins.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Plugins.cs
new file mode 100644
index 00000000..1371d505
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Plugins.cs
@@ -0,0 +1,17 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the plugins endpoints of the remote API.
+ ///
+ public static class Plugins
+ {
+ public const string GET_PLUGINS = "plugins";
+ public const string GET_PLUGIN_SETTINGS = "plugins/{pluginId}/settings";
+ public const string UPDATE_PLUGIN_SETTINGS = "plugins/{pluginId}/settings";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Roles.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Roles.cs
new file mode 100644
index 00000000..09691d9b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Roles.cs
@@ -0,0 +1,19 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the roles endpoints of the remote API.
+ ///
+ public static class Roles
+ {
+ public const string GET_ROLE_PERMISSIONS_BY_ROLE_ID = "auth/roles/{roleId}/permissions";
+ public const string GET_ROLES = "auth/roles";
+ public const string CREATE_ROLE = "auth/roles";
+ public const string UPDATE_ROLE = "auth/roles";
+ public const string DELETE_ROLE = "auth/roles/{roleId}";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs
new file mode 100644
index 00000000..7ef9fa39
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs
@@ -0,0 +1,16 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the users endpoints of the remote API.
+ ///
+ public static class Users
+ {
+ public const string GET_USER_SETTINGS = "users/me/settings";
+ public const string UPDATE_USER_SETTINGS = "users/me/settings";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Admin.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Admin.cs
new file mode 100644
index 00000000..618d0b55
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Admin.cs
@@ -0,0 +1,24 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the administrator pages.
+ ///
+ public static class Admin
+ {
+ public const string MANAGE_ROLES = "{culture}/admin/manage-roles";
+ public const string MANAGE_PERMISSIONS = "{culture}/admin/manage-permissions";
+ public const string GET_PERMISSIONS_BY_ROLE_ID = "{culture}/admin/api-get-permissions-by-role-id/{roleId}";
+ public const string GET_PERMISSIONS_BY_USER_ID = "{culture}/admin/api-get-permissions-by-user-id/{userId}";
+ public const string GET_ROLE_BY_USER_ID = "{culture}/admin/api-get-role-by-user-id/{userId}";
+ public const string GET_ROLES = "{culture}/admin/api-get-roles";
+ public const string CREATE_ROLE = "{culture}/admin/api-create-role";
+ public const string UPDATE_ROLE = "{culture}/admin/api-update-role";
+ public const string DELETE_ROLE = "{culture}/admin/api-delete-role/{roleId}";
+ public const string UPDATE_USER_AUTHORIZATION = "{culture}/admin/api-update-user-authorization";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Authentication.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Authentication.cs
new file mode 100644
index 00000000..60cb1ced
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Authentication.cs
@@ -0,0 +1,25 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the authentication pages.
+ ///
+ public static class Authentication
+ {
+ public const string REGISTER_VIEW = "{culture}/auth/register";
+ public const string LOGIN_VIEW = "{culture}/auth/login/{returnUrl?}";
+ public const string RECOVER_PASSWORD_VIEW = "{culture}/auth/recover-password";
+ public const string CHANGE_PASSWORD_VIEW = "{culture}/auth/change-password";
+ public const string PROFILE_VIEW = "{culture}/auth/profile";
+ public const string ACCESS_DENIED_VIEW = "{culture}/auth/access-denied";
+ public const string LOGOUT = "{culture}/auth/logout";
+ public const string REGISTER = "{culture}/auth/api-register";
+ public const string LOGIN = "{culture}/auth/api-login";
+ public const string RECOVER_PASSWORD = "{culture}/auth/api-recover-password";
+ public const string CHANGE_PASSWORD = "{culture}/auth/api-change-password";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Books.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Books.cs
new file mode 100644
index 00000000..1b5c58c2
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Books.cs
@@ -0,0 +1,17 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the books pages.
+ ///
+ public static class Books
+ {
+ public const string INDEX = "{culture}/library/written-content-library/books-library/books";
+ public const string GET_LIBRARY_ITEMS = "{culture}/library/written-content-library/books-library/books/api-get-library-items";
+ public const string EDIT_BOOK = "{culture}/library/written-content-library/books-library/books/{id}";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Directories.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Directories.cs
new file mode 100644
index 00000000..921c3392
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Directories.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the file system directories endpoints.
+ ///
+ public static class Directories
+ {
+ public const string GET_DIRECTORIES = "directories/api-get-directories";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Drives.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Drives.cs
new file mode 100644
index 00000000..23a36942
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Drives.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the file system drives endpoints.
+ ///
+ public static class Drives
+ {
+ public const string GET_DRIVES = "drives/api-get-drives";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.FileSystem.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.FileSystem.cs
new file mode 100644
index 00000000..e1b550de
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.FileSystem.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the file system endpoints.
+ ///
+ public static class FileSystem
+ {
+ public const string GET_TYPE = "file-system/api-get-type";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Files.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Files.cs
new file mode 100644
index 00000000..9756c9c7
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Files.cs
@@ -0,0 +1,16 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the file system files endpoints.
+ ///
+ public static class Files
+ {
+ public const string GET_TREE_FILES = "files/api-get-tree-files";
+ public const string GET_FILES = "files/api-get-files";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Home.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Home.cs
new file mode 100644
index 00000000..9cde8458
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Home.cs
@@ -0,0 +1,19 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the home pages.
+ ///
+ public static class Home
+ {
+ public const string INDEX = "/";
+ public const string INDEX_CULTURED = "{culture}";
+ public const string PRIVACY = "{culture}/privacy";
+ public const string ERROR = "{culture}/error";
+ public const string NOT_FOUND = "{culture}/not-found";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Language.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Language.cs
new file mode 100644
index 00000000..5c2938e8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Language.cs
@@ -0,0 +1,15 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the language tool pages.
+ ///
+ public static class Language
+ {
+ public const string SET_LANGUAGE = "{culture}/tools/language/set-language";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs
new file mode 100644
index 00000000..3a54fc3a
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs
@@ -0,0 +1,29 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the media libraries management pages.
+ ///
+ public static class LibraryManagement
+ {
+ public const string INDEX = "{culture}/libraries/manage";
+ public const string ADD_LIBRARY = "{culture}/libraries/manage/item";
+ public const string EDIT_LIBRARY = "{culture}/libraries/manage/item/{id}";
+ public const string GET_LIBRARIES = "{culture}/libraries/manage/api-get-libraries";
+ public const string GET_ENABLED_LIBRARIES = "{culture}/libraries/manage/api-get-enabled-libraries";
+ public const string SAVE_LIBRARY = "{culture}/libraries/manage/api-item";
+ public const string DELETE_LIBRARY = "{culture}/libraries/manage/api-item/{id}";
+ public const string GET_RUNNING_LIBRARY_SCANS = "{culture}/libraries/manage/api-get-running-library-scans";
+ public const string SCAN_LIBRARIES = "{culture}/libraries/manage/api-scan-libraries";
+ public const string SCAN_LIBRARY = "{culture}/libraries/manage/api-scan-library/{id}";
+ public const string CANCEL_LIBRARIES_SCAN = "{culture}/libraries/manage/api-cancel-libraries-scan";
+ public const string CANCEL_LIBRARY_SCAN = "{culture}/libraries/manage/{libraryId}/api-cancel-library-scan/{scanId}";
+ public const string GET_METADATA_PROVIDERS = "{culture}/libraries/manage/api-get-metadata-providers/{libraryId}";
+ public const string SET_METADATA_PROVIDER_ENABLED = "{culture}/libraries/manage/api-set-metadata-provider-enabled";
+ public const string REORDER_METADATA_PROVIDERS = "{culture}/libraries/manage/api-reorder-metadata-providers";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Path.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Path.cs
new file mode 100644
index 00000000..ebc7bab3
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Path.cs
@@ -0,0 +1,20 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the file system paths endpoints.
+ ///
+ public static class Path
+ {
+ public const string GET_PATH_ROOT = "path/api-get-path-root";
+ public const string GET_PATH_SEPARATOR = "path/api-get-path-separator";
+ public const string GET_PATH_PARENT = "path/api-get-path-parent";
+ public const string SPLIT_PATH = "path/api-split";
+ public const string VALIDATE_PATH = "path/api-validate";
+ public const string CHECK_PATH_EXISTS = "path/api-check-path-exists";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Plugins.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Plugins.cs
new file mode 100644
index 00000000..6008922e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Plugins.cs
@@ -0,0 +1,18 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the plugins pages.
+ ///
+ public static class Plugins
+ {
+ public const string INDEX = "{culture}/plugins";
+ public const string GET_PLUGINS = "{culture}/plugins/api-get-plugins";
+ public const string GET_PLUGIN_SETTINGS = "{culture}/plugins/api-get-plugin-settings/{pluginId}";
+ public const string UPDATE_PLUGIN_SETTINGS = "{culture}/plugins/api-update-plugin-settings";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs
new file mode 100644
index 00000000..267383c8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs
@@ -0,0 +1,17 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the user settings tool pages.
+ ///
+ public static class Settings
+ {
+ public const string INDEX = "{culture}/tools/settings";
+ public const string GET_USER_SETTINGS = "{culture}/tools/settings/api-get-user-settings";
+ public const string UPDATE_USER_SETTINGS = "{culture}/tools/settings/api-update-user-settings";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs b/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs
index b8480404..ac298e1f 100644
--- a/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs
+++ b/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Configuration;
+using Lumina.Presentation.Web.Common.DTO.Configuration;
using Microsoft.Extensions.Options;
using System;
using System.Security.Cryptography;
@@ -18,10 +18,10 @@ public sealed class CryptographyService : ICryptographyService, IDisposable
///
/// Initializes a new instance of the class.
///
- /// Injected service for retrieving .
- public CryptographyService(IOptions encryptionSettingsModelOptions)
+ /// Injected service for retrieving .
+ public CryptographyService(IOptions encryptionSettingsOptions)
{
- _key = Convert.FromBase64String(encryptionSettingsModelOptions.Value.SecretKey);
+ _key = Convert.FromBase64String(encryptionSettingsOptions.Value.SecretKey);
}
///
diff --git a/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs b/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs
index fe999290..da8a46b5 100644
--- a/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs
+++ b/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs
@@ -1,5 +1,4 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Models.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Hybrid;
using System;
@@ -53,7 +52,7 @@ public class CachedAuthorizationHandler : DelegatingHandler
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
// otherwise, check the hybrid cache to see if there is a cached authorization
- CachedResponseModel response = await _hybridCache.GetOrCreateAsync(
+ CachedResponse response = await _hybridCache.GetOrCreateAsync(
cacheKey,
async (cancellationToken) =>
{
@@ -61,7 +60,7 @@ public class CachedAuthorizationHandler : DelegatingHandler
HttpResponseMessage result = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
string content = await result.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
// cache both status code and content
- return new CachedResponseModel
+ return new CachedResponse
{
Content = content,
StatusCode = result.StatusCode
diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/CachedResponseModel.cs b/src/Lumina.Presentation.Web/Common/Services/CachedResponse.cs
similarity index 88%
rename from src/Lumina.Presentation.Web/Common/Models/Common/CachedResponseModel.cs
rename to src/Lumina.Presentation.Web/Common/Services/CachedResponse.cs
index 3c02aabe..156cc880 100644
--- a/src/Lumina.Presentation.Web/Common/Models/Common/CachedResponseModel.cs
+++ b/src/Lumina.Presentation.Web/Common/Services/CachedResponse.cs
@@ -3,13 +3,13 @@ using System.Diagnostics;
using System.Net;
#endregion
-namespace Lumina.Presentation.Web.Common.Models.Common;
+namespace Lumina.Presentation.Web.Common.Services;
///
/// Represents a cached HTTP response, including its content and status code.
///
[DebuggerDisplay("StatusCode: {StatusCode}")]
-public class CachedResponseModel
+public class CachedResponse
{
///
/// Gets or sets the content of the cached HTTP response.
diff --git a/src/Lumina.Presentation.Web/Common/Services/IUrlService.cs b/src/Lumina.Presentation.Web/Common/Services/IUrlService.cs
index 7542a8dd..93663e4d 100644
--- a/src/Lumina.Presentation.Web/Common/Services/IUrlService.cs
+++ b/src/Lumina.Presentation.Web/Common/Services/IUrlService.cs
@@ -1,16 +1,15 @@
namespace Lumina.Presentation.Web.Common.Services;
///
-/// Interface for the service for generating URLs from action and controller names, with URL localization.
+/// Interface for the service for generating absolute URLs from the application route templates, with URL localization.
///
public interface IUrlService
{
///
- /// Generates an absolute URL for the specified controller action.
+ /// Generates an absolute URL for the specified route template.
///
- /// The action name within the controller.
- /// The controller name.
- /// Optional additional route values, like query parameters.
- /// An absolute URL to the specified action.
- string? GetAbsoluteUrl(string action, string controller, object? additionalRouteValues = null);
+ /// The route template of the target page or endpoint, taken from the constants.
+ /// Optional additional route values, like route parameters.
+ /// An absolute URL to the specified route.
+ string? GetAbsoluteUrl(string routeTemplate, object? additionalRouteValues = null);
}
diff --git a/src/Lumina.Presentation.Web/Common/Services/UrlService.cs b/src/Lumina.Presentation.Web/Common/Services/UrlService.cs
index 1f3cfd9f..acc29775 100644
--- a/src/Lumina.Presentation.Web/Common/Services/UrlService.cs
+++ b/src/Lumina.Presentation.Web/Common/Services/UrlService.cs
@@ -1,71 +1,73 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Routes;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Routing;
using System;
-using System.Linq;
+using System.Collections.Generic;
using System.Reflection;
#endregion
namespace Lumina.Presentation.Web.Common.Services;
///
-/// Service for generating URLs from action and controller names, with URL localization.
+/// Service for generating absolute URLs for the application routes, with URL localization.
///
public class UrlService : IUrlService
{
- private readonly LinkGenerator _linkGenerator;
private readonly IHttpContextAccessor _httpContextAccessor;
- private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider;
+
+ ///
+ /// The collection of route templates defined in the constants, used to validate the requested routes.
+ ///
+ private static readonly HashSet s_knownRouteTemplates = GetKnownRouteTemplates();
///
/// Initializes a new instance of the class.
///
- /// The ASP.NET Core link generator service.
/// Provides access to the current HTTP context.
- /// The used to retrieve information about the application's routes and actions.
- public UrlService(LinkGenerator linkGenerator, IHttpContextAccessor httpContextAccessor, IActionDescriptorCollectionProvider actionDescriptorCollectionProvider)
+ public UrlService(IHttpContextAccessor httpContextAccessor)
{
- _linkGenerator = linkGenerator;
_httpContextAccessor = httpContextAccessor;
- _actionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
}
///
- /// Generates an absolute URL for the specified controller action.
+ /// Generates an absolute URL for the specified route template.
///
- /// The action name within the controller.
- /// The controller name.
- /// Optional additional route values, like query parameters.
- /// An absolute URL to the specified action.
- public string? GetAbsoluteUrl(string action, string controller, object? additionalRouteValues = null)
+ /// The route template of the target page or endpoint, taken from the constants.
+ /// Optional additional route values, like route parameters.
+ /// An absolute URL to the specified route.
+ /// Thrown when is not one of the route templates defined in the constants.
+ public string? GetAbsoluteUrl(string routeTemplate, object? additionalRouteValues = null)
{
+ // fail fast when the route template is not one of the ones defined in the WebRoutes constants, instead of silently generating a broken URL
+ if (!s_knownRouteTemplates.Contains(routeTemplate))
+ throw new ArgumentException($"The route template '{routeTemplate}' is not defined in the WebRoutes constants.", nameof(routeTemplate));
+
HttpContext? httpContext = _httpContextAccessor.HttpContext;
if (httpContext is null)
return null;
- string scheme = httpContext.Request.Scheme;
string culture = httpContext.Request.RouteValues["culture"]?.ToString() ?? "en-US";
- // find the controller's route template
- ControllerActionDescriptor? controllerActionDescriptor = _actionDescriptorCollectionProvider
- .ActionDescriptors.Items
- .OfType()
- .FirstOrDefault(controllerActionDescription =>
- controllerActionDescription.ControllerName.Equals(controller, StringComparison.OrdinalIgnoreCase) &&
- controllerActionDescription.ActionName.Equals(action, StringComparison.OrdinalIgnoreCase));
- if (controllerActionDescriptor is null)
- return null;
- // check if the route template contains {culture}
- string? routeTemplate = controllerActionDescriptor.AttributeRouteInfo?.Template;
- bool needsCulture = routeTemplate?.Contains("{culture}") == true;
- // merge culture and additional values
- RouteValueDictionary routeValues = [];
- if (needsCulture)
- routeValues.Add("culture", culture);
+ string path = routeTemplate.Replace("{culture}", culture, StringComparison.OrdinalIgnoreCase);
if (additionalRouteValues is not null)
- foreach (PropertyInfo prop in additionalRouteValues.GetType().GetProperties())
- routeValues.Add(prop.Name, prop.GetValue(additionalRouteValues));
+ foreach (PropertyInfo property in additionalRouteValues.GetType().GetProperties())
+ path = path.Replace($"{{{property.Name}}}", property.GetValue(additionalRouteValues)?.ToString(), StringComparison.OrdinalIgnoreCase);
+ // ensure the path starts with a slash, so that it is relative to the server root when concatenated with the host and the path base
+ if (!path.StartsWith('/'))
+ path = "/" + path;
+ // build the absolute URL from the request's scheme, host and path base
+ return $"{httpContext.Request.Scheme}://{httpContext.Request.Host}{httpContext.Request.PathBase}{path}";
+ }
- return _linkGenerator.GetUriByAction(httpContext: httpContext, action: action, controller: controller, values: routeValues, scheme: scheme);
+ ///
+ /// Collects the values of all route template constants defined in the class.
+ ///
+ /// The set of the route templates defined in the constants.
+ private static HashSet GetKnownRouteTemplates()
+ {
+ HashSet routeTemplates = [];
+ foreach (Type nestedType in typeof(WebRoutes).GetNestedTypes())
+ foreach (FieldInfo field in nestedType.GetFields(BindingFlags.Public | BindingFlags.Static))
+ if (field.IsLiteral && field.FieldType == typeof(string))
+ routeTemplates.Add((string)field.GetValue(null)!);
+ return routeTemplates;
}
}
diff --git a/src/Lumina.Presentation.Web/Common/Validators/EncryptionSettingsModelValidator.cs b/src/Lumina.Presentation.Web/Common/Validators/EncryptionSettingsModelValidator.cs
index b05311bc..d08fbd42 100644
--- a/src/Lumina.Presentation.Web/Common/Validators/EncryptionSettingsModelValidator.cs
+++ b/src/Lumina.Presentation.Web/Common/Validators/EncryptionSettingsModelValidator.cs
@@ -1,6 +1,6 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
-using Lumina.Presentation.Web.Common.Models.Configuration;
+using Lumina.Presentation.Web.Common.DTO.Configuration;
using System;
using System.Buffers.Text;
#endregion
@@ -10,7 +10,7 @@ namespace Lumina.Presentation.Web.Common.Validators;
///
/// Validates the needed validation rules for the EncryptionSettings application configuration settings section.
///
-public class EncryptionSettingsModelValidator : AbstractValidator
+public class EncryptionSettingsModelValidator : AbstractValidator
{
///
/// Initializes a new instance of the class.
diff --git a/src/Lumina.Presentation.Web/Common/Validators/ServerConfigurationModelValidator.cs b/src/Lumina.Presentation.Web/Common/Validators/ServerConfigurationModelValidator.cs
index 17dcb612..8d8281f8 100644
--- a/src/Lumina.Presentation.Web/Common/Validators/ServerConfigurationModelValidator.cs
+++ b/src/Lumina.Presentation.Web/Common/Validators/ServerConfigurationModelValidator.cs
@@ -1,6 +1,6 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
-using Lumina.Presentation.Web.Common.Models.Configuration;
+using Lumina.Presentation.Web.Common.DTO.Configuration;
#endregion
namespace Lumina.Presentation.Web.Common.Validators;
@@ -8,7 +8,7 @@ namespace Lumina.Presentation.Web.Common.Validators;
///
/// Validates the needed validation rules for the ServerConfiguration application configuration settings section.
///
-public class ServerConfigurationModelValidator : AbstractValidator
+public class ServerConfigurationModelValidator : AbstractValidator
{
///
/// Initializes a new instance of the class.
diff --git a/src/Lumina.Presentation.Web/Controllers/AdminController.cs b/src/Lumina.Presentation.Web/Controllers/AdminController.cs
deleted file mode 100644
index d09fc47d..00000000
--- a/src/Lumina.Presentation.Web/Controllers/AdminController.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Attributes;
-using Lumina.Presentation.Web.Common.Models.Authorization;
-using Lumina.Presentation.Web.Common.Models.UsersManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers;
-
-///
-/// Controller for administrator related operations.
-///
-[Authorize]
-[RequireRole("Admin")]
-[Route("{culture}/admin")]
-public class AdminController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public AdminController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Displays the view for managing authorization roles.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("manage-roles")]
- public async Task ManageRoles(CancellationToken cancellationToken)
- {
- // get the list of roles and permissions from the API
- ViewData["roles"] = await _apiHttpClient.GetAsync($"auth/roles/", cancellationToken).ConfigureAwait(false);
- ViewData["permissions"] = await _apiHttpClient.GetAsync($"auth/permissions/", cancellationToken).ConfigureAwait(false);
- return View();
- }
-
- ///
- /// Displays the view for managing authorization permissions.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("manage-permissions")]
- public async Task ManagePermissions(CancellationToken cancellationToken)
- {
- ViewData["users"] = await _apiHttpClient.GetAsync($"auth/users", cancellationToken).ConfigureAwait(false);
- ViewData["roles"] = await _apiHttpClient.GetAsync($"auth/roles/", cancellationToken).ConfigureAwait(false);
- ViewData["permissions"] = await _apiHttpClient.GetAsync($"auth/permissions/", cancellationToken).ConfigureAwait(false);
- return View();
- }
-
- ///
- /// Gets the authorization permissions of a role identified by .
- ///
- /// The unique identifier of the role for which to get the list of permissions.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-permissions-by-role-id/{roleId}")]
- public async Task GetPermissionsByRoleId(Guid roleId, CancellationToken cancellationToken)
- {
- RolePermissionsModel response = await _apiHttpClient.GetAsync($"auth/roles/{roleId}/permissions", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the authorization permissions of a user identified by .
- ///
- /// The unique identifier of the user for whom to get the list of permissions.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-permissions-by-user-id/{userId}")]
- public async Task GetPermissionsByUserId(Guid userId, CancellationToken cancellationToken)
- {
- PermissionModel[] response = await _apiHttpClient.GetAsync($"auth/users/{userId}/permissions", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the authorization role of a user identified by .
- ///
- /// The unique identifier of the user for whom to get the role.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-role-by-user-id/{userId}")]
- public async Task GetRoleByUserId(Guid userId, CancellationToken cancellationToken)
- {
- RoleModel? response = await _apiHttpClient.GetAsync($"auth/users/{userId}/role", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the collection of authorization roles.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-roles")]
- public async Task GetRoles(CancellationToken cancellationToken)
- {
- RoleModel[] response = await _apiHttpClient.GetAsync($"auth/roles/", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Creates an authorization role with the specified name and associated permissions.
- ///
- /// The model containing the data of the role to be created.
- /// Cancellation token that can be used to stop the execution.
- [HttpPost("api-create-role")]
- public async Task CreateRole([FromBody] AddRoleRequestModel model, CancellationToken cancellationToken)
- {
- RolePermissionsModel response = await _apiHttpClient.PostAsync($"auth/roles/", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Updates an authorization role with the specified name and associated permissions.
- ///
- /// The model containing the data of the role to be updated.
- /// Cancellation token that can be used to stop the execution.
- [HttpPut("api-update-role")]
- public async Task UpdateRole([FromBody] UpdateRoleRequestModel model, CancellationToken cancellationToken)
- {
- RolePermissionsModel response = await _apiHttpClient.PutAsync($"auth/roles/", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Deletes an authorization role.
- ///
- /// The unique identifier of the role to be deleted.
- /// Cancellation token that can be used to stop the execution.
- [HttpDelete("api-delete-role/{roleId}")]
- public async Task DeleteRole(Guid roleId, CancellationToken cancellationToken)
- {
- await _apiHttpClient.DeleteAsync($"auth/roles/{roleId}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-
- ///
- /// Updates an authorization role with the specified name and associated permissions.
- ///
- /// The model containing the data of the role to be updated.
- /// Cancellation token that can be used to stop the execution.
- [HttpPut("api-update-user-authorization")]
- public async Task UpdateUserAuthorization([FromBody] UpdateUserRoleAndPermissionsRequestModel model, CancellationToken cancellationToken)
- {
- GetAuthorizationResponse response = await _apiHttpClient.PutAsync($"auth/users/{model.UserId}/role-and-permissions", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DirectoriesController.cs b/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DirectoriesController.cs
deleted file mode 100644
index d81b169d..00000000
--- a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DirectoriesController.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.FileSystemManagement;
-
-///
-/// Controller for managing file system directories.
-///
-[Authorize]
-[Route("directories")]
-public class DirectoriesController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public DirectoriesController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Gets the directories of .
- ///
- /// The path for which to get the directories.
- /// Whether to include hidden file system elements or not.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-directories")]
- public async Task GetDirectories([FromQuery] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
- {
- IEnumerable response = await _apiHttpClient.GetAsync(
- $"directories/get-directories?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DrivesController.cs b/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DrivesController.cs
deleted file mode 100644
index b3b5efe9..00000000
--- a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/DrivesController.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.FileSystemManagement;
-
-///
-/// Controller for managing file system drives.
-///
-[Authorize]
-[Route("drives")]
-public class DrivesController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public DrivesController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Controller action for getting the list of all file system drives.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-drives")]
- public async Task GetDrives(CancellationToken cancellationToken)
- {
- FileSystemTreeNodeModel[] response = await _apiHttpClient.GetAsync($"drives/get-drives", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { drives = response } });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FileSystemController.cs b/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FileSystemController.cs
deleted file mode 100644
index 3844edaf..00000000
--- a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FileSystemController.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.FileSystemManagement;
-
-///
-/// Controller for managing file systems.
-///
-[Authorize]
-[Route("file-system")]
-public class FileSystemController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public FileSystemController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Gets the type of the file system.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-type")]
- public async Task GetType(CancellationToken cancellationToken)
- {
- FileSystemTypeModel response = await _apiHttpClient.GetAsync($"file-system/get-type", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { platformType = response.PlatformType.ToString() } });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FilesController.cs b/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FilesController.cs
deleted file mode 100644
index ab1a5517..00000000
--- a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/FilesController.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.FileSystemManagement;
-
-///
-/// Controller for managing file system files.
-///
-[Authorize]
-[Route("files")]
-public class FilesController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public FilesController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Gets the files of .
- ///
- /// The path for which to get the files.
- /// Whether to include hidden file system elements or not.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-tree-files")]
- public async Task GetTreeFiles([FromQuery] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
- {
- IEnumerable response = await _apiHttpClient.GetAsync(
- $"files/get-tree-files?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the files of .
- ///
- /// The path for which to get the files.
- /// Whether to include hidden file system elements or not.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-files")]
- public async Task GetFiles([FromQuery] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
- {
- // TODO: check if it's really used
- IEnumerable response = await _apiHttpClient.GetAsync(
- $"files/get-files?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/PathController.cs b/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/PathController.cs
deleted file mode 100644
index 177a63a8..00000000
--- a/src/Lumina.Presentation.Web/Controllers/FileSystemManagement/PathController.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.FileSystemManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.FileSystemManagement;
-
-///
-/// Controller for managing file system paths.
-///
-[Authorize]
-[Route("path")]
-public class PathController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public PathController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Gets the root of .
- ///
- /// The path for which to get the root.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-path-root")]
- public async Task GetPathRoot([FromQuery] string path, CancellationToken cancellationToken)
- {
- // TODO: check if it's really used
- PathSegmentModel response = await _apiHttpClient.GetAsync($"path/get-path-root?path={Uri.EscapeDataString(path)}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { root = response } });
- }
-
- ///
- /// Gets the path separator character of the file system.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-path-separator")]
- public async Task GetPathSeparator(CancellationToken cancellationToken)
- {
- PathSeparatorModel response = await _apiHttpClient.GetAsync($"path/get-path-separator", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { pathSeparator = response.Separator } });
- }
-
- ///
- /// Gets the path separator character of the file system.
- ///
- /// The path for which to get the parent path.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-path-parent")]
- public async Task GetPathParent([FromQuery] string path, CancellationToken cancellationToken)
- {
- PathSegmentModel[] response = await _apiHttpClient.GetAsync($"path/get-path-parent?path={Uri.EscapeDataString(path)}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { pathSegments = response } });
- }
-
- ///
- /// Gets the path components of .
- ///
- /// The path for which to get the path segments.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-split")]
- public async Task SplitPath([FromQuery] string path, CancellationToken cancellationToken)
- {
- PathSegmentModel[] response = await _apiHttpClient.GetAsync($"path/split?path={Uri.EscapeDataString(path)}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { pathSegments = response } });
- }
-
- ///
- /// Validates the validity of .
- ///
- /// The path to be validated.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-validate")]
- public async Task ValidatePath([FromQuery] string path, CancellationToken cancellationToken)
- {
- PathValidModel response = await _apiHttpClient.GetAsync($"path/validate?path={Uri.EscapeDataString(path)}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { isValid = response.IsValid } });
- }
-
- ///
- /// Checks whether exists or not.
- ///
- /// The path to be checked.
- /// Whether to include hidden file system elements or not.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-check-path-exists")]
- public async Task CheckPathExists([FromQuery] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
- {
- PathExistsModel response = await _apiHttpClient.GetAsync(
- $"path/check-path-exists?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { exists = response.Exists } });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/HomeController.cs b/src/Lumina.Presentation.Web/Controllers/HomeController.cs
deleted file mode 100644
index fd9dcf02..00000000
--- a/src/Lumina.Presentation.Web/Controllers/HomeController.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Models;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using System.Diagnostics;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers;
-
-///
-/// Controller for home page.
-///
-[Authorize]
-[Route("")] // handle root path - this is needed because app.UseCultureRedirect will redirect to the correct route
-[Route("{culture}")] // culture-specific routes
-public class HomeController : Controller
-{
- private readonly ILogger _logger;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for logging.
- public HomeController(ILogger logger)
- {
- _logger = logger;
- }
-
- ///
- /// Displays the view for the home page.
- ///
- [HttpGet("")]
- public IActionResult Index()
- {
- return View();
- }
-
- ///
- /// Displays the view for privacy.
- ///
- [HttpGet("privacy")]
- public IActionResult Privacy()
- {
- return View();
- }
-
- ///
- /// Displays the view for errors.
- ///
- [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
- [HttpGet("error")]
- public IActionResult Error()
- {
- return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
- }
-
- ///
- /// Displays the view for errors.
- ///
- [HttpGet("not-found")]
- public IActionResult NotFoundView()
- {
- return View("/Views/Shared/NotFound.cshtml");
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs b/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs
deleted file mode 100644
index 57d511b9..00000000
--- a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs
+++ /dev/null
@@ -1,212 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Attributes;
-using Lumina.Presentation.Web.Common.Enums.Authorization;
-using Lumina.Presentation.Web.Common.Models.Common;
-using Lumina.Presentation.Web.Common.Models.Libraries;
-using Lumina.Presentation.Web.Common.Models.Plugins;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.Library.Management;
-
-///
-/// Controller for media libraries related operations.
-///
-[Authorize]
-[Route("{culture}/libraries/manage")]
-public class LibraryManagementController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public LibraryManagementController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Displays the view for displaying the list of media libraries.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("")]
- public IActionResult Index()
- {
- return View("/Views/Library/Management/Index.cshtml");
- }
-
- ///
- /// Displays the view for adding a media library.
- ///
- [HttpGet("item")]
- public IActionResult AddLibrary()
- {
- LibraryModel library = new();
- return View("/Views/Library/Management/Item.cshtml", library);
- }
-
- ///
- /// Displays the view for editing a media library.
- ///
- /// The id of the media library to edit.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("item/{id}")]
- public async Task EditLibrary(Guid id, CancellationToken cancellationToken = default)
- {
- LibraryModel response = await _apiHttpClient.GetAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false);
- return View("/Views/Library/Management/Item.cshtml", response);
- }
-
- ///
- /// Gets the list of media libraries.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-libraries")]
- public async Task GetLibraries(CancellationToken cancellationToken = default)
- {
- LibraryModel[] response = await _apiHttpClient.GetAsync($"libraries/", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the list of enabled media libraries.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-enabled-libraries")]
- public async Task GetEnabledLibraries(CancellationToken cancellationToken = default)
- {
- LibraryModel[] response = await _apiHttpClient.GetAsync($"libraries/enabled/", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Adds a new media library, or updates an existing one.
- ///
- /// The model containing the new library data.
- /// Cancellation token that can be used to stop the execution.
- [ValidateAntiForgeryToken]
- [HttpPost("api-item")]
- [RequirePermission(AuthorizationPermission.CanCreateLibraries)]
- public async Task SaveLibrary([FromBody] LibraryModel data, CancellationToken cancellationToken)
- {
- // TODO: 1. this also needs to send the image files themselves to the API, since the server could be remote; for now, it assumes local paths which it can later read, which works only if the server is local too
- // call different API endpoints based on whether this is a new library or an existing one
- LibraryModel response = data.Id.HasValue
- ? await _apiHttpClient.PutAsync($"libraries/{data.Id}", data, cancellationToken).ConfigureAwait(false)
- : await _apiHttpClient.PostAsync("libraries", data, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Deletes a media library.
- ///
- /// The id of the media library to delete.
- /// Cancellation token that can be used to stop the execution.
- [HttpDelete("api-item/{id}")]
- public async Task DeleteLibrary(Guid id, CancellationToken cancellationToken = default)
- {
- await _apiHttpClient.DeleteAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-
- ///
- /// Gets the list of ongoing media library scans.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-running-library-scans")]
- public async Task GetRunningLibraryScans(CancellationToken cancellationToken = default)
- {
- LibraryScanProgressModel[] response = await _apiHttpClient.GetAsync($"libraries/scans/running/", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Initiates the scan of all media libraries.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpPost("api-scan-libraries")]
- public async Task ScanAllLibraries(CancellationToken cancellationToken = default)
- {
- ScanLibraryModel[] response = await _apiHttpClient.PostAsync($"libraries/scans", new EmptyModel(), cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Initiates the scan of a media library.
- ///
- /// The id of the media library whose scan is started.
- /// Cancellation token that can be used to stop the execution.
- [HttpPost("api-scan-library/{id}")]
- public async Task ScanLibrary(Guid id, CancellationToken cancellationToken = default)
- {
- ScanLibraryModel response = await _apiHttpClient.PostAsync($"libraries/{id}/scans", new EmptyModel(), cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Cancels the previously started scan of all media libraries.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpPost("api-cancel-libraries-scan")]
- public async Task CancelLibrariesScan(CancellationToken cancellationToken = default)
- {
- await _apiHttpClient.PostAsync($"libraries/scans/cancel", new EmptyModel(), cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-
- ///
- /// Cancels the previously started scan of a media library.
- ///
- /// The id of the media library whose scan is cancelled.
- /// The id of the scan to cancel.
- /// Cancellation token that can be used to stop the execution.
- [HttpPost("{libraryId:guid}/api-cancel-library-scan/{scanId:guid}")]
- public async Task CancelLibraryScan(Guid libraryId, Guid scanId, CancellationToken cancellationToken = default)
- {
- await _apiHttpClient.PostAsync($"libraries/{libraryId}/scans/{scanId}/cancel", new EmptyModel(), cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-
- ///
- /// Gets the metadata providers configured for the media library identified by .
- ///
- /// The id of the media library whose metadata providers are retrieved.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-metadata-providers/{libraryId}")]
- public async Task GetMetadataProviders(Guid libraryId, CancellationToken cancellationToken = default)
- {
- LibraryMetadataProviderModel[] response = await _apiHttpClient.GetAsync($"libraries/{libraryId}/metadata-providers", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Enables or disables the metadata provider for the media library described by .
- ///
- /// The model containing the Ids of the media library and of the metadata provider.
- /// Cancellation token that can be used to stop the execution.
- [HttpPut("api-set-metadata-provider-enabled")]
- public async Task SetMetadataProviderEnabled([FromBody] SetLibraryMetadataProviderEnabledModel model, CancellationToken cancellationToken = default)
- {
- await _apiHttpClient.PutAsync($"libraries/{model.LibraryId}/metadata-providers/{model.PluginId}/enabled", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-
- ///
- /// Reorders the metadata providers of the media library described by .
- ///
- /// The model containing the Id of the media library and the plugin Ids in the new order.
- /// Cancellation token that can be used to stop the execution.
- [HttpPut("api-reorder-metadata-providers")]
- public async Task ReorderMetadataProviders([FromBody] ReorderLibraryMetadataProvidersModel model, CancellationToken cancellationToken = default)
- {
- await _apiHttpClient.PutAsync($"libraries/{model.LibraryId}/metadata-providers/reorder", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/Library/WrittenContentLibrary/BookLibrary/BooksController.cs b/src/Lumina.Presentation.Web/Controllers/Library/WrittenContentLibrary/BookLibrary/BooksController.cs
deleted file mode 100644
index fa138956..00000000
--- a/src/Lumina.Presentation.Web/Controllers/Library/WrittenContentLibrary/BookLibrary/BooksController.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.Libraries;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.Library.WrittenContentLibrary.BookLibrary;
-
-///
-/// Controller for books related operations.
-///
-[Authorize]
-[Route("{culture}/library/written-content-library/books-library/books")]
-public class BooksController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public BooksController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Displays the view for browsing the books of a media library.
- ///
- /// The Id of the media library whose books are browsed.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("")]
- public async Task Index(Guid? libraryId, CancellationToken cancellationToken = default)
- {
- if (libraryId is null)
- return RedirectToAction("Index", "Home");
-
- LibraryModel library = await _apiHttpClient.GetAsync($"libraries/{libraryId}", cancellationToken).ConfigureAwait(false);
- return View("/Views/Library/WrittenContentLibrary/BookLibrary/Books/Index.cshtml", library);
- }
-
- ///
- /// Gets the lightweight details of the books of a media library.
- ///
- /// The model containing the parameters used to retrieve the books.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-library-items")]
- public async Task GetLibraryItems([FromQuery] BookLibraryItemsQueryModel query, CancellationToken cancellationToken = default)
- {
- PaginatedBookLiteModel response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(query), cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Displays the view for a single book.
- ///
- /// The Id of the book to display.
- [HttpGet("{id}")]
- public IActionResult EditBook(Guid id)
- {
- return View("/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml");
- }
-
- ///
- /// Builds the API endpoint used to retrieve the lightweight details of the books of a media library, from the provided .
- ///
- /// The model containing the parameters used to retrieve the books.
- /// The API endpoint to which the retrieval request is sent.
- private static string BuildItemsEndpoint(BookLibraryItemsQueryModel query)
- {
- StringBuilder endpoint = new($"books/lite?libraryId={query.LibraryId}");
- if (query.CurrentPage is not null)
- endpoint.Append($"¤tPage={query.CurrentPage}");
- if (query.PerPage is not null)
- endpoint.Append($"&perPage={query.PerPage}");
- if (!string.IsNullOrWhiteSpace(query.SearchTerm))
- endpoint.Append($"&searchTerm={Uri.EscapeDataString(query.SearchTerm)}");
- if (!string.IsNullOrWhiteSpace(query.FilterAlphaKey))
- endpoint.Append($"&filterAlphaKey={Uri.EscapeDataString(query.FilterAlphaKey)}");
- endpoint.Append($"&ignoreThePrefixForAlphaPicker={query.IgnoreThePrefixForAlphaPicker}");
- if (!string.IsNullOrWhiteSpace(query.SortBy))
- endpoint.Append($"&sortBy={Uri.EscapeDataString(query.SortBy)}");
- if (query.SortOrder is not null)
- endpoint.Append($"&sortOrder={query.SortOrder}");
- return endpoint.ToString();
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/Plugins/PluginsController.cs b/src/Lumina.Presentation.Web/Controllers/Plugins/PluginsController.cs
deleted file mode 100644
index 4bfaff8b..00000000
--- a/src/Lumina.Presentation.Web/Controllers/Plugins/PluginsController.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Attributes;
-using Lumina.Presentation.Web.Common.Enums.Plugins;
-using Lumina.Presentation.Web.Common.Models.Common;
-using Lumina.Presentation.Web.Common.Models.Plugins;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.Plugins;
-
-///
-/// Controller for the plugin management related operations.
-///
-[Authorize]
-[RequireRole("Admin")]
-[Route("{culture}/plugins")]
-public class PluginsController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public PluginsController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Displays the view for managing the plugins and their settings.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("")]
- public async Task Index(CancellationToken cancellationToken)
- {
- PluginModel[] plugins = await _apiHttpClient.GetAsync("plugins", cancellationToken).ConfigureAwait(false);
-
- // load the settings of the loaded plugins, so that the settings forms can be rendered on the server
- Dictionary settingsByPluginId = [];
- foreach (PluginModel plugin in plugins)
- if (plugin.LoadStatus == PluginLoadStatus.Loaded)
- settingsByPluginId[plugin.Id] = await _apiHttpClient.GetAsync($"plugins/{plugin.Id}/settings", cancellationToken).ConfigureAwait(false);
-
- ViewData["pluginSettings"] = settingsByPluginId;
- return View(plugins);
- }
-
- ///
- /// Gets the list of the detected plugins.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-plugins")]
- public async Task GetPlugins(CancellationToken cancellationToken = default)
- {
- PluginModel[] response = await _apiHttpClient.GetAsync("plugins/", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Gets the settings and their schema of the plugin identified by .
- ///
- /// The unique identifier of the plugin.
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-plugin-settings/{pluginId}")]
- public async Task GetPluginSettings(Guid pluginId, CancellationToken cancellationToken = default)
- {
- PluginSettingsModel response = await _apiHttpClient.GetAsync($"plugins/{pluginId}/settings", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Updates the settings of the plugin identified by .
- ///
- /// The model containing the Id of the plugin and its settings.
- /// Cancellation token that can be used to stop the execution.
- [HttpPut("api-update-plugin-settings")]
- public async Task UpdatePluginSettings([FromBody] UpdatePluginSettingsModel model, CancellationToken cancellationToken)
- {
- await _apiHttpClient.PutAsync($"plugins/{model.PluginId}/settings", model, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/Tools/LanguageController.cs b/src/Lumina.Presentation.Web/Controllers/Tools/LanguageController.cs
deleted file mode 100644
index 6d40f560..00000000
--- a/src/Lumina.Presentation.Web/Controllers/Tools/LanguageController.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Services;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Localization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.Tools;
-
-///
-/// Controller for language related operations.
-///
-[Route("{culture}/tools/language")]
-public class LanguageController : Controller
-{
- private readonly IUrlService _urlService;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for generating URLs from action and controller names, with localization.
- public LanguageController(IUrlService urlService)
- {
- _urlService = urlService;
- }
-
- ///
- /// Sets the culture used in the application.
- ///
- /// The new culture to set.
- /// The URL to return to after setting the new culture.
- [HttpGet("set-language")]
- public IActionResult SetLanguage(string newCulture, string returnUrl)
- {
- // store culture preference in cookie
- Response.Cookies.Append(
- CookieRequestCultureProvider.DefaultCookieName,
- CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(newCulture)),
- new CookieOptions
- {
- Expires = DateTimeOffset.UtcNow.AddYears(1),
- IsEssential = true,
- SameSite = SameSiteMode.Lax,
- Path = "/" // ensure cookie works across all paths
- }
- );
- // ensure returnUrl includes the correct culture
- if (string.IsNullOrEmpty(returnUrl))
- returnUrl = _urlService.GetAbsoluteUrl("Index", "Home")!; // default fallback URL
- // handle culture replacement in return URL
- string? currentCulture = HttpContext.Request.RouteValues["culture"]?.ToString() ?? "en-us";
- if (currentCulture != null)
- {
- // ensure we handle both with and without trailing slashes
- string culturePath = $"/{currentCulture.ToLower()}/";
- string newCulturePath = $"/{newCulture.ToLower()}/";
-
- // Handle base path if present
- if (!string.IsNullOrEmpty(Request.PathBase))
- returnUrl = returnUrl.Replace(Request.PathBase.Value!, "", StringComparison.OrdinalIgnoreCase);
- // replace culture in URL
- returnUrl = returnUrl.Replace(culturePath, newCulturePath, StringComparison.OrdinalIgnoreCase);
-
- // re-apply base path if present
- if (!string.IsNullOrEmpty(Request.PathBase))
- returnUrl = Request.PathBase.Value + returnUrl;
- }
- // redirect to the original page
- return LocalRedirect(returnUrl);
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/Tools/SettingsController.cs b/src/Lumina.Presentation.Web/Controllers/Tools/SettingsController.cs
deleted file mode 100644
index c61b2196..00000000
--- a/src/Lumina.Presentation.Web/Controllers/Tools/SettingsController.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Models.Common;
-using Lumina.Presentation.Web.Common.Models.UsersManagement;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.Tools;
-
-///
-/// Controller for the settings of the current user.
-///
-[Authorize]
-[Route("{culture}/tools/settings")]
-public class SettingsController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- public SettingsController(IApiHttpClient apiHttpClient)
- {
- _apiHttpClient = apiHttpClient;
- }
-
- ///
- /// Displays the view for editing the settings of the current user.
- ///
- [HttpGet("")]
- public IActionResult Index()
- {
- UserSettingsModel settings = new();
- return View("/Views/Tools/Settings.cshtml", settings);
- }
-
- ///
- /// Gets the settings of the current user.
- ///
- /// Cancellation token that can be used to stop the execution.
- [HttpGet("api-get-user-settings")]
- public async Task GetUserSettings(CancellationToken cancellationToken = default)
- {
- UserSettingsModel response = await _apiHttpClient.GetAsync("users/me/settings", cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Updates the settings of the current user.
- ///
- /// The model containing the new settings of the current user.
- /// Cancellation token that can be used to stop the execution.
- [ValidateAntiForgeryToken]
- [HttpPost("api-update-user-settings")]
- public async Task UpdateUserSettings([FromBody] UserSettingsModel data, CancellationToken cancellationToken)
- {
- await _apiHttpClient.PutAsync("users/me/settings", data, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = new { isUpdated = true } });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Controllers/UsersManagement/AuthController.cs b/src/Lumina.Presentation.Web/Controllers/UsersManagement/AuthController.cs
deleted file mode 100644
index 59b689de..00000000
--- a/src/Lumina.Presentation.Web/Controllers/UsersManagement/AuthController.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Presentation.Web.Common.Api;
-using Lumina.Presentation.Web.Common.Exceptions;
-using Lumina.Presentation.Web.Common.Filters.ActionFilters;
-using Lumina.Presentation.Web.Common.Http;
-using Lumina.Presentation.Web.Common.Models.UsersManagement;
-using Lumina.Presentation.Web.Common.Security;
-using Lumina.Presentation.Web.Common.Services;
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Authentication.Cookies;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Primitives;
-using System;
-using System.Collections.Generic;
-using System.Security.Claims;
-using System.Text.Json;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Presentation.Web.Controllers.UsersManagement;
-
-///
-/// Controller for authentication related operations.
-///
-[Authorize]
-[Route("{culture}/auth")]
-public class AuthController : Controller
-{
- private readonly IApiHttpClient _apiHttpClient;
- private readonly ICryptographyService _cryptographyService;
- private readonly IUrlService _urlService;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Injected service for interactions with the API.
- /// Injected service for cryptographic functionality.
- /// Injected service for generating URLs from action and controller names, with localization.
- public AuthController(IApiHttpClient apiHttpClient, ICryptographyService cryptographyService, IUrlService urlService)
- {
- _apiHttpClient = apiHttpClient;
- _cryptographyService = cryptographyService;
- _urlService = urlService;
- }
-
- ///
- /// Displays the view for registering a new account.
- ///
- [AllowAnonymous]
- [InitializationCheck]
- [HttpGet("register")]
- public IActionResult Register()
- {
- // check if this is the initial super admin setup
- string? isPendingSuperAdminSetup = HttpContext.Session.GetString(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP);
- ViewData["RegistrationType"] = isPendingSuperAdminSetup == "true" ? "Admin" : "User";
- return View();
- }
-
- ///
- /// Displays the view for logging in.
- ///
- /// The url to return to, after login (if any).
- [AllowAnonymous]
- [InitializationCheck]
- [HttpGet("login/{returnUrl?}")]
- public IActionResult Login(string? returnUrl = null)
- {
- ViewData["ReturnUrl"] = returnUrl;
- // if the user is already logged in, redirect them to the home page
- if (User?.Identity?.IsAuthenticated == true)
- return Redirect(_urlService.GetAbsoluteUrl("Index", "Home")!);
- // check if the application is initialized (does contain at least the super user account); if it's not, redirect to registration view
- string? isPendingSuperAdminSetup = HttpContext.Session.GetString(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP);
- if (isPendingSuperAdminSetup == "true")
- // TODO: should be:
- // return View("~/Views/Auth/Register", new RegisterRequestDto());
- // but doesn't work because of an ASP.NET bug: https://github.com/dotnet/AspNetCore.Docs/issues/25157
- return Redirect(_urlService.GetAbsoluteUrl("Register", "Auth")!);
- return View(new LoginRequestModel());
- }
-
- ///
- /// Displays the view for recovering the password of an account.
- ///
- [AllowAnonymous]
- [InitializationCheck]
- [HttpGet("recover-password")]
- public IActionResult RecoverPassword()
- {
- // if the user is already logged in, redirect them to the home page
- if (User?.Identity?.IsAuthenticated == true)
- return Redirect(_urlService.GetAbsoluteUrl("Index", "Home")!);
- return View();
- }
-
- ///
- /// Displays the view for changing the password of an account.
- ///
- [HttpGet("change-password")]
- public IActionResult ChangePassword()
- {
- return View();
- }
-
- ///
- /// Displays the view for registering a new account.
- ///
- [HttpGet("profile")]
- public IActionResult Profile()
- {
- return View();
- }
-
- ///
- /// Displays the view for registering a new account.
- ///
- [AllowAnonymous]
- [HttpGet("access-denied")]
- public IActionResult AccessDenied()
- {
- return View();
- }
-
- ///
- /// Registers a new account.
- ///
- /// User credentials used for registration.
- /// Cancellation token that can be used to stop the execution.
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- [HttpPost("api-register")]
- public async Task RegisterPost([FromBody] RegisterRequestModel data, CancellationToken cancellationToken)
- {
- // call different endpoints based on the view hidden field - registration for normal users, or initial application admin account setup
- string endpoint = data.RegistrationType == "Admin" ? "initialization" : "auth/register";
- // attempt API registration
- RegisterResponseModel response = await _apiHttpClient.PostAsync(endpoint, data, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Logs in an account.
- ///
- /// User credentials used for login.
- /// Cancellation token that can be used to stop the execution.
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- [HttpPost("api-login")]
- public async Task LoginPost([FromBody] LoginRequestModel data, CancellationToken cancellationToken)
- {
- try
- {
- // attempt API registration
- LoginResponseModel response = await _apiHttpClient.PostAsync("auth/login", data, cancellationToken).ConfigureAwait(false);
- // store the received token in a secure cookie
- Response.Cookies.Delete("Token");
- Response.Cookies.Append("Token", _cryptographyService.Encrypt(response.Token!), new CookieOptions
- {
- Expires = DateTimeOffset.UtcNow.AddMonths(1),
- Path = "/",
- HttpOnly = true,
- Secure = true,
- IsEssential = true,
- SameSite = SameSiteMode.Strict
- });
- // tell asp.net we are logged in
- List claims =
- [
- new Claim(ClaimTypes.Name, response.Username!),
- new Claim(ClaimTypes.NameIdentifier, response.Id.ToString()!),
- new Claim("Token", response.Token!),
- ];
- ClaimsIdentity claimsIdentity = new(claims, CookieAuthenticationDefaults.AuthenticationScheme);
- await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity)).ConfigureAwait(false);
- // get current culture from route data or use default if not set
- string currentCulture = HttpContext.Request.RouteValues["culture"]?.ToString() ?? "en-US";
- // handle ReturnUrl and ensure it includes the correct culture
- string redirectUrl;
- if (!string.IsNullOrEmpty(data.ReturnUrl) && Url.IsLocalUrl(data.ReturnUrl)) // ensure that return URL contains the correct culture
- redirectUrl = data.ReturnUrl.StartsWith($"/{currentCulture}/") ? data.ReturnUrl : $"/{currentCulture}{data.ReturnUrl}";
- else
- {
- // if no ReturnUrl is provided or it's invalid, use a default URL with respect to base paths
- redirectUrl = Url.Content("~/");
-
- // handle reverse proxy scenarios by respecting any base path or forwarded headers
- if (HttpContext.Request.Headers.TryGetValue("X-Forwarded-Prefix", out StringValues pathBase))
- redirectUrl = pathBase + redirectUrl;
-
- // ensure that default redirect contains the correct culture
- if (!redirectUrl.StartsWith($"/{currentCulture}/"))
- redirectUrl = $"/{currentCulture}{redirectUrl}";
- }
-
- // return success status and redirect URL
- return Json(new { success = true, data = redirectUrl });
- }
- catch (ApiException ex)
- {
- // in this particular case, we DO NOT want to let the ApiExceptionFilter take care of this exception, because when the user has 2FA enabled, the first auth step involves sending
- // only the username and password, in which case the server API will respond with a validation error, that TOTP code is not valid (empty); it is then that we catch this error here
- // and display the form that asks the user for the TOTP code
- if (ex.ProblemDetails is not null && ex.ProblemDetails.Extensions?.Count > 0 && ex.ProblemDetails.Extensions.TryGetValue("errors", out JsonElement errorsObj))
- if (errorsObj is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object)
- foreach (JsonProperty error in jsonElement.EnumerateObject())
- if (error.Value.ValueKind == JsonValueKind.Array)
- foreach (JsonElement errorValue in error.Value.EnumerateArray())
- if (errorValue.ValueKind == JsonValueKind.String && errorValue.GetString() == "InvalidTotpCode" && string.IsNullOrEmpty(data.TotpCode))
- return Json(new { success = true, data = new { isTotpRequired = true } }); // only get here when user did not enter a TOTP code at all, otherwise rethrow the validation error
- throw;
- }
- }
-
- ///
- /// Logs out an account and redirects to the login page.
- ///
- [HttpGet("logout")]
- public async Task Logout()
- {
- // if the user is not logged in, redirect them to the home page
- if (User?.Identity?.IsAuthenticated == false)
- return Redirect(_urlService.GetAbsoluteUrl("Index", "Home")!);
- Response.Cookies.Delete("Token");
- await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme).ConfigureAwait(false);
- return Redirect(_urlService.GetAbsoluteUrl("Login", "Auth")!);
- }
-
- ///
- /// Recovers the password of an account.
- ///
- /// User credentials used for password recovery.
- /// Cancellation token that can be used to stop the execution.
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- [HttpPost("api-recover-password")]
- public async Task RecoverPasswordPost([FromBody] RecoverPasswordRequestModel data, CancellationToken cancellationToken)
- {
- RecoverPasswordResponseModel response = await _apiHttpClient.PostAsync("auth/recover-password", data, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-
- ///
- /// Changes the password of an account.
- ///
- /// User credentials used for password change.
- /// Cancellation token that can be used to stop the execution.
- [ValidateAntiForgeryToken]
- [HttpPost("api-change-password")]
- public async Task ChangePasswordPost([FromBody] ChangePasswordRequestModel data, CancellationToken cancellationToken)
- {
- data = data with { Username = User?.Identity?.Name }; // assign the currently logged in user as the user for which to change the password
- ChangePasswordResponseModel response = await _apiHttpClient.PostAsync("auth/change-password", data, cancellationToken).ConfigureAwait(false);
- return Json(new { success = true, data = response });
- }
-}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs
new file mode 100644
index 00000000..24c559d0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpoint.cs
@@ -0,0 +1,57 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.AddRole;
+
+///
+/// API endpoint for the /{culture}/admin/api-create-role route.
+///
+public class AddRoleEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public AddRoleEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.POST);
+ Routes(WebRoutes.Admin.CREATE_ROLE);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Adds an authorization role.
+ ///
+ /// The request containing the details of the authorization role to add.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(AddRoleRequest request, CancellationToken cancellationToken)
+ {
+ RolePermissionsDto response = await _apiHttpClient.PostAsync(ApiRoutes.Roles.CREATE_ROLE, request, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs
new file mode 100644
index 00000000..d0ce5710
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.AddRole;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class AddRoleEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AddRoleEndpointSummary()
+ {
+ Summary = "Adds a new role.";
+ Description = "Creates a new authorization role with the specified permissions.";
+ RequestParam(r => r.RoleName, "The name of the role. Required.");
+ RequestParam(r => r.Permissions, "The collection of Ids of the permissions of the role. Required.");
+
+ ExampleRequest = new AddRoleRequest(
+ RoleName: "Editor",
+ Permissions: [
+ Guid.NewGuid(),
+ Guid.NewGuid(),
+ ]
+ );
+
+ Response(200, "The role is created.", example: new SuccessResponse(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpoint.cs
new file mode 100644
index 00000000..d88725ac
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpoint.cs
@@ -0,0 +1,56 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.DeleteRole;
+
+///
+/// API endpoint for the /{culture}/admin/api-delete-role/{roleId} route.
+///
+public class DeleteRoleEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public DeleteRoleEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.DELETE);
+ Routes(WebRoutes.Admin.DELETE_ROLE);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Deletes the authorization role identified by the request.
+ ///
+ /// The request containing the unique identifier of the authorization role to delete.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(DeleteRoleRequest request, CancellationToken cancellationToken)
+ {
+ await _apiHttpClient.DeleteAsync(ApiRoutes.Roles.DELETE_ROLE.Replace("{roleId}", request.RoleId.ToString()), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs
new file mode 100644
index 00000000..22a50431
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs
@@ -0,0 +1,29 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.DeleteRole;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class DeleteRoleEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DeleteRoleEndpointSummary()
+ {
+ Summary = "Deletes a role.";
+ Description = "Deletes an existing authorization role identified by its unique identifier.";
+
+ RequestParam(r => r.RoleId, "The unique identifier of the role to delete.");
+
+ Response(200, "The role is deleted.", example: new SuccessResponse(true));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpoint.cs
new file mode 100644
index 00000000..dbaccd27
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpoint.cs
@@ -0,0 +1,56 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.GetRolePermissions;
+
+///
+/// API endpoint for the /{culture}/admin/api-get-permissions-by-role-id/{roleId} route.
+///
+public class GetRolePermissionsEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetRolePermissionsEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Admin.GET_PERMISSIONS_BY_ROLE_ID);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ }
+
+ ///
+ /// Retrieves the permissions of the authorization role identified by the request.
+ ///
+ /// The request containing the unique identifier of the role whose permissions are retrieved.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(GetRolePermissionsRequest request, CancellationToken cancellationToken)
+ {
+ RolePermissionsDto response = await _apiHttpClient.GetAsync(ApiRoutes.Roles.GET_ROLE_PERMISSIONS_BY_ROLE_ID.Replace("{roleId}", request.RoleId.ToString()), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointSummary.cs
new file mode 100644
index 00000000..759f99f4
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointSummary.cs
@@ -0,0 +1,30 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.GetRolePermissions;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetRolePermissionsEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public GetRolePermissionsEndpointSummary()
+ {
+ Summary = "Gets the permissions of a role.";
+ Description = "Retrieves the permissions of an existing authorization role identified by its unique identifier.";
+
+ RequestParam(r => r.RoleId, "The unique identifier of the role whose permissions are retrieved.");
+
+ Response(200, "The permissions of the role are returned.", example: new SuccessResponse(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpoint.cs
new file mode 100644
index 00000000..940c1420
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpoint.cs
@@ -0,0 +1,55 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.GetRoles;
+
+///
+/// API endpoint for the /{culture}/admin/api-get-roles route.
+///
+public class GetRolesEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetRolesEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Admin.GET_ROLES);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ }
+
+ ///
+ /// Retrieves the authorization roles.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
+ {
+ RoleDto[] roles = await _apiHttpClient.GetAsync(ApiRoutes.Roles.GET_ROLES, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(roles);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointSummary.cs
new file mode 100644
index 00000000..12eb37e9
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointSummary.cs
@@ -0,0 +1,27 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.GetRoles;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetRolesEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public GetRolesEndpointSummary()
+ {
+ Summary = "Gets all roles.";
+ Description = "Retrieves the collection of existing authorization roles.";
+
+ Response(200, "The collection of authorization roles is returned.", example: new SuccessResponse(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpoint.cs
new file mode 100644
index 00000000..a5dd223e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpoint.cs
@@ -0,0 +1,57 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.UpdateRole;
+
+///
+/// API endpoint for the /{culture}/admin/api-update-role route.
+///
+public class UpdateRoleEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public UpdateRoleEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.PUT);
+ Routes(WebRoutes.Admin.UPDATE_ROLE);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Updates an existing authorization role.
+ ///
+ /// The request containing the updated details of the authorization role.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(UpdateRoleRequest request, CancellationToken cancellationToken)
+ {
+ RolePermissionsDto response = await _apiHttpClient.PutAsync(ApiRoutes.Roles.UPDATE_ROLE, request, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs
new file mode 100644
index 00000000..d514eb18
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs
@@ -0,0 +1,40 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Authorization;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Authorization.Roles.UpdateRole;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateRoleEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UpdateRoleEndpointSummary()
+ {
+ Summary = "Updates a role.";
+ Description = "Updates the name and the permissions of an existing authorization role.";
+ RequestParam(r => r.RoleId, "The unique identifier of the role. Required.");
+ RequestParam(r => r.RoleName, "The name of the role. Required.");
+ RequestParam(r => r.Permissions, "The collection of Ids of the permissions of the role. Required.");
+
+ ExampleRequest = new UpdateRoleRequest(
+ RoleId: Guid.NewGuid(),
+ RoleName: "Editor",
+ Permissions: [
+ Guid.NewGuid(),
+ Guid.NewGuid(),
+ ]
+ );
+
+ Response(200, "The role is updated.", example: new SuccessResponse(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpoint.cs
new file mode 100644
index 00000000..4bcc95a4
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpoint.cs
@@ -0,0 +1,60 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.DTO.UsersManagement;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.ManagePermissions;
+
+///
+/// API endpoint for the /{culture}/admin/manage-permissions route.
+///
+public class ManagePermissionsViewEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public ManagePermissionsViewEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Admin.MANAGE_PERMISSIONS);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ }
+
+ ///
+ /// Displays the authorization permissions management view.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
+ {
+ UserDto[] users = await _apiHttpClient.GetAsync(ApiRoutes.Authentication.USERS, cancellationToken).ConfigureAwait(false);
+ RoleDto[] roles = await _apiHttpClient.GetAsync(ApiRoutes.Roles.GET_ROLES, cancellationToken).ConfigureAwait(false);
+ PermissionDto[] permissions = await _apiHttpClient.GetAsync(ApiRoutes.Permissions.GET_PERMISSIONS, cancellationToken).ConfigureAwait(false);
+ Dictionary viewData = new() { ["users"] = users, ["roles"] = roles, ["permissions"] = permissions };
+ return View("/Core/Views/Admin/ManagePermissions.cshtml", viewData: viewData);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointSummary.cs
new file mode 100644
index 00000000..abe4724f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointSummary.cs
@@ -0,0 +1,24 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.ManagePermissions;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class ManagePermissionsViewEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ManagePermissionsViewEndpointSummary()
+ {
+ Summary = "Renders the manage permissions view.";
+ Description = "Renders the view for managing the authorization permissions.";
+
+ Response(200, "The view for managing the authorization permissions is rendered.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpoint.cs
new file mode 100644
index 00000000..3203bd0c
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpoint.cs
@@ -0,0 +1,58 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Authorization;
+using Lumina.Presentation.Web.Common.DTO.Authorization;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Admin.ManageRoles;
+
+///
+/// API endpoint for the /{culture}/admin/manage-roles route.
+///
+public class ManageRolesViewEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public ManageRolesViewEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Admin.MANAGE_ROLES);
+ DontAutoTag();
+ Options(options => options.WithTags("Admin"));
+ Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
+ }
+
+ ///
+ /// Displays the authorization roles management view.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
+ {
+ RoleDto[] roles = await _apiHttpClient.GetAsync(ApiRoutes.Roles.GET_ROLES, cancellationToken).ConfigureAwait(false);
+ PermissionDto[] permissions = await _apiHttpClient.GetAsync(ApiRoutes.Permissions.GET_PERMISSIONS, cancellationToken).ConfigureAwait(false);
+ Dictionary