feat: adds FastEndpoints core infrastructure and contracts to the web project

This commit is contained in:
BinaryAlley committed 2026-08-17 11:52:20 -07:00
1 parent 394b33efd2
commit 733e174cac
137 files changed
+3139 -158

No files matched your search

@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents a request for adding an authorization role.
/// </summary>
/// <param name="RoleName">The name of the role. Required.</param>
/// <param name="Permissions">The collection or permissions of the role. Required.</param>
[DebuggerDisplay("RoleName: {RoleName}")]
public record AddRoleRequest(
string? RoleName,
List<Guid>? Permissions
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents a request for deleting an authorization role.
/// </summary>
/// <param name="RoleId">The unique identifier of the role. Required.</param>
[DebuggerDisplay("RoleId: {RoleId}")]
public record DeleteRoleRequest(
Guid RoleId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents a request to get the authorization permissions of a role identified by <paramref name="RoleId"/>.
/// </summary>
/// <param name="RoleId">The Id of authorization role. Required.</param>
[DebuggerDisplay("RoleId: {RoleId}")]
public record GetRolePermissionsRequest(
Guid RoleId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents the request model for retrieving the authorization permissions of a user identified by <paramref name="UserId"/>.
/// </summary>
/// <param name="UserId">The unique identifier of the user for whom to get the authorization permissions. Required.</param>
[DebuggerDisplay("UserId: {UserId}")]
public record GetUserPermissionsRequest(
Guid UserId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents the request model for retrieving the authorization role of a user identified by <paramref name="UserId"/>.
/// </summary>
/// <param name="UserId">The unique identifier of the user for whom to get the authorization role. Required.</param>
[DebuggerDisplay("UserId: {UserId}")]
public record GetUserRoleRequest(
Guid UserId
);
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents a request for updating an existing authorization role.
/// </summary>
/// <param name="RoleId">The unique identifier of the role. Required.</param>
/// <param name="RoleName">The name of the role. Required.</param>
/// <param name="Permissions">The collection of Ids of the permissions of the role. Required.</param>
[DebuggerDisplay("RoleName: {RoleName}")]
public record UpdateRoleRequest(
Guid RoleId,
string? RoleName,
List<Guid>? Permissions
);
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
/// <summary>
/// Represents a request for updating the authorization role and permissions of a user.
/// </summary>
/// <param name="UserId">The unique identifier of the user. Required.</param>
/// <param name="RoleId">The unique identifier of the role. Optional.</param>
/// <param name="Permissions">The collection of Ids of the permissions of the role. Optional.</param>
[DebuggerDisplay("UserId: {UserId}")]
public record UpdateUserRoleAndPermissionsRequest(
Guid UserId,
Guid? RoleId,
List<Guid>? Permissions
);
@@ -0,0 +1,6 @@
namespace Lumina.Presentation.Web.Common.Requests.Common;
/// <summary>
/// Record used for empty requests and responses.
/// </summary>
public record struct EmptyRequest();
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Directories;
/// <summary>
/// Represents a request to get the directories of a file system path.
/// </summary>
/// <param name="Path">The file system path for which to get the directories. Required.</param>
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
[DebuggerDisplay("Path: {Path}")]
public record GetDirectoriesRequest(
string? Path,
bool IncludeHiddenElements
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
/// <summary>
/// Represents a request to get the files at a file system path.
/// </summary>
/// <param name="Path">The file system path for which to get the files. Required.</param>
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
[DebuggerDisplay("Path: {Path}")]
public record GetFilesRequest(
string? Path,
bool IncludeHiddenElements
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
/// <summary>
/// Represents a request to get the files of a file system path.
/// </summary>
/// <param name="Path">The file system path for which to get the tree files. Required.</param>
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
[DebuggerDisplay("Path: {Path}")]
public record GetTreeFilesRequest(
string? Path,
bool IncludeHiddenElements
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
/// <summary>
/// Represents a request to check the existence of a file system path.
/// </summary>
/// <param name="Path">The file system path to check the exitence of. Required.</param>
/// <param name="IncludeHiddenElements">Whether to include hidden elements in the search results, or not. Optional.</param>
[DebuggerDisplay("Path: {Path}, IncludeHiddenElements: {IncludeHiddenElements}")]
public record CheckPathExistsRequest(
string? Path,
bool IncludeHiddenElements
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
/// <summary>
/// Represents the request for retrieving the parent path of a file system path.
/// </summary>
/// <param name="Path">The path for which the parent path is retrieved.</param>
[DebuggerDisplay("Path: {Path}")]
public record GetPathParentRequest(
string? Path
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
/// <summary>
/// Represents a request to get the root of a file system path.
/// </summary>
/// <param name="Path">The file system path for which to get the root. Required.</param>
[DebuggerDisplay("Path: {Path}")]
public record GetPathRootRequest(
string? Path
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
/// <summary>
/// Represents a request to split a file system path.
/// </summary>
/// <param name="Path">The file system path for which to get the path segments. Required.</param>
[DebuggerDisplay("Path: {Path}")]
public record SplitPathRequest(
string? Path
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
/// <summary>
/// Represents a request to check the validity of a file system path.
/// </summary>
/// <param name="Path">The file system path to validate. Required.</param>
[DebuggerDisplay("Path: {Path}")]
public record ValidatePathRequest(
string? Path
);
@@ -0,0 +1,56 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Libraries;
/// <summary>
/// Represents a request to get the lightweight details of the books of a media library.
/// </summary>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public class GetBooksLiteRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose books are retrieved.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the page of results to retrieve.
/// </summary>
public int? CurrentPage { get; set; }
/// <summary>
/// Gets or sets the maximum number of books to retrieve per page.
/// </summary>
public int? PerPage { get; set; }
/// <summary>
/// Gets or sets the search term used to filter results.
/// </summary>
public string? SearchTerm { get; set; }
/// <summary>
/// Gets or sets the alpha key used to filter the results by the first character of their title, for the alpha picker.
/// Can be <see langword="null"/> to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
/// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit.
/// </summary>
public string? FilterAlphaKey { get; set; }
/// <summary>
/// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not.
/// </summary>
public bool IgnoreThePrefixForAlphaPicker { get; set; }
/// <summary>
/// Gets or sets the name of the field by which to sort the results.
/// </summary>
public string? SortBy { get; set; }
/// <summary>
/// Gets or sets the direction in which to sort the results.
/// </summary>
public SortOrder? SortOrder { get; set; }
}
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents a request to cancel the scan of a media library.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose scan is cancelled. Required.</param>
/// <param name="ScanId">The Id of scan to cancel. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}; ScanId: {ScanId}")]
public record CancelLibraryScanRequest(
Guid LibraryId,
Guid ScanId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents a request to delete a media library by its Id.
/// </summary>
/// <param name="Id">The unique identifier of the media library to be deleted. Required.</param>
[DebuggerDisplay("Id: {Id}")]
public record DeleteLibraryRequest(
Guid Id
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents the request for displaying the media library editing view.
/// </summary>
/// <param name="Id">The unique identifier of the media library to edit.</param>
[DebuggerDisplay("Id: {Id}")]
public record EditLibraryRequest(
Guid Id
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents the request for retrieving the metadata providers of a media library.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose metadata providers are retrieved.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public record GetMetadataProvidersRequest(
Guid LibraryId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents a request to scan a media library.
/// </summary>
/// <param name="Id">The unique identifier of the media library to be scanned. Required.</param>
[DebuggerDisplay("Id: {Id}")]
public record ScanLibraryRequest(
Guid Id
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
/// <summary>
/// Represents a request to get a book by the specified Id.
/// </summary>
/// <param name="Id">The unique identifier of the book to retrieve.</param>
[DebuggerDisplay("Id: {Id}")]
public record GetBookRequest(
Guid Id
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
/// <summary>
/// Represents the request for displaying the books browsing view.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose books are browsed.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public record GetBooksViewRequest(
Guid? LibraryId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to get the settings of a plugin.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin. Required.</param>
[DebuggerDisplay("PluginId: {PluginId}")]
public record GetPluginSettingsRequest(
Guid PluginId
);
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the metadata providers of a media library.
/// </summary>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public class ReorderLibraryMetadataProvidersRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata providers are reordered.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
/// </summary>
public List<Guid> PluginIds { get; set; } = [];
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a metadata provider for a media library.
/// </summary>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public class SetLibraryMetadataProviderEnabledRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the metadata.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets whether the metadata provider should be enabled for the media library.
/// </summary>
public bool IsEnabled { get; set; }
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to update the settings of a plugin.
/// </summary>
[DebuggerDisplay("PluginId: {PluginId}")]
public class UpdatePluginSettingsRequest
{
/// <summary>
/// Gets or sets the unique identifier of the plugin.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets the settings of the plugin.
/// </summary>
public Dictionary<string, string>? Settings { get; set; }
}
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Tools;
/// <summary>
/// Represents the request for setting the culture used by the application.
/// </summary>
/// <param name="NewCulture">The new culture to set.</param>
/// <param name="ReturnUrl">The URL to return to, after setting the new culture.</param>
[DebuggerDisplay("NewCulture: {NewCulture}, ReturnUrl: {ReturnUrl}")]
public record SetLanguageRequest(
string? NewCulture,
string? ReturnUrl
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement.Authentication;
/// <summary>
/// Represents the request for displaying the account login view.
/// </summary>
/// <param name="ReturnUrl">The URL to return to, after login.</param>
[DebuggerDisplay("ReturnUrl: {ReturnUrl}")]
public record LoginViewRequest(
string? ReturnUrl = null
);
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
/// <summary>
/// Represents the request model for account password change.
/// </summary>
/// <param name="Username">The username of the account. Required.</param>
/// <param name="CurrentPassword">The current password of the account. Required.</param>
/// <param name="NewPassword">The new password of the account. Required.</param>
/// <param name="NewPasswordConfirm">The confirmation of the new password of the account. Required.</param>
[DebuggerDisplay("Username: {Username}")]
public record ChangePasswordRequest(
string? Username,
string? CurrentPassword,
string? NewPassword,
string? NewPasswordConfirm
);
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
/// <summary>
/// Represents the request model for user authentication.
/// </summary>
/// <param name="Username">The username of the account to authenticate. Required.</param>
/// <param name="Password">The password of the account to authenticate. Required.</param>
/// <param name="TotpCode">The TOTP (Time-Based One-Time Password) of the account to authenticate. Optional.</param>
/// <param name="ReturnUrl">The URL to return to, after login.</param>
[DebuggerDisplay("Username: {Username}")]
public record LoginRequest(
string? Username = null,
string? Password = null,
string? TotpCode = null,
string? ReturnUrl = null
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
/// <summary>
/// Represents the request model for account password recovery.
/// </summary>
/// <param name="Username">The username of the account for which to recover the password. Required.</param>
/// <param name="TotpCode">The TOTP (Time-Based One-Time Password) of the account for which to recover the password. Required.</param>
[DebuggerDisplay("Username: {Username}")]
public record RecoverPasswordRequest(
string? Username,
string? TotpCode
);
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
/// <summary>
/// Represents the request model for user registration.
/// </summary>
/// <param name="Username">The desired username for the new account. Required.</param>
/// <param name="Password">The password for the new account. Required.</param>
/// <param name="PasswordConfirm">The confirmation of the entered password, used to ensure consistency. Required.</param>
/// <param name="RegistrationType">Specifies the type of registration, e.g., "Admin" or "User". Required.</param>
/// <param name="Use2fa">Indicates whether two-factor authentication (2FA) should be enabled for the new account. Optional.</param>
[DebuggerDisplay("Username: {Username}")]
public record RegisterRequest(
string? Username,
string? Password,
string? PasswordConfirm,
string? RegistrationType,
bool Use2fa = true
);