mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 17:11:10 +00:00
Replaces MVC with FastEndpoints in Lumina.Presentation.Api
This commit is contained in:
1 parent
b1a20716df
commit
c7b8bc2f1c
519 files changed
+15329
-8539
No files matched your search
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
public static class FileSystemTreeNodeResponseMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="response"/> to <see cref="WindowsRootItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="response">The response to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
public static ErrorOr<WindowsRootItem> ToWindowsRootItem(this FileSystemTreeNodeResponse response)
|
||||
{
|
||||
return WindowsRootItem.Create(
|
||||
response.Path,
|
||||
response.Name,
|
||||
FileSystemItemStatus.Accessible
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="_"/> to <see cref="UnixRootItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="_">The response to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
public static ErrorOr<UnixRootItem> ToUnixRootItem(this FileSystemTreeNodeResponse _)
|
||||
{
|
||||
return UnixRootItem.Create(
|
||||
FileSystemItemStatus.Accessible
|
||||
);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Directory"/>.
|
||||
/// </summary>
|
||||
public static class DirectoryMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this Directory domainModel)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Name = domainModel.Name,
|
||||
Path = domainModel.Id.Path,
|
||||
ItemType = domainModel.Type,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<Directory> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="DirectoryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static DirectoryResponse ToResponse(this Directory domainModel)
|
||||
{
|
||||
return new DirectoryResponse(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
domainModel.DateCreated.Value,
|
||||
domainModel.DateModified.Value,
|
||||
domainModel.Items.Select(fileSystemItem => fileSystemItem.ToFileSystemItemModel())
|
||||
.ToList()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="DirectoryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<DirectoryResponse> ToResponses(this IEnumerable<Directory> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectories;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetDirectoriesRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetDirectoriesRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetDirectoriesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetDirectoriesQuery ToQuery(this GetDirectoriesRequest request)
|
||||
{
|
||||
return new GetDirectoriesQuery(request.Path, request.IncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectoryTree;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetDirectoryTreeRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetDirectoryTreeRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetDirectoryTreeQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetDirectoryTreeQuery ToQuery(this GetDirectoryTreeRequest request)
|
||||
{
|
||||
return new GetDirectoryTreeQuery(request.Path, request.IncludeFiles, request.IncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetTreeDirectories;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetTreeDirectoriesRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetTreeDirectoriesRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetTreeDirectoriesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetTreeDirectoriesQuery ToQuery(this GetTreeDirectoriesRequest request)
|
||||
{
|
||||
return new GetTreeDirectoriesQuery(request.Path, request.IncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Entities.FileSystemManagement;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="FileSystemItem"/>.
|
||||
/// </summary>
|
||||
public static class FileSystemItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemItemEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted model.</returns>
|
||||
public static FileSystemItemEntity ToFileSystemItemModel(this FileSystemItem domainModel)
|
||||
{
|
||||
return new FileSystemItemEntity(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
DateTime.Now,
|
||||
DateTime.Now
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted model.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when the provided parameter is not an expected descendant of <see cref="FileSystemItem"/>.</exception>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this FileSystemItem domainModel)
|
||||
{
|
||||
if (domainModel is Directory directory)
|
||||
return directory.ToFileSystemTreeNodeResponse();
|
||||
else if (domainModel is File file)
|
||||
return file.ToFileSystemTreeNodeResponse();
|
||||
else if (domainModel is WindowsRootItem windowsRootItem)
|
||||
return windowsRootItem.ToTreeNodeResponse();
|
||||
else if (domainModel is UnixRootItem unixRootItem)
|
||||
return unixRootItem.ToTreeNodeResponse();
|
||||
else
|
||||
throw new ArgumentException("Invalid FileSystemItem");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to <see cref="IEnumerable<FileSystemTreeNodeResponse>"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted models.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToTreeNodeResponses(this IEnumerable<FileSystemItem> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="UnixRootItem"/>.
|
||||
/// </summary>
|
||||
public static class UnixRootItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this UnixRootItem domainModel)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Path = domainModel.Id.Path,
|
||||
Name = domainModel.Name,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="WindowsRootItem"/>.
|
||||
/// </summary>
|
||||
public static class WindowsRootItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this WindowsRootItem domainModel)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Path = domainModel.Id.Path,
|
||||
Name = domainModel.Name,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
IsExpanded = false
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="File"/>.
|
||||
/// </summary>
|
||||
public static class FileMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this File domainModel)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Name = domainModel.Name,
|
||||
Path = domainModel.Id.Path,
|
||||
ItemType = domainModel.Type,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<File> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToFileSystemTreeNodeResponse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileResponse ToResponse(this File domainModel)
|
||||
{
|
||||
return new FileResponse(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
domainModel.DateCreated.HasValue ? domainModel.DateCreated.Value : default,
|
||||
domainModel.DateModified.HasValue ? domainModel.DateModified.Value : default,
|
||||
domainModel.Size
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileResponse> ToResponses(this IEnumerable<File> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetFilesRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetFilesRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetFilesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetFilesQuery ToQuery(this GetFilesRequest request)
|
||||
{
|
||||
return new GetFilesQuery(request.Path, request.IncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetTreeDirectories;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetTreeFilesRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetTreeFilesRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetTreeDirectoriesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetTreeFilesQuery ToQuery(this GetTreeFilesRequest request)
|
||||
{
|
||||
return new GetTreeFilesQuery(request.Path, request.IncludeHiddenElements);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="CheckPathExistsRequest"/>.
|
||||
/// </summary>
|
||||
public static class CheckPathExistsQueryMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="CheckPathExistsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static CheckPathExistsQuery ToQuery(this CheckPathExistsRequest request)
|
||||
{
|
||||
return new CheckPathExistsQuery(
|
||||
request.Path,
|
||||
request.IncludeHiddenElements
|
||||
);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="CombinePathRequest"/>.
|
||||
/// </summary>
|
||||
public static class CombinePathRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="CombinePathCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static CombinePathCommand ToCommand(this CombinePathRequest request)
|
||||
{
|
||||
return new CombinePathCommand(
|
||||
request.OriginalPath,
|
||||
request.NewPath
|
||||
);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetPathParentRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetPathParentRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetPathParentQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetPathParentQuery ToQuery(this GetPathParentRequest request)
|
||||
{
|
||||
return new GetPathParentQuery(
|
||||
request.Path
|
||||
);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetPathRootRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetPathRootRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetPathRootQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetPathRootQuery ToQuery(this GetPathRootRequest request)
|
||||
{
|
||||
return new GetPathRootQuery(request.Path);
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="PathSegment"/>.
|
||||
/// </summary>
|
||||
public static class PathSegmentMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="PathSegmentResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static PathSegmentResponse ToResponse(this PathSegment domainModel)
|
||||
{
|
||||
return new PathSegmentResponse(
|
||||
domainModel.Name
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="PathSegmentResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<PathSegmentResponse> ToResponses(this IEnumerable<PathSegment> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="SplitPathRequest"/>.
|
||||
/// </summary>
|
||||
public static class SplitPathRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="SplitPathCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static SplitPathCommand ToCommand(this SplitPathRequest request)
|
||||
{
|
||||
return new SplitPathCommand(
|
||||
request.Path
|
||||
);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="ValidatePathRequest"/>.
|
||||
/// </summary>
|
||||
public static class ValidatePathRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="ValidatePathQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static ValidatePathQuery ToQuery(this ValidatePathRequest request)
|
||||
{
|
||||
return new ValidatePathQuery(
|
||||
request.Path
|
||||
);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetThumbnailRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetThumbnailRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetThumbnailQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetThumbnailQuery ToQuery(this GetThumbnailRequest request)
|
||||
{
|
||||
return new GetThumbnailQuery(request.Path, request.Quality);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Thumbnail"/>.
|
||||
/// </summary>
|
||||
public static class ThumbnailMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="ThumbnailResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static ThumbnailResponse ToResponse(this Thumbnail domainModel)
|
||||
{
|
||||
return new ThumbnailResponse(
|
||||
domainModel.Type,
|
||||
domainModel.Bytes
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user