Implements first stage library management system

This commit is contained in:
BinaryAlley committed 2024-11-03 19:43:46 +02:00
1 parent 5e0f94cd82
commit 36352ea9e8
291 files changed
+3733 -1384

No files matched your search

@@ -2,7 +2,7 @@
using ErrorOr;
using Lumina.Contracts.Enums.FileSystem;
using Lumina.Contracts.Responses.FileSystemManagement.Common;
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
#endregion
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Common;
@@ -16,7 +16,7 @@ public static class FileSystemTreeNodeResponseMapping
/// Converts <paramref name="response"/> to <see cref="WindowsRootItem"/>.
/// </summary>
/// <param name="response">The response to be converted.</param>
/// <returns>The converted domain model.</returns>
/// <returns>The converted domain entity.</returns>
public static ErrorOr<WindowsRootItem> ToWindowsRootItem(this FileSystemTreeNodeResponse response)
{
return WindowsRootItem.Create(
@@ -30,7 +30,7 @@ public static class FileSystemTreeNodeResponseMapping
/// Converts <paramref name="_"/> to <see cref="UnixRootItem"/>.
/// </summary>
/// <param name="_">The response to be converted.</param>
/// <returns>The converted domain model.</returns>
/// <returns>The converted domain entity.</returns>
public static ErrorOr<UnixRootItem> ToUnixRootItem(this FileSystemTreeNodeResponse _)
{
return UnixRootItem.Create(
@@ -2,7 +2,7 @@
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 Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
using System.Collections.Generic;
using System.Linq;
#endregion
@@ -15,58 +15,58 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
public static class DirectoryMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this Directory domainModel)
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this Directory domainEntity)
{
return new FileSystemTreeNodeResponse()
{
Name = domainModel.Name,
Path = domainModel.Id.Path,
ItemType = domainModel.Type,
Name = domainEntity.Name,
Path = domainEntity.Id.Path,
ItemType = domainEntity.Type,
IsExpanded = false,
ChildrenLoaded = false,
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
.ToList()
Children = domainEntity.Items.Select(item => item.ToTreeNodeResponse())
.ToList()
};
}
/// <summary>
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModels">The domain models to be converted.</param>
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted responses.</returns>
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<Directory> domainModels)
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<Directory> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
return domainEntities.Select(domainEntity => domainEntity.ToTreeNodeResponse());
}
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="DirectoryResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="DirectoryResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static DirectoryResponse ToResponse(this Directory domainModel)
public static DirectoryResponse ToResponse(this Directory domainEntity)
{
return new DirectoryResponse(
domainModel.Id.Path,
domainModel.Name,
domainModel.DateCreated.Value,
domainModel.DateModified.Value,
domainModel.Items.Select(fileSystemItem => fileSystemItem.ToFileSystemItemModel())
.ToList()
domainEntity.Id.Path,
domainEntity.Name,
domainEntity.DateCreated.Value,
domainEntity.DateModified.Value,
domainEntity.Items.Select(fileSystemItem => fileSystemItem.ToFileSystemItemEntity())
.ToList()
);
}
/// <summary>
/// Converts <paramref name="domainModels"/> to a collection of <see cref="DirectoryResponse"/>.
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="DirectoryResponse"/>.
/// </summary>
/// <param name="domainModels">The domain models to be converted.</param>
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted responses.</returns>
public static IEnumerable<DirectoryResponse> ToResponses(this IEnumerable<Directory> domainModels)
public static IEnumerable<DirectoryResponse> ToResponses(this IEnumerable<Directory> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToResponse());
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
}
}
@@ -3,8 +3,8 @@ 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 Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -18,47 +18,47 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
public static class FileSystemItemMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemItemEntity"/>.
/// Converts <paramref name="domainEntity"/> 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)
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted entity.</returns>
public static FileSystemItemEntity ToFileSystemItemEntity(this FileSystemItem domainEntity)
{
return new FileSystemItemEntity(
domainModel.Id.Path,
domainModel.Name,
domainEntity.Id.Path,
domainEntity.Name,
DateTime.Now,
DateTime.Now
);
}
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <returns>The converted model.</returns>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted entity.</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)
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this FileSystemItem domainEntity)
{
if (domainModel is Directory directory)
if (domainEntity is Directory directory)
return directory.ToFileSystemTreeNodeResponse();
else if (domainModel is File file)
else if (domainEntity is File file)
return file.ToFileSystemTreeNodeResponse();
else if (domainModel is WindowsRootItem windowsRootItem)
else if (domainEntity is WindowsRootItem windowsRootItem)
return windowsRootItem.ToTreeNodeResponse();
else if (domainModel is UnixRootItem unixRootItem)
else if (domainEntity is UnixRootItem unixRootItem)
return unixRootItem.ToTreeNodeResponse();
else
throw new ArgumentException("Invalid FileSystemItem");
}
/// <summary>
/// Converts <paramref name="domainModels"/> to <see cref="IEnumerable<FileSystemTreeNodeResponse>"/>.
/// Converts <paramref name="domainEntities"/> 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)
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted entities.</returns>
public static IEnumerable<FileSystemTreeNodeResponse> ToTreeNodeResponses(this IEnumerable<FileSystemItem> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
return domainEntities.Select(domainEntity => domainEntity.ToTreeNodeResponse());
}
}
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.FileSystem;
using Lumina.Contracts.Responses.FileSystemManagement.Common;
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
using System.Linq;
#endregion
@@ -13,21 +13,21 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
public static class UnixRootItemMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this UnixRootItem domainModel)
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this UnixRootItem domainEntity)
{
return new FileSystemTreeNodeResponse()
{
Path = domainModel.Id.Path,
Name = domainModel.Name,
Path = domainEntity.Id.Path,
Name = domainEntity.Name,
ItemType = FileSystemItemType.Root,
IsExpanded = false,
ChildrenLoaded = false,
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
.ToList()
Children = domainEntity.Items.Select(item => item.ToTreeNodeResponse())
.ToList()
};
}
}
@@ -1,10 +1,7 @@
#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;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
#endregion
namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
@@ -15,16 +12,16 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
public static class WindowsRootItemMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this WindowsRootItem domainModel)
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this WindowsRootItem domainEntity)
{
return new FileSystemTreeNodeResponse()
{
Path = domainModel.Id.Path,
Name = domainModel.Name,
Path = domainEntity.Id.Path,
Name = domainEntity.Name,
ItemType = FileSystemItemType.Root,
IsExpanded = false
};
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileSystemManagement.Common;
using Lumina.Contracts.Responses.FileSystemManagement.Files;
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
using System.Collections.Generic;
using System.Linq;
#endregion
@@ -14,55 +14,55 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Files;
public static class FileMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this File domainModel)
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this File domainEntity)
{
return new FileSystemTreeNodeResponse()
{
Name = domainModel.Name,
Path = domainModel.Id.Path,
ItemType = domainModel.Type,
Name = domainEntity.Name,
Path = domainEntity.Id.Path,
ItemType = domainEntity.Type,
IsExpanded = false,
ChildrenLoaded = false
};
}
/// <summary>
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
/// </summary>
/// <param name="domainModels">The domain models to be converted.</param>
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted responses.</returns>
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<File> domainModels)
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<File> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToFileSystemTreeNodeResponse());
return domainEntities.Select(domainEntity => domainEntity.ToFileSystemTreeNodeResponse());
}
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="FileResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="FileResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static FileResponse ToResponse(this File domainModel)
public static FileResponse ToResponse(this File domainEntity)
{
return new FileResponse(
domainModel.Id.Path,
domainModel.Name,
domainModel.DateCreated.HasValue ? domainModel.DateCreated.Value : default,
domainModel.DateModified.HasValue ? domainModel.DateModified.Value : default,
domainModel.Size
domainEntity.Id.Path,
domainEntity.Name,
domainEntity.DateCreated.HasValue ? domainEntity.DateCreated.Value : default,
domainEntity.DateModified.HasValue ? domainEntity.DateModified.Value : default,
domainEntity.Size
);
}
/// <summary>
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileResponse"/>.
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileResponse"/>.
/// </summary>
/// <param name="domainModels">The domain models to be converted.</param>
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted responses.</returns>
public static IEnumerable<FileResponse> ToResponses(this IEnumerable<File> domainModels)
public static IEnumerable<FileResponse> ToResponses(this IEnumerable<File> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToResponse());
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
}
}
@@ -1,6 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
using System.Collections.Generic;
using System.Linq;
#endregion
@@ -13,24 +13,24 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
public static class PathSegmentMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="PathSegmentResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="PathSegmentResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static PathSegmentResponse ToResponse(this PathSegment domainModel)
public static PathSegmentResponse ToResponse(this PathSegment domainEntity)
{
return new PathSegmentResponse(
domainModel.Name
domainEntity.Name
);
}
/// <summary>
/// Converts <paramref name="domainModels"/> to a collection of <see cref="PathSegmentResponse"/>.
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="PathSegmentResponse"/>.
/// </summary>
/// <param name="domainModels">The domain models to be converted.</param>
/// <param name="domainEntities">The domain entities to be converted.</param>
/// <returns>The converted responses.</returns>
public static IEnumerable<PathSegmentResponse> ToResponses(this IEnumerable<PathSegment> domainModels)
public static IEnumerable<PathSegmentResponse> ToResponses(this IEnumerable<PathSegment> domainEntities)
{
return domainModels.Select(domainModel => domainModel.ToResponse());
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
}
}
@@ -1,6 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
#endregion
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
@@ -11,15 +11,15 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
public static class ThumbnailMapping
{
/// <summary>
/// Converts <paramref name="domainModel"/> to <see cref="ThumbnailResponse"/>.
/// Converts <paramref name="domainEntity"/> to <see cref="ThumbnailResponse"/>.
/// </summary>
/// <param name="domainModel">The domain model to be converted.</param>
/// <param name="domainEntity">The domain entity to be converted.</param>
/// <returns>The converted response.</returns>
public static ThumbnailResponse ToResponse(this Thumbnail domainModel)
public static ThumbnailResponse ToResponse(this Thumbnail domainEntity)
{
return new ThumbnailResponse(
domainModel.Type,
domainModel.Bytes
domainEntity.Type,
domainEntity.Bytes
);
}
}