mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 19:11:10 +00:00
Standardizes boolean naming across the stack
This commit is contained in:
1 parent
6bd0cf6d42
commit
37dff6039d
78 files changed
+252
-252
No files matched your search
+2
-2
@@ -27,9 +27,9 @@ public interface IGetAllLiteRepositoryAction<TModel, TLiteRow> where TModel : IS
|
||||
/// <param name="sortBy">The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">The direction in which to sort the results.</param>
|
||||
/// <param name="filterModel">The model containing the parameters used to filter the results.</param>
|
||||
/// <param name="includeNavigationProperties">Whether the navigation properties of the entities should be loaded together with the entities themselves. Pass <see langword="false"/> to retrieve only the data stored directly on the entity rows.</param>
|
||||
/// <param name="shouldIncludeNavigationProperties">Whether the navigation properties of the entities should be loaded together with the entities themselves. Pass <see langword="false"/> to retrieve only the data stored directly on the entity rows.</param>
|
||||
/// <param name="shouldTrackEntities">Whether the retrieved entities should be tracked by the persistence medium, so that changes to them can be saved. Pass <see langword="false"/> for read-only scenarios, to avoid the tracking overhead.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a paginated result of type <typeparamref name="TLiteRow"/>, or an error.</returns>
|
||||
Task<Result<PaginatedResultDto<TLiteRow>>> GetAllLiteAsync<TFilter>(PaginationDataDto? paginationData = null, string? sortBy = null, SortOrder? sortOrder = null, TFilter? filterModel = null, bool includeNavigationProperties = false, bool shouldTrackEntities = false, CancellationToken cancellationToken = default) where TFilter : BaseFilterDto;
|
||||
Task<Result<PaginatedResultDto<TLiteRow>>> GetAllLiteAsync<TFilter>(PaginationDataDto? paginationData = null, string? sortBy = null, SortOrder? sortOrder = null, TFilter? filterModel = null, bool shouldIncludeNavigationProperties = false, bool shouldTrackEntities = false, CancellationToken cancellationToken = default) where TFilter : BaseFilterDto;
|
||||
}
|
||||
+1
-1
@@ -17,6 +17,6 @@ public static class GetDirectoriesRequestMapping
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetDirectoriesQuery ToQuery(this GetDirectoriesRequest request)
|
||||
{
|
||||
return new GetDirectoriesQuery(request.Path, request.IncludeHiddenElements);
|
||||
return new GetDirectoriesQuery(request.Path, request.ShouldIncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,6 +17,6 @@ public static class GetFilesRequestMapping
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetFilesQuery ToQuery(this GetFilesRequest request)
|
||||
{
|
||||
return new GetFilesQuery(request.Path, request.IncludeHiddenElements);
|
||||
return new GetFilesQuery(request.Path, request.ShouldIncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,6 +17,6 @@ public static class GetTreeFilesRequestMapping
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetTreeFilesQuery ToQuery(this GetTreeFilesRequest request)
|
||||
{
|
||||
return new GetTreeFilesQuery(request.Path, request.IncludeHiddenElements);
|
||||
return new GetTreeFilesQuery(request.Path, request.ShouldIncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ public static class CheckPathExistsRequestMapping
|
||||
{
|
||||
return new CheckPathExistsQuery(
|
||||
request.Path,
|
||||
request.IncludeHiddenElements
|
||||
request.ShouldIncludeHiddenElements
|
||||
);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ namespace Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDi
|
||||
/// Query for retrieving the list of directories at a path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path for which to retrieve the list of directories.</param>
|
||||
/// <param name="IncludeHiddenElements">Whether to include hidden directories or not.</param>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden directories or not.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetDirectoriesQuery(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
) : IQuery;
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class GetDirectoriesQueryHandler : IQueryHandler<GetDirectoriesQuery, Res
|
||||
if (validationResult.Count > 0)
|
||||
return Task.FromResult<Result<IEnumerable<DirectoryResponse>>>(validationResult);
|
||||
|
||||
Result<IEnumerable<Directory>> getSubdirectoriesResult = _directoryService.GetSubdirectories(query.Path!, query.IncludeHiddenElements);
|
||||
Result<IEnumerable<Directory>> getSubdirectoriesResult = _directoryService.GetSubdirectories(query.Path!, query.ShouldIncludeHiddenElements);
|
||||
return Task.FromResult(getSubdirectoriesResult.Match(values => Result.From(values.ToResponses()), errors => errors));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ namespace Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
/// Query for retrieving the list of files at a path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path for which to retrieve the list of files.</param>
|
||||
/// <param name="IncludeHiddenElements">Whether to include hidden files and directories or not.</param>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden files and directories or not.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetFilesQuery(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
) : IQuery;
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class GetFilesQueryHandler : IQueryHandler<GetFilesQuery, Result<IEnumera
|
||||
if (validationResult.Count > 0)
|
||||
return Task.FromResult<Result<IEnumerable<FileResponse>>>(validationResult);
|
||||
|
||||
Result<IEnumerable<File>> getFilesResult = _fileService.GetFiles(query.Path!, query.IncludeHiddenElements);
|
||||
Result<IEnumerable<File>> getFilesResult = _fileService.GetFiles(query.Path!, query.ShouldIncludeHiddenElements);
|
||||
return Task.FromResult(getFilesResult.Match(values => Result.From(values.ToResponses()), errors => errors));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ namespace Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFile
|
||||
/// Query for retrieving the list of files at a path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path for which to retrieve the list of files.</param>
|
||||
/// <param name="IncludeHiddenElements">Whether to include hidden files and directories or not.</param>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden files and directories or not.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetTreeFilesQuery(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
) : IQuery;
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class GetTreeFilesQueryHandler : IQueryHandler<GetTreeFilesQuery, Result<
|
||||
if (validationResult.Count > 0)
|
||||
return Task.FromResult<Result<IEnumerable<FileSystemTreeNodeResponse>>>(validationResult);
|
||||
|
||||
Result<IEnumerable<File>> getFilesResult = _fileService.GetFiles(query.Path!, query.IncludeHiddenElements);
|
||||
Result<IEnumerable<File>> getFilesResult = _fileService.GetFiles(query.Path!, query.ShouldIncludeHiddenElements);
|
||||
return Task.FromResult(getFilesResult.Match(values => Result.From(values.ToFileSystemTreeNodeResponses()), errors => errors));
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -9,9 +9,9 @@ namespace Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathEx
|
||||
/// Query for checking the existence of a file system path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path for which to check the existence of.</param>
|
||||
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
[DebuggerDisplay("Path: {Path}, IncludeHiddenElements: {IncludeHiddenElements}")]
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
[DebuggerDisplay("Path: {Path}, ShouldIncludeHiddenElements: {ShouldIncludeHiddenElements}")]
|
||||
public record CheckPathExistsQuery(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
) : IQuery;
|
||||
+1
-1
@@ -44,6 +44,6 @@ public class CheckPathExistsQueryHandler : IQueryHandler<CheckPathExistsQuery, R
|
||||
if (validationResult.Count > 0)
|
||||
return Task.FromResult<Result<PathExistsResponse>>(validationResult);
|
||||
|
||||
return Task.FromResult(Result.From(new PathExistsResponse(_pathService.Exists(query.Path!, query.IncludeHiddenElements))));
|
||||
return Task.FromResult(Result.From(new PathExistsResponse(_pathService.Exists(query.Path!, query.ShouldIncludeHiddenElements))));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ namespace Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetDirectoriesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
@@ -9,9 +9,9 @@ namespace Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetFilesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
@@ -9,9 +9,9 @@ namespace Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetTreeFilesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
@@ -9,9 +9,9 @@ namespace Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
/// 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}")]
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden elements in the search results, or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}, ShouldIncludeHiddenElements: {ShouldIncludeHiddenElements}")]
|
||||
public record CheckPathExistsRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
+6
-6
@@ -17,9 +17,9 @@ public interface IDirectoryProviderService
|
||||
/// Retrieves a list of subdirectory paths from the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path from which to retrieve the subdirectory paths.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden subdirectories or not.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden subdirectories or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a collection of directory paths or an error.</returns>
|
||||
Result<IEnumerable<FileSystemPathId>> GetSubdirectoryPaths(FileSystemPathId path, bool includeHiddenElements);
|
||||
Result<IEnumerable<FileSystemPathId>> GetSubdirectoryPaths(FileSystemPathId path, bool shouldIncludeHiddenElements);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a directory with the specified path exists.
|
||||
@@ -63,18 +63,18 @@ public interface IDirectoryProviderService
|
||||
/// </summary>
|
||||
/// <param name="sourcePath">Identifier for the path where the directory to be copied is located.</param>
|
||||
/// <param name="destinationPath">Identifier for the path where the directory will be copied.</param>
|
||||
/// <param name="overrideExisting">Whether to override existing directories, or not.</param>
|
||||
/// <param name="shouldOverrideExisting">Whether to override existing directories, or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either the copied directory, or an error.</returns>
|
||||
Result<FileSystemPathId> CopyDirectory(FileSystemPathId sourcePath, FileSystemPathId destinationPath, bool overrideExisting);
|
||||
Result<FileSystemPathId> CopyDirectory(FileSystemPathId sourcePath, FileSystemPathId destinationPath, bool shouldOverrideExisting);
|
||||
|
||||
/// <summary>
|
||||
/// Moves a directory located at <paramref name="sourcePath"/> to <paramref name="destinationPath"/>.
|
||||
/// </summary>
|
||||
/// <param name="sourcePath">Identifier for the path where the directory to be moved is located.</param>
|
||||
/// <param name="destinationPath">Identifier for the path where the directory will be moved.</param>
|
||||
/// <param name="overrideExisting">Whether to override existing directories, or not.</param>
|
||||
/// <param name="shouldOverrideExisting">Whether to override existing directories, or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a moved directory, or an error.</returns>
|
||||
Result<FileSystemPathId> MoveDirectory(FileSystemPathId sourcePath, FileSystemPathId destinationPath, bool overrideExisting);
|
||||
Result<FileSystemPathId> MoveDirectory(FileSystemPathId sourcePath, FileSystemPathId destinationPath, bool shouldOverrideExisting);
|
||||
|
||||
/// <summary>
|
||||
/// Renames a directory at the specified path.
|
||||
|
||||
+6
-6
@@ -17,9 +17,9 @@ public interface IFileProviderService
|
||||
/// Retrieves a list of files at the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to retrieve the list of files.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden files or not.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden files or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a collection of file paths, or an error.</returns>
|
||||
Result<IEnumerable<FileSystemPathId>> GetFilePaths(FileSystemPathId path, bool includeHiddenElements);
|
||||
Result<IEnumerable<FileSystemPathId>> GetFilePaths(FileSystemPathId path, bool shouldIncludeHiddenElements);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the contents of a file at the specified path.
|
||||
@@ -68,18 +68,18 @@ public interface IFileProviderService
|
||||
/// </summary>
|
||||
/// <param name="sourceFilePath">Identifier for the path where the file to be copied is located.</param>
|
||||
/// <param name="destinationDirectoryPath">Identifier for the path of the directory where the file will be copied.</param>
|
||||
/// <param name="overrideExisting">Whether to override existing files, or not.</param>
|
||||
/// <param name="shouldOverrideExisting">Whether to override existing files, or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either the copied file, or an error.</returns>
|
||||
Result<FileSystemPathId> CopyFile(FileSystemPathId sourceFilePath, FileSystemPathId destinationDirectoryPath, bool overrideExisting);
|
||||
Result<FileSystemPathId> CopyFile(FileSystemPathId sourceFilePath, FileSystemPathId destinationDirectoryPath, bool shouldOverrideExisting);
|
||||
|
||||
/// <summary>
|
||||
/// Moves a file located at <paramref name="sourceFilePath"/> to <paramref name="destinationDirectoryPath"/>.
|
||||
/// </summary>
|
||||
/// <param name="sourceFilePath">Identifier for the path where the file to be moved is located.</param>
|
||||
/// <param name="destinationDirectoryPath">Identifier for the path of the directory where the file will be moved.</param>
|
||||
/// <param name="overrideExisting">Whether to override existing files, or not.</param>
|
||||
/// <param name="shouldOverrideExisting">Whether to override existing files, or not.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a moved file, or an error.</returns>
|
||||
Result<FileSystemPathId> MoveFile(FileSystemPathId sourceFilePath, FileSystemPathId destinationDirectoryPath, bool overrideExisting);
|
||||
Result<FileSystemPathId> MoveFile(FileSystemPathId sourceFilePath, FileSystemPathId destinationDirectoryPath, bool shouldOverrideExisting);
|
||||
|
||||
/// <summary>
|
||||
/// Renames a file at the specified path.
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ namespace Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Cancellati
|
||||
internal class MediaLibrariesScanCancellationTracker : IMediaLibrariesScanCancellationTracker, IDisposable
|
||||
{
|
||||
private readonly ConcurrentDictionary<MediaLibraryScanCompositeId, CancellationTokenSource> _runningScans = new();
|
||||
private bool _disposed;
|
||||
private bool _isDisposed;
|
||||
|
||||
/// <summary>
|
||||
/// Registers a new scan operation for tracking.
|
||||
@@ -72,7 +72,7 @@ internal class MediaLibrariesScanCancellationTracker : IMediaLibrariesScanCancel
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
if (!_isDisposed)
|
||||
{
|
||||
foreach (CancellationTokenSource scan in _runningScans.Values)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ internal class MediaLibrariesScanCancellationTracker : IMediaLibrariesScanCancel
|
||||
scan.Dispose();
|
||||
}
|
||||
_runningScans.Clear();
|
||||
_disposed = true;
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,7 +480,7 @@ public sealed class ThemeService : IThemeService
|
||||
if (unixFileType == 0xA000)
|
||||
return PackageInvalid("Symbolic links are not allowed in theme archives.");
|
||||
|
||||
Result<string> normalizedPathResult = NormalizeRelativePath(entry.FullName, allowTrailingSlash: true);
|
||||
Result<string> normalizedPathResult = NormalizeRelativePath(entry.FullName, shouldAllowTrailingSlash: true);
|
||||
if (normalizedPathResult.IsFailure)
|
||||
return normalizedPathResult.Errors;
|
||||
|
||||
@@ -732,14 +732,14 @@ public sealed class ThemeService : IThemeService
|
||||
/// Normalizes a package-relative path, rejecting paths that escape the package or violate the path rules.
|
||||
/// </summary>
|
||||
/// <param name="path">The package-relative path to normalize.</param>
|
||||
/// <param name="allowTrailingSlash">Whether a trailing slash, used for directory entries, is permitted.</param>
|
||||
/// <param name="shouldAllowTrailingSlash">Whether a trailing slash, used for directory entries, is permitted.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either the normalized path, or an error.</returns>
|
||||
private Result<string> NormalizeRelativePath(string path, bool allowTrailingSlash = false)
|
||||
private Result<string> NormalizeRelativePath(string path, bool shouldAllowTrailingSlash = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || path.Length > 240 || path.Contains('\\') || path.Contains('\0') || path.StartsWith('/') || path.Contains("//"))
|
||||
return PackageInvalid("The theme contains an invalid path.");
|
||||
|
||||
string candidate = allowTrailingSlash ? path.TrimEnd('/') : path;
|
||||
string candidate = shouldAllowTrailingSlash ? path.TrimEnd('/') : path;
|
||||
if (string.IsNullOrWhiteSpace(candidate))
|
||||
return PackageInvalid("The theme contains an invalid path.");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Lumina.Presentation.Web.Common.DTO.Common;
|
||||
/// <summary>
|
||||
/// Data transfer object for the data shown on the error page.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("RequestId: {RequestId}, ShowRequestId: {ShowRequestId}")]
|
||||
[DebuggerDisplay("RequestId: {RequestId}, ShouldShowRequestId: {ShouldShowRequestId}")]
|
||||
public class ErrorViewDto
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,5 +16,5 @@ public class ErrorViewDto
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the request identifier should be shown.
|
||||
/// </summary>
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
public bool ShouldShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace Lumina.Presentation.Web.Common.DTO.Common;
|
||||
/// <summary>
|
||||
/// Response data transfer object for the JSON responses of the web application that do not carry a payload.
|
||||
/// </summary>
|
||||
/// <param name="Success">Whether the operation succeeded or not.</param>
|
||||
/// <param name="IsSuccess">Whether the operation succeeded or not.</param>
|
||||
public record SuccessResponse(
|
||||
[property: JsonPropertyName("success")] bool Success
|
||||
[property: JsonPropertyName("success")] bool IsSuccess
|
||||
);
|
||||
@@ -8,9 +8,9 @@ namespace Lumina.Presentation.Web.Common.DTO.Common;
|
||||
/// Response data transfer object for the JSON responses of the web application that carry a payload.
|
||||
/// </summary>
|
||||
/// <typeparam name="TData">The type of the payload of the response.</typeparam>
|
||||
/// <param name="Success">Whether the operation succeeded or not.</param>
|
||||
/// <param name="IsSuccess">Whether the operation succeeded or not.</param>
|
||||
/// <param name="Data">The payload of the response.</param>
|
||||
public record SuccessResponse<TData>(
|
||||
[property: JsonPropertyName("success")] bool Success,
|
||||
[property: JsonPropertyName("success")] bool IsSuccess,
|
||||
[property: JsonPropertyName("data")] TData? Data
|
||||
);
|
||||
@@ -9,11 +9,11 @@ namespace Lumina.Presentation.Web.Common.DTO.Themes;
|
||||
/// Data transfer object for a conditional or repeating section in a theme template.
|
||||
/// </summary>
|
||||
/// <param name="Expression">The property path expression that controls the section.</param>
|
||||
/// <param name="Inverted">Whether the section renders when the resolved value is falsy instead of truthy.</param>
|
||||
/// <param name="IsInverted">Whether the section renders when the resolved value is falsy instead of truthy.</param>
|
||||
/// <param name="Children">The template nodes rendered when the section is active.</param>
|
||||
[DebuggerDisplay("Expression: {Expression}")]
|
||||
public sealed record ThemeSectionNodeDto(
|
||||
string Expression,
|
||||
bool Inverted,
|
||||
bool IsInverted,
|
||||
IReadOnlyList<ThemeTemplateNodeDto> Children
|
||||
) : ThemeTemplateNodeDto;
|
||||
+2
-2
@@ -8,9 +8,9 @@ namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Directori
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetDirectoriesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
+2
-2
@@ -8,9 +8,9 @@ namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetFilesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
+2
-2
@@ -8,9 +8,9 @@ namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Files;
|
||||
/// 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>
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden file system elements or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public record GetTreeFilesRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
+3
-3
@@ -8,9 +8,9 @@ namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
|
||||
/// 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}")]
|
||||
/// <param name="ShouldIncludeHiddenElements">Whether to include hidden elements in the search results, or not. Optional.</param>
|
||||
[DebuggerDisplay("Path: {Path}, ShouldIncludeHiddenElements: {ShouldIncludeHiddenElements}")]
|
||||
public record CheckPathExistsRequest(
|
||||
string? Path,
|
||||
bool IncludeHiddenElements
|
||||
bool ShouldIncludeHiddenElements
|
||||
);
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetDirectoriesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
DirectoryDto[] response = await _apiHttpClient.GetAsync<DirectoryDto[]>($"{ApiRoutes.Directories.GET_DIRECTORIES}?path={Uri.EscapeDataString(request.Path!)}&includeHiddenElements={request.IncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
DirectoryDto[] response = await _apiHttpClient.GetAsync<DirectoryDto[]>($"{ApiRoutes.Directories.GET_DIRECTORIES}?path={Uri.EscapeDataString(request.Path!)}&shouldIncludeHiddenElements={request.ShouldIncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess(response);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -24,11 +24,11 @@ public class GetDirectoriesEndpointSummary : Summary<GetDirectoriesEndpoint, Get
|
||||
Description = "Retrieves the directories of the file system path identified by the request.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directories. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
RequestParam(r => r.ShouldIncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
ExampleRequest = new GetDirectoriesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
ShouldIncludeHiddenElements: true
|
||||
);
|
||||
|
||||
Response(200, "The directories of the file system path are returned.", example: new SuccessResponse<DirectoryDto[]>(true, default));
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetFilesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
FileDto[] response = await _apiHttpClient.GetAsync<FileDto[]>($"{ApiRoutes.Files.GET_FILES}?path={Uri.EscapeDataString(request.Path!)}&includeHiddenElements={request.IncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
FileDto[] response = await _apiHttpClient.GetAsync<FileDto[]>($"{ApiRoutes.Files.GET_FILES}?path={Uri.EscapeDataString(request.Path!)}&shouldIncludeHiddenElements={request.ShouldIncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess(response);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -24,11 +24,11 @@ public class GetFilesEndpointSummary : Summary<GetFilesEndpoint, GetFilesRequest
|
||||
Description = "Retrieves the files of the file system path identified by the request.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the files. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
RequestParam(r => r.ShouldIncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
ExampleRequest = new GetFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
ShouldIncludeHiddenElements: true
|
||||
);
|
||||
|
||||
Response(200, "The files of the file system path are returned.", example: new SuccessResponse<FileDto[]>(true, default));
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetTreeFilesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
FileSystemTreeNodeDto[] response = await _apiHttpClient.GetAsync<FileSystemTreeNodeDto[]>($"{ApiRoutes.Files.GET_TREE_FILES}?path={Uri.EscapeDataString(request.Path!)}&includeHiddenElements={request.IncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
FileSystemTreeNodeDto[] response = await _apiHttpClient.GetAsync<FileSystemTreeNodeDto[]>($"{ApiRoutes.Files.GET_TREE_FILES}?path={Uri.EscapeDataString(request.Path!)}&shouldIncludeHiddenElements={request.ShouldIncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess(response);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -24,11 +24,11 @@ public class GetTreeFilesEndpointSummary : Summary<GetTreeFilesEndpoint, GetTree
|
||||
Description = "Retrieves the file system tree of the file system path identified by the request.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the tree files. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
RequestParam(r => r.ShouldIncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
ExampleRequest = new GetTreeFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
ShouldIncludeHiddenElements: true
|
||||
);
|
||||
|
||||
Response(200, "The file system tree of the file system path is returned.", example: new SuccessResponse<FileSystemTreeNodeDto[]>(true, default));
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CheckPathExistsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
PathExistsDto response = await _apiHttpClient.GetAsync<PathExistsDto>($"{ApiRoutes.Path.CHECK_PATH_EXISTS}?path={Uri.EscapeDataString(request.Path!)}&includeHiddenElements={request.IncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
PathExistsDto response = await _apiHttpClient.GetAsync<PathExistsDto>($"{ApiRoutes.Path.CHECK_PATH_EXISTS}?path={Uri.EscapeDataString(request.Path!)}&shouldIncludeHiddenElements={request.ShouldIncludeHiddenElements}", cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess(new { exists = response.Exists });
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -22,11 +22,11 @@ public class CheckPathExistsEndpointSummary : Summary<CheckPathExistsEndpoint, C
|
||||
Description = "Checks whether the file system path identified by the request exists.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path to check the existence of. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden elements in the search results, or not. Optional.");
|
||||
RequestParam(r => r.ShouldIncludeHiddenElements, "Whether to include hidden elements in the search results, or not. Optional.");
|
||||
|
||||
ExampleRequest = new CheckPathExistsRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
ShouldIncludeHiddenElements: true
|
||||
);
|
||||
|
||||
Response(200, "Whether the file system path exists is returned.", example: new { success = true, data = new { exists = true } });
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed class ThemeTemplateEngine
|
||||
ThemeSectionNodeDto? scriptsSection = null;
|
||||
foreach (ThemeTemplateNodeDto node in parseResult.Value)
|
||||
{
|
||||
if (node is ThemeSectionNodeDto { Inverted: false } section
|
||||
if (node is ThemeSectionNodeDto { IsInverted: false } section
|
||||
&& scriptsSection is null
|
||||
&& string.Equals(section.Expression, "scripts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public sealed class ThemeTemplateEngine
|
||||
if (childrenResult.IsFailure)
|
||||
return childrenResult.Errors;
|
||||
|
||||
nodes.Add(new ThemeSectionNodeDto(expression, Inverted: tag[0] == '^', Children: childrenResult.Value));
|
||||
nodes.Add(new ThemeSectionNodeDto(expression, IsInverted: tag[0] == '^', Children: childrenResult.Value));
|
||||
break;
|
||||
}
|
||||
case '/':
|
||||
@@ -247,16 +247,16 @@ public sealed class ThemeTemplateEngine
|
||||
private static Result<Success> RenderSection(ThemeSectionNodeDto section, ThemeRenderScopeDto scope, StringBuilder output)
|
||||
{
|
||||
object? value = Resolve(section.Expression, scope);
|
||||
bool truthy = IsTruthy(value);
|
||||
if (section.Inverted)
|
||||
bool isTruthy = IsTruthy(value);
|
||||
if (section.IsInverted)
|
||||
{
|
||||
if (!truthy)
|
||||
if (!isTruthy)
|
||||
return RenderNodes(section.Children, scope, output);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
if (!truthy)
|
||||
if (!isTruthy)
|
||||
return Result.Success;
|
||||
|
||||
if (value is bool)
|
||||
@@ -425,7 +425,7 @@ public sealed class ThemeTemplateEngine
|
||||
return value switch
|
||||
{
|
||||
null => string.Empty,
|
||||
bool boolean => boolean ? "true" : "false",
|
||||
bool isBoolean => isBoolean ? "true" : "false",
|
||||
DateTime dateTime => dateTime.ToString("O", CultureInfo.InvariantCulture),
|
||||
DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("O", CultureInfo.InvariantCulture),
|
||||
IFormattable formattable => formattable.ToString(null, CultureInfo.InvariantCulture) ?? string.Empty,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
@if (Model.ShouldShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator))
|
||||
addressBarInput.value += pathSeparator;
|
||||
} else {
|
||||
const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/api-check-path-exists?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`);
|
||||
const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/api-check-path-exists?path=${encodeURIComponent(path)}&shouldIncludeHiddenElements=${showHiddenElements}`);
|
||||
if (pathExistsResponse !== undefined && !pathExistsResponse.exists) {
|
||||
notificationService.show("Specified path does not exist!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented
|
||||
return false;
|
||||
@@ -775,7 +775,7 @@
|
||||
* @param {Function} callback - Function to call for each directory received.
|
||||
*/
|
||||
async function fetchFileSystemDirectoriesAsync(path, callback) {
|
||||
await fetchJsonDataAsync(`${clientBasePath}directories/api-get-directories?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`, callback, 'Directory');
|
||||
await fetchJsonDataAsync(`${clientBasePath}directories/api-get-directories?path=${encodeURIComponent(path)}&shouldIncludeHiddenElements=${showHiddenElements}`, callback, 'Directory');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -784,7 +784,7 @@
|
||||
* @param {Function} callback - Function to call for each file received.
|
||||
*/
|
||||
async function fetchFileSystemFilesAsync(path, callback) {
|
||||
await fetchJsonDataAsync(`${clientBasePath}files/api-get-tree-files?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`, callback, 'File');
|
||||
await fetchJsonDataAsync(`${clientBasePath}files/api-get-tree-files?path=${encodeURIComponent(path)}&shouldIncludeHiddenElements=${showHiddenElements}`, callback, 'File');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user