Implements directory browser dialog, part 1: file system treeview

This commit is contained in:
BinaryAlley committed 2024-09-15 13:07:53 +03:00
1 parent 4a53348013
commit 4e4ecbbfca
318 files changed
+6012 -1184

No files matched your search

+2 -2
View File
@@ -189,8 +189,8 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
Lyrida - web based file explorer.
Copyright (C) 2023 BinaryAlley
Lumina - complete management solution for media libraries of all kinds.
Copyright (C) 2024 BinaryAlley
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+3 -1
View File
@@ -36,8 +36,10 @@
- _**Cover Song**_: A rendition of a song performed by an artist other than the original
- _**Remix**_: A modified version of an original song
- _**Sound Effect**_: A short audio clip used for specific purposes
- _**Soundtrack**_: A collection of music used in a film or TV show
- _**Podcast**_: A series of audio episodes
- _**Podcast Episode**_: An individual installment of a podcast
- _**Radio Show**_: An audio program broadcast on the radio
## Written Content
- _**Book**_: A standalone written work
@@ -115,7 +117,7 @@
- VideoLibrary (root: VideoLibrary, entities: TVShow, Season, Episode, Movie, FilmSeries, ConcertVideo, Documentary, TutorialVideo, HomeVideo, Anime, YouTubeVideo, MusicVideo)
- AudioLibrary (root: AudioLibrary, entities: Song, Album, Artist, Audiobook, LiveRecording, Interview, CoverSong, Remix, SoundEffect)
- PodcastLibrary (root: PodcastLibrary, entities: Podcast, PodcastEpisode)
- WrittenContentLibrary (root: WrittenContentLibrary, entities: Book, BookSeries, ComicBook, ComicSeries, Magazine, MagazineIssue, Manga, GraphicNovel, AcademicPaper, SheetMusic, Screenplay)
- WrittenContentLibrary (root: WrittenContentLibrary, entities: Book, EBook, BookSeries, ComicBook, ComicSeries, Magazine, MagazineIssue, Manga, GraphicNovel, AcademicPaper, SheetMusic, Screenplay)
- PhotoLibrary (root: PhotoLibrary, entities: Photo, PhotoAlbum, AlbumArtwork, MoviePoster)
- UserProfile (root: User, entities: Playlist, Collection)
- SupplementaryContentLibrary (root: SupplementaryContentLibrary, entities: SubtitleFile, Lyrics, LanguageTrack)
@@ -1,13 +1,15 @@
#region ========================================================================= USING =====================================================================================
using Mediator;
using ErrorOr;
using FluentValidation;
using Mediator;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.Behaviors;
/// <summary>
/// Behavior pipeline for the register command
/// Represents a validation behavior in the MediatR pipeline for handling requests and responses.
/// </summary>
/// <typeparam name="TRequest">The type representing a request. It should implement <see cref="IRequest{TResponse}"/>.</typeparam>
/// <typeparam name="TResponse">The type representing a response. It should implement <see cref="IErrorOr"/> interface.</typeparam>
@@ -15,7 +17,7 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
where TResponse : IErrorOr
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IValidator<TRequest>? validator;
private readonly IValidator<TRequest>? _validator;
#endregion
#region ====================================================================== CTOR =====================================================================================
@@ -25,7 +27,7 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
/// <param name="validator">The validator used in this behavior pipeline for the Mediator commands and queries.</param>
public ValidationBehavior(IValidator<TRequest>? validator = null)
{
this.validator = validator;
_validator = validator;
}
#endregion
@@ -39,13 +41,13 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
public async ValueTask<TResponse> Handle(TRequest request, CancellationToken cancellationToken, MessageHandlerDelegate<TRequest, TResponse> next)
{
// if there is no validator, just invoke the handler
if (validator is null)
return await next(request, cancellationToken);
if (_validator is null)
return await next(request, cancellationToken).ConfigureAwait(false);
// before the handler of the command is executed
var validationResult = await validator.ValidateAsync(request, cancellationToken);
var validationResult = await _validator.ValidateAsync(request, cancellationToken).ConfigureAwait(false);
// if there are no validation errors, invoke the command handler
if (validationResult.IsValid)
return await next(request, cancellationToken);
return await next(request, cancellationToken).ConfigureAwait(false);
// after the command handler is executed
var errors = validationResult.Errors.ConvertAll(validationFailure => Error.Validation(description: validationFailure.ErrorMessage));
// the compiler doesn't know there is an implicit converter from a list of errors to the ErrorOr object, and unfortunately, there is no way around this but to use some magic
@@ -1,40 +1,41 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using Lumina.Domain.Common.Primitives;
#endregion
namespace Lumina.Application.Common.Converters;
/// <summary>
/// Converts an <see cref="Optional{T}"/> to and from JSON.
/// Converts an <see cref="Optional{TValue}"/> to and from JSON.
/// </summary>
/// <typeparam name="T">The type of the value represented by the <see cref="Optional{T}"/> structure.</typeparam>
public class OptionalJsonConverter<T> : JsonConverter<Optional<T>>
/// <typeparam name="TValue">The type of the value represented by the <see cref="Optional{TValue}"/> structure.</typeparam>
public class OptionalJsonConverter<TValue> : JsonConverter<Optional<TValue>>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Reads and converts the JSON to an instance of <see cref="Optional{T}"/>.
/// Reads and converts the JSON to an instance of <see cref="Optional{TValue}"/>.
/// </summary>
/// <param name="reader">The <see cref="Utf8JsonReader"/> to read from.</param>
/// <param name="typeToConvert">The type to convert.</param>
/// <param name="options">An object that specifies serialization options to use.</param>
/// <returns>The converted <see cref="Optional{T}"/> value.</returns>
public override Optional<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
/// <returns>The converted <see cref="Optional{TValue}"/> value.</returns>
public override Optional<TValue> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Null)
return Optional<T>.None();
var value = JsonSerializer.Deserialize<T>(ref reader, options);
return Optional<T>.Some(value!);
return Optional<TValue>.None();
var value = JsonSerializer.Deserialize<TValue>(ref reader, options);
return Optional<TValue>.Some(value!);
}
/// <summary>
/// Writes an <see cref="Optional{T}"/> value as JSON.
/// Writes an <see cref="Optional{TValue}"/> value as JSON.
/// </summary>
/// <param name="writer">The <see cref="Utf8JsonWriter"/> to write to.</param>
/// <param name="value">The value to convert to JSON.</param>
/// <param name="options">An object that specifies serialization options to use.</param>
public override void Write(Utf8JsonWriter writer, Optional<T> value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, Optional<TValue> value, JsonSerializerOptions options)
{
if (value.HasValue)
JsonSerializer.Serialize(writer, value.Value, options);
@@ -1,7 +1,8 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using Lumina.Domain.Common.Primitives;
#endregion
namespace Lumina.Application.Common.Converters;
@@ -16,7 +17,7 @@ public class OptionalJsonConverterFactory : JsonConverterFactory
/// Determines whether the converter can convert the specified type.
/// </summary>
/// <param name="typeToConvert">The type to check for convertibility.</param>
/// <returns><see langword="true"/> if the type is <see cref="Optional{T}"/>, <see langword="false"/> otherwise.</returns>
/// <returns><see langword="true"/> if the type is <see cref="Optional{TValue}"/>, <see langword="false"/> otherwise.</returns>
public override bool CanConvert(Type typeToConvert)
{
if (!typeToConvert.IsGenericType)
@@ -29,7 +30,7 @@ public class OptionalJsonConverterFactory : JsonConverterFactory
/// </summary>
/// <param name="typeToConvert">The type for which to create a converter.</param>
/// <param name="options">The serializer options to use.</param>
/// <returns>A converter for <see cref="Optional{T}"/>.</returns>
/// <returns>A converter for <see cref="Optional{TValue}"/>.</returns>
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
Type valueType = typeToConvert.GetGenericArguments()[0];
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Application.Common.Models.Books;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Books;
@@ -9,8 +9,8 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Books;
/// <summary>
/// Interface for the repository for books.
/// </summary>
public interface IBookRepository : IRepository<BookDto>,
IInsertRepositoryAction<BookDto>,
IGetAllRepositoryAction<BookDto>
public interface IBookRepository : IRepository<BookModel>,
IInsertRepositoryAction<BookModel>,
IGetAllRepositoryAction<BookModel>
{
}
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -13,7 +14,7 @@ public interface IDeleteAllRepositoryAction
/// <summary>
/// Deletes all entities from the storage medium.
/// </summary>
/// <returns>An <see cref="ErrorOr{T}"/> representing either a successfull operation, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Deleted>> DeleteAllAsync();
#endregion
}
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -16,7 +18,7 @@ public interface IDeleteByIdRepositoryAction<TId> where TId : notnull
/// </summary>
/// <param name="id">The id of the element to be deleted.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{T}"/> representing either a successfull operation, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Deleted>> DeleteByIdAsync(TId id, CancellationToken cancellationToken);
#endregion
}
@@ -1,6 +1,9 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -16,7 +19,7 @@ public interface IGetAllRepositoryAction<TModel> where TModel : IStorageEntity
/// Gets all data of type <typeparamref name="TModel"/> from the storage medium.
/// </summary>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{T}"/> containing either a collection of <typeparamref name="TModel"/>, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of <typeparamref name="TModel"/>, or an error.</returns>
Task<ErrorOr<IEnumerable<TModel>>> GetAllAsync(CancellationToken cancellationToken);
#endregion
}
@@ -1,6 +1,8 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -19,7 +21,7 @@ public interface IGetByIdRepositoryAction<TModel, TId> where TModel : IStorageEn
/// </summary>
/// <param name="id">The id of the element to get.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{T}"/> containing either a <typeparamref name="TModel"/> identified by <paramref name="id"/>, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a <typeparamref name="TModel"/> identified by <paramref name="id"/>, or an error.</returns>
Task<ErrorOr<TModel?>> GetByIdAsync(TId id, CancellationToken cancellationToken);
#endregion
}
@@ -1,6 +1,8 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -17,7 +19,7 @@ public interface IInsertRepositoryAction<TModel> where TModel : IStorageEntity
/// </summary>
/// <param name="data">The element to be saved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{T}"/> representing either a successfull operation, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Created>> InsertAsync(TModel data, CancellationToken cancellationToken);
#endregion
}
@@ -1,6 +1,8 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
@@ -17,7 +19,7 @@ public interface IUpdateRepositoryAction<TModel> where TModel : IStorageEntity
/// </summary>
/// <param name="data">The element that will be updated.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{T}"/> representing either a successfull operation, or an error.</returns>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Updated>> UpdateAsync(TModel data, CancellationToken cancellationToken);
#endregion
}
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Common.Base;
@@ -1,4 +1,9 @@
namespace Lumina.Application.Common.DataAccess.UoW;
#region ========================================================================= USING =====================================================================================
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.UoW;
/// <summary>
/// Interaction boundary with the Data Access Layer.
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Mapster;
#endregion
namespace Lumina.Application.Common.Mapping.FileManagement;
/// <summary>
/// Mapping configuration for file system directories between the domain object and the presentation object.
/// </summary>
public class DirectoryMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
/// <param name="config">The type adapter configuration.</param>
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Directory, FileSystemTreeNodeResponse>()
.Map(dest => dest.Name, src => src.Name)
.Map(dest => dest.Path, src => src.Id.Path)
.Map(dest => dest.ItemType, src => src.Type)
.Map(dest => dest.IsExpanded, () => false)
.Map(dest => dest.ChildrenLoaded, () => false)
.Map(dest => dest.Children, src => src.Items)
.MapToConstructor(true);
}
#endregion
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Mapster;
#endregion
namespace Lumina.Application.Common.Mapping.FileManagement;
/// <summary>
/// Mapping configuration for file system files between the domain object and the presentation object.
/// </summary>
public class FileMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
/// <param name="config">The type adapter configuration.</param>
public void Register(TypeAdapterConfig config)
{
config.NewConfig<File, FileSystemTreeNodeResponse>()
.Map(dest => dest.Name, src => src.Name)
.Map(dest => dest.Path, src => src.Id.Path)
.Map(dest => dest.ItemType, src => src.Type)
.Map(dest => dest.IsExpanded, () => false)
.Map(dest => dest.ChildrenLoaded, () => false)
.MapToConstructor(true);
}
#endregion
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.FileSystem;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Mapster;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Common.Mapping.FileManagement;
/// <summary>
/// Mapping configuration for file system trees between the domain object and the presentation object.
/// </summary>
public class FileSystemTreeMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
/// <param name="config">The type adapter configuration.</param>
public void Register(TypeAdapterConfig config)
{
config.NewConfig<WindowsRootItem, FileSystemTreeNodeResponse>()
.Map(dest => dest.Path, src => src.Id.Path)
.Map(dest => dest.Name, src => src.Name)
.Map(dest => dest.ItemType, src => FileSystemItemType.Root)
.Map(dest => dest.IsExpanded, () => false);
config.NewConfig<FileSystemTreeNodeResponse, WindowsRootItem>()
.MapWith(src => WindowsRootItem.Create(
src.Path,
src.Name,
FileSystemItemStatus.Accessible)
.Value);
config.NewConfig<UnixRootItem, FileSystemTreeNodeResponse>()
.Map(dest => dest.Path, src => src.Id.Path)
.Map(dest => dest.Name, src => src.Name)
.Map(dest => dest.ItemType, src => FileSystemItemType.Root)
.Map(dest => dest.IsExpanded, () => false);
config.NewConfig<FileSystemTreeNodeResponse, UnixRootItem>()
.MapWith(src => UnixRootItem.Create(
FileSystemItemStatus.Accessible)
.Value);
config.NewConfig<FileSystemItem, FileSystemTreeNodeResponse>()
.MapWith(src => new FileSystemTreeNodeResponse
{
Path = src.Id.Path,
Name = src.Name,
ItemType = src.Type,
IsExpanded = false,
ChildrenLoaded = false,
Children = new List<FileSystemTreeNodeResponse>()
});
}
#endregion
}
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
using Mapster;
#endregion
namespace Lumina.Application.Common.Mapping.FileManagement;
/// <summary>
/// Mapping configuration for file system paths between the domain object and the presentation object.
/// </summary>
public class PathSegmentMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
/// <param name="config">The type adapter configuration.</param>
public void Register(TypeAdapterConfig config)
{
config.NewConfig<PathSegment, PathSegmentResponse>()
.Map(dest => dest.Path, src => src.Name)
.MapToConstructor(true);
}
#endregion
}
@@ -1,6 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Books;
using Lumina.Domain.Common.Enums;
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Common.ValueObjects.Metadata;
using Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggregate.ValueObjects;
@@ -8,6 +8,9 @@ using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.Entities;
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary;
@@ -24,7 +27,7 @@ public class BookMappingConfig : IRegister
/// <param name="config">The type adapter configuration.</param>
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Book, BookDto>()
config.NewConfig<Book, BookModel>()
.Map(dest => dest.Id, src => src.Id.Value)
.Map(dest => dest.Title, src => src.Metadata.Title)
.Map(dest => dest.OriginalTitle, src => src.Metadata.OriginalTitle.HasValue ? src.Metadata.OriginalTitle.Value : default)
@@ -62,7 +65,7 @@ public class BookMappingConfig : IRegister
.Map(dest => dest.Created, src => src.Created)
.Map(dest => dest.Updated, src => src.Updated.HasValue ? src.Updated : null);
config.NewConfig<BookRating, BookRatingDto>()
config.NewConfig<BookRating, BookRatingModel>()
.Map(dest => dest.Value, src => src.Value)
.Map(dest => dest.MaxValue, src => src.MaxValue)
.Map(dest => dest.VoteCount, src => src.VoteCount.HasValue ? src.VoteCount.Value : default)
@@ -71,8 +74,8 @@ public class BookMappingConfig : IRegister
config.NewConfig<Optional<BookRatingSource>, BookRatingSource?>()
.MapWith(src => src.HasValue ? src.Value : default);
// from BookDto to Book
config.NewConfig<BookDto, Book>()
// from BookModel to Book
config.NewConfig<BookModel, Book>()
.MapWith(src => Book.Create(
BookId.Create(src.Id),
WrittenContentMetadata.Create(
@@ -1,16 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Lumina.Domain.Common.Enums;
#endregion
namespace Lumina.Application.Common.Models.Books;
/// <summary>
/// Represents a book rating.
/// </summary>
public record BookRatingDto(
decimal? Value,
decimal? MaxValue,
BookRatingSource? Source,
int? VoteCount
) : RatingDto(Value, MaxValue, VoteCount);
@@ -1,8 +0,0 @@
namespace Lumina.Application.Common.Models.Books;
/// <summary>
/// Represents a request to get book series information.
/// </summary>
public record BookSeriesDto(
string? Title
);
@@ -1,13 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Enums;
#endregion
namespace Lumina.Application.Common.Models.Books;
/// <summary>
/// Represents a request to get ISBN information.
/// </summary>
public record IsbnDto(
string? Value,
IsbnFormat? Format
);
@@ -1,21 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
#endregion
namespace Lumina.Application.Common.Models.Books;
/// <summary>
/// Represents written content metadata.
/// </summary>
public record WrittenContentMetadataDto(
string? Title,
string? OriginalTitle,
string? Description,
ReleaseInfoDto? ReleaseInfo,
List<GenreDto>? Genres,
List<TagDto>? Tags,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
string? Publisher,
int? PageCount
);
@@ -1,8 +0,0 @@
namespace Lumina.Application.Common.Models.Common;
/// <summary>
/// Represents a request to get genre information.
/// </summary>
public record GenreDto(
string? Name
);
@@ -1,10 +0,0 @@
namespace Lumina.Application.Common.Models.Common;
/// <summary>
/// Represents a request to get language information.
/// </summary>
public record LanguageInfoDto(
string? LanguageCode,
string? LanguageName,
string? NativeName
);
@@ -1,10 +0,0 @@
namespace Lumina.Application.Common.Models.Common;
/// <summary>
/// Represents a rating.
/// </summary>
public abstract record RatingDto(
decimal? Value,
decimal? MaxValue,
int? VoteCount
);
@@ -1,13 +0,0 @@
namespace Lumina.Application.Common.Models.Common;
/// <summary>
/// Represents a request to get release information.
/// </summary>
public record ReleaseInfoDto(
DateOnly? OriginalReleaseDate,
int? OriginalReleaseYear,
DateOnly? ReReleaseDate,
int? ReReleaseYear,
string? ReleaseCountry,
string? ReleaseVersion
);
@@ -1,8 +0,0 @@
namespace Lumina.Application.Common.Models.Common;
/// <summary>
/// Represents a request to get tag information.
/// </summary>
public record TagDto(
string? Name
);
@@ -1,9 +0,0 @@
namespace Lumina.Application.Common.Models.Contributors;
/// <summary>
/// Represents a media contributor.
/// </summary>
public record MediaContributorDto(
MediaContributorNameDto? Name,
MediaContributorRoleDto? Role
);
@@ -1,9 +0,0 @@
namespace Lumina.Application.Common.Models.Contributors;
/// <summary>
/// Represents a media contributor name.
/// </summary>
public record MediaContributorNameDto(
string? DisplayName,
string? LegalName
);
@@ -1,9 +0,0 @@
namespace Lumina.Application.Common.Models.Contributors;
/// <summary>
/// Represents a media contributor role.
/// </summary>
public record MediaContributorRoleDto(
string? Name,
string? Category
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// 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>
public record GetDirectoriesQuery(string Path) : IRequest<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>;
@@ -0,0 +1,51 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Mapster;
using MapsterMapper;
using Mediator;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// Handler for the query to get all directories.
/// </summary>
public class GetDirectoriesQueryHandler : IRequestHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDirectoryService _directoryService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryHandler"/> class.
/// </summary>
/// <param name="directoryService">Injected service for handling directories.</param>
public GetDirectoriesQueryHandler(IDirectoryService directoryService)
{
_directoryService = directoryService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of directories at the specified path.
/// </summary>
/// <param name="request">The query containing the requested path.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="FileSystemTreeNodeResponse"/>, or an error message.
/// </returns>
public ValueTask<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> Handle(GetDirectoriesQuery request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<Directory>> result = _directoryService.GetSubdirectories(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<IEnumerable<FileSystemTreeNodeResponse>>()), errors => errors));
}
#endregion
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Errors;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// Validates the needed validation rules for <see cref="GetDirectoriesQuery"/>.
/// </summary>
public class GetDirectoriesQueryValidator : AbstractValidator<GetDirectoriesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryValidator"/> class.
/// </summary>
public GetDirectoriesQueryValidator()
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// Query for retrieving the tree of directories of a path.
/// </summary>
/// <param name="Path">The path for which to retrieve the tree of directories.</param>
public record GetDirectoryTreeQuery(string Path) : IRequest<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>;
@@ -0,0 +1,179 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Enums.FileSystem;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
using Mapster;
using Mediator;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// Handler for the query to get a directory tree.
/// </summary>
public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDirectoryService _directoryService;
private readonly IFileService _fileService;
private readonly IPathService _pathService;
private readonly IDriveService _driveService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoryTreeQueryHandler"/> class.
/// </summary>
/// <param name="driveService">Injected service for handling file system drives.</param>
/// <param name="directoryService">Injected service for handling directories.</param>
/// <param name="fileService">Injected service for handling files.</param>
/// <param name="pathService">Injected service for handling file system paths.</param>
public GetDirectoryTreeQueryHandler(IDriveService driveService, IDirectoryService directoryService, IFileService fileService, IPathService pathService)
{
_directoryService = directoryService;
_fileService = fileService;
_pathService = pathService;
_driveService = driveService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the tree of expanded directories leading up to the requested path, with the additional list of drives, and children of the last child directory.
/// </summary>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="FileSystemTreeNodeResponse"/>, or an error message.
/// </returns>
public async ValueTask<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> Handle(GetDirectoryTreeQuery request, CancellationToken cancellationToken)
{
List<FileSystemTreeNodeResponse> result = [];
// retrieve the list of drives
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> getDrivesResult = GetDrives();
if (getDrivesResult.IsError)
return getDrivesResult.Errors;
result.AddRange(getDrivesResult.Value);
ErrorOr<IEnumerable<PathSegment>> pathPartsResults = _pathService.ParsePath(request.Path);
if (pathPartsResults.IsError)
return pathPartsResults.Errors;
List<PathSegment> pathParts = pathPartsResults.Value.ToList();
string currentPath = pathParts[0].Name;
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> buildDirectoryTreeResult = BuildDirectoryTree(result, pathParts, out FileSystemTreeNodeResponse currentNode);
if (buildDirectoryTreeResult.IsError)
return buildDirectoryTreeResult.Errors;
// add subdirectories of the last directory node
ErrorOr<Success> loadChildrenResult = LoadChildren(currentNode);
if (loadChildrenResult.IsError)
return loadChildrenResult.Errors;
return await ValueTask.FromResult(result);
}
/// <summary>
/// Gets the root drives (on Windows), or an empty list on Unix-based systems.
/// </summary>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing a list of <see cref="FileSystemTreeNodeResponse"/>, or an error message.
/// </returns>
private ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> GetDrives()
{
ErrorOr<IEnumerable<FileSystemItem>> driveResult = _driveService.GetDrives();
if (driveResult.IsError)
return driveResult.Errors;
return ErrorOrFactory.From(driveResult.Value.Adapt<IEnumerable<FileSystemTreeNodeResponse>>());
}
/// <summary>
/// Builds the tree of directories based on the parsed path parts.
/// </summary>
/// <param name="drives">The list of available drives.</param>
/// <param name="pathParts">The list of parsed path segments (directories).</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing a list of <see cref="FileSystemTreeNodeResponse"/> representing the directory tree, or an error message.
/// </returns>
private ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> BuildDirectoryTree(List<FileSystemTreeNodeResponse> drives, List<PathSegment> pathParts, out FileSystemTreeNodeResponse currentNode)
{
// find the root drive that matches the first part of the path
FileSystemTreeNodeResponse drive = drives.First(d => d.Name.Contains(pathParts[0].Name));
drive.IsExpanded = true;
currentNode = drive;
string currentPath = pathParts[0].Name;
// traverse the remaining path parts to build the tree structure
for (int i = 1; i < pathParts.Count; i++)
{
ErrorOr<string> combinedPathResult = _pathService.CombinePath(currentPath, pathParts[i].Name);
if (combinedPathResult.IsError)
return combinedPathResult.Errors;
currentPath = combinedPathResult.Value;
// create a new node for the directory and add it as a child of the current node
FileSystemTreeNodeResponse newNode = new FileSystemTreeNodeResponse
{
Path = currentPath,
Name = pathParts[i].Name,
ItemType = FileSystemItemType.Directory,
IsExpanded = true
};
currentNode.Children.Add(newNode);
currentNode = newNode; // move to the new node
}
return new List<FileSystemTreeNodeResponse> { drive };
}
/// <summary>
/// Loads the child directories and files of the specified directory node.
/// </summary>
/// <param name="node">The directory node to load children for.</param>
/// <returns>A result indicating a successful operation, or an error message.</returns>
private ErrorOr<Success> LoadChildren(FileSystemTreeNodeResponse node)
{
// get subdirectories under the current node's path
ErrorOr<IEnumerable<Directory>> subDirectoriesResult = _directoryService.GetSubdirectories(node.Path);
if (subDirectoriesResult.IsError)
return subDirectoriesResult.Errors;
// add each subdirectory as a child node of the current directory
foreach (Directory subDirectory in subDirectoriesResult.Value)
{
FileSystemTreeNodeResponse subDirNode = new FileSystemTreeNodeResponse
{
Name = subDirectory.Name,
Path = subDirectory.Id.Path,
ItemType = FileSystemItemType.Directory,
IsExpanded = false,
ChildrenLoaded = false
};
node.Children.Add(subDirNode);
}
// get files under the current node's path
ErrorOr<IEnumerable<File>> filesResult = _fileService.GetFiles(node.Path);
if (filesResult.IsError)
return filesResult.Errors;
// add each file as a child node of the current directory
foreach (File file in filesResult.Value)
{
FileSystemTreeNodeResponse fileNode = new FileSystemTreeNodeResponse
{
Name = file.Name,
Path = file.Id.Path,
ItemType = FileSystemItemType.File,
IsExpanded = false,
ChildrenLoaded = true
};
node.Children.Add(fileNode);
}
node.ChildrenLoaded = true;
return Result.Success;
}
#endregion
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Errors;
#endregion
namespace Lumina.Application.Core.FileManagement.Directories.Queries;
/// <summary>
/// Validates the needed validation rules for <see cref="GetDirectoryTreeQuery"/>.
/// </summary>
public class GetDirectoryTreeQueryValidator : AbstractValidator<GetDirectoryTreeQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoryTreeQueryValidator"/> class.
/// </summary>
public GetDirectoryTreeQueryValidator()
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -0,0 +1,13 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.FileManagement.Drives.Queries;
/// <summary>
/// Query for retrieving the list of drives.
/// </summary>
public record GetDrivesQuery() : IRequest<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>;
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Mapster;
using Mediator;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Drives.Queries;
/// <summary>
/// Handler for the query to get all drives.
/// </summary>
public class GetDrivesQueryHandler : IRequestHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDriveService _driveService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDrivesQueryHandler"/> class.
/// </summary>
/// <param name="driveService">Injected service for handling file system drives.</param>
public GetDrivesQueryHandler(IDriveService driveService)
{
_driveService = driveService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of file system drives.
/// </summary>
/// <param name="request">The query containing the requested path.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="FileSystemTreeNodeResponse"/>, or an error message.
/// </returns>
public ValueTask<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> Handle(GetDrivesQuery request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<FileSystemItem>> result = _driveService.GetDrives();
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(values.Adapt<IEnumerable<FileSystemTreeNodeResponse>>()), errors => errors));
}
#endregion
}
@@ -0,0 +1,11 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
#endregion
namespace Lumina.Application.Core.FileManagement.FileSystem.Queries;
/// <summary>
/// Query for retrieving the file system type.
/// </summary>
public record GetFileSystemQuery() : IRequest<FileSystemTypeResponse>;
@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
using Mediator;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.FileSystem.Queries;
/// <summary>
/// Handler for the query to get the file system type.
/// </summary>
public class GetFileSystemQueryHandler : IRequestHandler<GetFileSystemQuery, FileSystemTypeResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContext _platformContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFileSystemQueryHandler"/> class.
/// </summary>
/// <param name="platformContextManager">Injected service for managing platform contexts.</param>
public GetFileSystemQueryHandler(IPlatformContextManager platformContextManager)
{
_platformContext = platformContextManager.GetCurrentContext();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the type of the file system.
/// </summary>
/// <param name="request">The query to be handled.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The type of the file system.</returns>
public ValueTask<FileSystemTypeResponse> Handle(GetFileSystemQuery request, CancellationToken cancellationToken)
{
return ValueTask.FromResult(new FileSystemTypeResponse(_platformContext.Platform));
}
#endregion
}
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.FileManagement.Files.Queries;
/// <summary>
/// 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>
public record GetFilesQuery(string Path) : IRequest<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>;
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Mapster;
using Mediator;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Files.Queries;
/// <summary>
/// Handler for the query to get all files.
/// </summary>
public class GetFilesQueryHandler : IRequestHandler<GetFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileService _fileService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryHandler"/> class.
/// </summary>
/// <param name="fileService">Injected service for handling files.</param>
public GetFilesQueryHandler(IFileService fileService)
{
_fileService = fileService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of files at the specified path.
/// </summary>
/// <param name="request">The query containing the requested path.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="FileSystemTreeNodeResponse"/>, or an error message.
/// </returns>
public ValueTask<ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>> Handle(GetFilesQuery request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<File>> result = _fileService.GetFiles(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<IEnumerable<FileSystemTreeNodeResponse>>()), errors => errors));
}
#endregion
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Errors;
#endregion
namespace Lumina.Application.Core.FileManagement.Files.Queries;
/// <summary>
/// Validates the needed validation rules for <see cref="GetFilesQuery"/>.
/// </summary>
public class GetFilesQueryValidator : AbstractValidator<GetFilesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryValidator"/> class.
/// </summary>
public GetFilesQueryValidator()
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Command for combining two file system path.
/// </summary>
/// <param name="OriginalPath">The path to combine to.</param>
/// <param name="NewPath">The path to combine with.</param>
public record CombinePathCommand(
string OriginalPath, string NewPath
) : IRequest<ErrorOr<PathSegmentResponse>>;
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Mapster;
using Mediator;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Handler for the command to split a file system path.
/// </summary>
public class CombinePathCommandHandler : IRequestHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandHandler"/> class.
/// </summary>
/// <param name="pathService">Injected service for handling file system paths.</param>
public CombinePathCommandHandler(IPathService pathService)
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Combines two file system paths.
/// </summary>
/// <param name="request">The command containing the requested paths.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a <see cref="PathSegmentResponse"/>, or an error message.
/// </returns>
public ValueTask<ErrorOr<PathSegmentResponse>> Handle(CombinePathCommand request, CancellationToken cancellationToken)
{
ErrorOr<string> result = _pathService.CombinePath(request.OriginalPath, request.NewPath);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(new PathSegmentResponse(result.Value)), errors => errors));
}
#endregion
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Errors;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Validates the needed validation rules for <see cref="CombinePathCommand"/>.
/// </summary>
public class CombinePathCommandValidator : AbstractValidator<CombinePathCommand>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CombinePathCommandValidator"/> class.
/// </summary>
public CombinePathCommandValidator()
{
RuleFor(x => x.OriginalPath).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
RuleFor(x => x.NewPath).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Command for splitting a file system path.
/// </summary>
/// <param name="Path">The path to split.</param>
public record SplitPathCommand(
string Path
) : IRequest<ErrorOr<IEnumerable<PathSegmentResponse>>>;
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
using Mapster;
using Mediator;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Handler for the command to split a file system path.
/// </summary>
public class SplitPathCommandHandler : IRequestHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandHandler"/> class.
/// </summary>
/// <param name="pathService">Injected service for handling file system paths.</param>
public SplitPathCommandHandler(IPathService pathService)
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the path components of the specified path.
/// </summary>
/// <param name="request">The command containing the requested path.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="PathSegmentResponse"/>, or an error message.
/// </returns>
public ValueTask<ErrorOr<IEnumerable<PathSegmentResponse>>> Handle(SplitPathCommand request, CancellationToken cancellationToken)
{
ErrorOr<IEnumerable<PathSegment>> result = _pathService.ParsePath(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<IEnumerable<PathSegmentResponse>>()), errors => errors));
}
#endregion
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Errors;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Commands;
/// <summary>
/// Validates the needed validation rules for <see cref="SplitPathCommand"/>.
/// </summary>
public class SplitPathCommandValidator : AbstractValidator<SplitPathCommand>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandValidator"/> class.
/// </summary>
public SplitPathCommandValidator()
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -0,0 +1,13 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
/// <summary>
/// Query for retrieving the root of a path.
/// </summary>
/// <param name="Path">The path for which to get the path root.</param>
public record GetPathRootQuery(string Path) : IRequest<ErrorOr<PathSegmentResponse>>;
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
using Mapster;
using Mediator;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
/// <summary>
/// Handler for the query to get the root of a file system path.
/// </summary>
public class GetPathRootQueryHandler : IRequestHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootQueryHandler"/> class.
/// </summary>
/// <param name="pathService">Injected service for managing file system paths.</param>
public GetPathRootQueryHandler(IPathService pathService)
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the root of the specified file system path.
/// </summary>
/// <param name="request">The query containing the requested path.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The root of the specified path.</returns>
public ValueTask<ErrorOr<PathSegmentResponse>> Handle(GetPathRootQuery request, CancellationToken cancellationToken)
{
ErrorOr<PathSegment> result = _pathService.GetPathRoot(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<PathSegmentResponse>()), errors => errors));
}
#endregion
}
@@ -0,0 +1,11 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Mediator;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
/// <summary>
/// Query for retrieving the file system path separator.
/// </summary>
public record GetPathSeparatorQuery() : IRequest<PathSeparatorResponse>;
@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileManagement;
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
using Mediator;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
/// <summary>
/// Handler for the query to get the path separator character of a file system path.
/// </summary>
public class GetPathSeparatorQueryHandler : IRequestHandler<GetPathSeparatorQuery, PathSeparatorResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathSeparatorQueryHandler"/> class.
/// </summary>
/// <param name="pathService">Injected service for managing file system paths.</param>
public GetPathSeparatorQueryHandler(IPathService pathService)
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the path separator character of a file system path.
/// </summary>
/// <param name="request">The query containing the request.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>The file system path separator character.</returns>
public ValueTask<PathSeparatorResponse> Handle(GetPathSeparatorQuery request, CancellationToken cancellationToken)
{
return ValueTask.FromResult(new PathSeparatorResponse(_pathService.PathSeparator.ToString()));
}
#endregion
}
@@ -1,10 +1,12 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.Models.Books;
using Lumina.Application.Common.Models.Contributors;
using Lumina.Domain.Common.Enums;
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Contracts.Models.MediaContributors;
using Lumina.Contracts.Models.WrittenContentLibrary;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands;
@@ -12,12 +14,29 @@ namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Comma
/// <summary>
/// Command for adding a book.
/// </summary>
/// <param name="Metadata">Written content metadata of the book.</param>
/// <param name="Format">The format of the book (e.g., Hardcover, Paperback), if applicable.</param>
/// <param name="Edition">The edition of the book, if applicable.</param>
/// <param name="VolumeNumber">The volume or book number in the series, if applicable.</param>
/// <param name="Series">The series name, if the book is part of a series.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the book, if applicable.</param>
/// <param name="GoodreadsId">The Goodreads ID of the book, if applicable.</param>
/// <param name="LCCN">The Library of Congress Control Number (LCCN) of the book, if applicable.</param>
/// <param name="OCLCNumber">The OCLC Number (WorldCat identifier) of the book, if applicable.</param>
/// <param name="OpenLibraryId">The Open Library ID of the book, if applicable.</param>
/// <param name="LibraryThingId">The LibraryThing ID of the book, if applicable.</param>
/// <param name="GoogleBooksId">The Google Books ID of the book, if applicable.</param>
/// <param name="BarnesAndNobleId">The Barnes & Noble ID of the book, if applicable.</param>
/// <param name="AppleBooksId">The Apple Books ID of the book, if applicable.</param>
/// <param name="ISBNs">The list of ISBN (International Standard Book Number) of the book.</param>
/// <param name="Contributors">The list of media contributors (actors, directors, etc) starring in this book.</param>
/// <param name="Ratings">The list of ratings for this book.</param>
public record AddBookCommand(
WrittenContentMetadataDto Metadata,
WrittenContentMetadataModel Metadata,
BookFormat? Format,
string? Edition,
int? VolumeNumber,
BookSeriesDto? Series,
BookSeriesModel? Series,
string? ASIN,
string? GoodreadsId,
string? LCCN,
@@ -27,7 +46,7 @@ public record AddBookCommand(
string? GoogleBooksId,
string? BarnesAndNobleId,
string? AppleBooksId,
List<IsbnDto> ISBNs,
List<MediaContributorDto> Contributors,
List<BookRatingDto> Ratings
List<IsbnModel> ISBNs,
List<MediaContributorModel> Contributors,
List<BookRatingModel> Ratings
) : IRequest<ErrorOr<Book>>;
@@ -2,8 +2,8 @@
using ErrorOr;
using Lumina.Application.Common.DataAccess.Repositories.Books;
using Lumina.Application.Common.DataAccess.UoW;
using Lumina.Application.Common.Models.Books;
using Lumina.Domain.Common.Enums;
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Common.ValueObjects.Metadata;
using Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggregate.ValueObjects;
@@ -12,6 +12,11 @@ using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.E
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
using MapsterMapper;
using Mediator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands;
@@ -46,7 +51,7 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
/// <param name="request">The request to be handled.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{T}"/> containing either a successfully created <see cref="Book"/>, or an error message.
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="Book"/>, or an error message.
/// </returns>
public async ValueTask<ErrorOr<Book>> Handle(AddBookCommand request, CancellationToken cancellationToken)
{
@@ -162,11 +167,11 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
return createBookResult.Errors;
var bookRepository = _unitOfWork.GetRepository<IBookRepository>();
var persistenceBook = _mapper.Map<BookDto>(createBookResult.Value);
var insertBookResult = await bookRepository.InsertAsync(persistenceBook, cancellationToken);
var persistenceBook = _mapper.Map<BookModel>(createBookResult.Value);
var insertBookResult = await bookRepository.InsertAsync(persistenceBook, cancellationToken).ConfigureAwait(false);
if (insertBookResult.IsError)
return insertBookResult.Errors;
await _unitOfWork.SaveChangesAsync(cancellationToken);
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
return createBookResult.Value;
}
@@ -1,8 +1,7 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Domain.Common.Enums;
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Domain.Common.Errors;
using System.Text.RegularExpressions;
#endregion
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands;
@@ -2,6 +2,7 @@
using ErrorOr;
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
using Mediator;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queries;
@@ -3,8 +3,11 @@ using ErrorOr;
using Lumina.Application.Common.DataAccess.Repositories.Books;
using Lumina.Application.Common.DataAccess.UoW;
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
using MapsterMapper;
using Mapster;
using Mediator;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queries;
@@ -16,7 +19,6 @@ public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnum
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
@@ -24,11 +26,9 @@ public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnum
/// Initializes a new instance of the <see cref="GetBooksQueryHandler"/> class.
/// </summary>
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
/// <param name="mapper">Injected service for mapping objects.</param>
public GetBooksQueryHandler(IUnitOfWork unitOfWork, IMapper mapper)
public GetBooksQueryHandler(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
_mapper = mapper;
}
#endregion
@@ -39,15 +39,13 @@ public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnum
/// <param name="request">The request to be handled.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{T}"/> containing either a collection of <see cref="Book"/>, or an error message.
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="Book"/>, or an error message.
/// </returns>
public async ValueTask<ErrorOr<IEnumerable<Book>>> Handle(GetBooksQuery request, CancellationToken cancellationToken)
{
var bookRepository = _unitOfWork.GetRepository<IBookRepository>();
var getBooksResult = await bookRepository.GetAllAsync(cancellationToken).ConfigureAwait(false);
if (getBooksResult.IsError)
return getBooksResult.Errors;
return ErrorOrFactory.From(getBooksResult.Value.Select(book => _mapper.Map<Book>(book)));
return getBooksResult.Match(values => ErrorOrFactory.From(values.Adapt<IEnumerable<Book>>()), errors => errors);
}
#endregion
}
}
@@ -2,9 +2,9 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\bin\</BaseOutputPath>
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
@@ -13,6 +13,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lumina.Contracts\Lumina.Contracts.csproj" />
<ProjectReference Include="..\Lumina.Contracts\Lumina.Contracts.csproj" />
<ProjectReference Include="..\Lumina.Domain\Lumina.Domain.csproj" />
</ItemGroup>
@@ -0,0 +1,57 @@
namespace Lumina.Contracts.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the types of audio content libraries.
/// </summary>
public enum AudioContentType
{
/// <summary>
/// A musical composition typically consisting of vocals and/or instruments.
/// </summary>
Music,
/// <summary>
/// A recording of a book or other written work being read aloud.
/// </summary>
AudioBook,
/// <summary>
/// An audio recording of a live musical or spoken word performance.
/// </summary>
LivePerformance,
/// <summary>
/// A recorded conversation where one person asks questions and another provides answers.
/// </summary>
Interview,
/// <summary>
/// A new performance or recording of a previously released song.
/// </summary>
Cover,
/// <summary>
/// An alternative version of a recorded song, typically with altered instrumentation or structure.
/// </summary>
Remix,
/// <summary>
/// An audio recording used to create a specific acoustic environment or impression.
/// </summary>
Soundeffect,
/// <summary>
/// A digital audio file made available on the internet for downloading to a computer or mobile device.
/// </summary>
Podcast,
/// <summary>
/// A regularly scheduled broadcast program consisting of music, talk, or other audio content.
/// </summary>
RadioShow,
/// <summary>
/// A collection of music used as background sound for a movie, TV show, video game, or other media.
/// </summary>
Soundtrack,
}
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the various sources of audio ratings.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.BookLibrary;
/// <summary>
/// Enumeration for various book formats.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.BookLibrary;
/// <summary>
/// Enumeration for the various sources of book ratings.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.BookLibrary;
/// <summary>
/// Enumeration for the different ISBN (International Standard Book Number) formats.
@@ -0,0 +1,62 @@
namespace Lumina.Contracts.Enums.BookLibrary;
/// <summary>
/// Enumeration for the types of written content libraries.
/// </summary>
public enum WrittenContentType
{
/// <summary>
/// A printed or written literary work.
/// </summary>
Book,
/// <summary>
/// An electronic version of a printed book.
/// </summary>
EBook,
/// <summary>
/// A set of related books published in succession.
/// </summary>
BookSeries,
/// <summary>
/// A magazine or book containing sequential art in the form of a narrative.
/// </summary>
ComicBook,
/// <summary>
/// A set of related comic books published in succession.
/// </summary>
ComicSeries,
/// <summary>
/// A periodical publication containing articles, stories, and other content.
/// </summary>
Magazine,
/// <summary>
/// A style of Japanese comic books and graphic novels.
/// </summary>
Manga,
/// <summary>
/// A novel in comic-strip format, typically with sophisticated artwork and complex storylines.
/// </summary>
GraphicNovel,
/// <summary>
/// A scholarly article presenting original research or analysis.
/// </summary>
AcademicPaper,
/// <summary>
/// A handwritten or printed form of musical notation.
/// </summary>
SheetMusic,
/// <summary>
/// A script for a film, television program, or other visual media.
/// </summary>
Screenplay,
}
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.FileSystem;
/// <summary>
/// Enumeration for file access mode types.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.FileSystem;
/// <summary>
/// Enumeration for file system item statuses types.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.FileSystem;
/// <summary>
/// Enumeration for the types of file system elements.
@@ -6,9 +6,9 @@
public enum FileSystemItemType
{
/// <summary>
/// Represents a drive, such as a hard disk, USB drive, or network drive.
/// Represents a file system root, which can be a drive on Windows, and a path separator on Unix.
/// </summary>
Drive,
Root,
/// <summary>
/// Represents a directory, which is a directory that can contain other directories or files.
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.FileSystem;
/// <summary>
/// Enumeration for platform types.
@@ -0,0 +1,32 @@
namespace Lumina.Contracts.Enums.Library;
/// <summary>
/// Enumeration for the types of libraries.
/// </summary>
public enum LibraryType
{
/// <summary>
/// Content that is written, such as books, articles, or other written works.
/// </summary>
WrittenContent,
/// <summary>
/// Content that is video, such as movies, TV shows, or other video works.
/// </summary>
VideoContent,
/// <summary>
/// Content that is audio, such as podcasts, radio shows, or other audio works.
/// </summary>
AudioContent,
/// <summary>
/// Content that is visual, such as images, paintings, or other visual works.
/// </summary>
VisualContent,
/// <summary>
/// Content that is miscellaneous, such as lyrics, movie posters, or other miscellaneous works.
/// </summary>
MiscellaneousContent,
}
@@ -0,0 +1,12 @@
namespace Lumina.Contracts.Enums.Library;
/// <summary>
/// Enumeration for the types of miscellaneous content libraries.
/// </summary>
public enum MiscellaneousContentType
{
/// <summary>
/// A collection of media that does not fit into any other category.
/// </summary>
Other,
}
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.PhotoLibrary;
/// <summary>
/// Enumeration for known image types.
@@ -0,0 +1,12 @@
namespace Lumina.Contracts.Enums.PhotoLibrary;
/// <summary>
/// Enumeration for the types of visual content libraries.
/// </summary>
public enum VisualContentType
{
/// <summary>
/// A collection of photographs organized together.
/// </summary>
PhotoAlbum,
}
@@ -0,0 +1,62 @@
namespace Lumina.Contracts.Enums.FileSystem.VideoLibrary;
/// <summary>
/// Enumeration for the types of video content libraries.
/// </summary>
public enum VideoContentType
{
/// <summary>
/// A series of related episodes broadcast on television or streaming platforms.
/// </summary>
TvShow,
/// <summary>
/// A feature-length film produced for cinema or home viewing.
/// </summary>
Movie,
/// <summary>
/// A collection of related films released in succession.
/// </summary>
FilmSeries,
/// <summary>
/// A collection of related films, TV shows, and other media sharing a fictional universe.
/// </summary>
FilmFranchise,
/// <summary>
/// A live musical performance recorded on video.
/// </summary>
Concert,
/// <summary>
/// A non-fictional film or TV program presenting facts and information about a specific subject.
/// </summary>
Documentary,
/// <summary>
/// An instructional video designed to teach a skill or provide information on a specific topic.
/// </summary>
Tutorial,
/// <summary>
/// Privately recorded videos, often for personal use or sharing with friends and family.
/// </summary>
Personal,
/// <summary>
/// Japanese animated productions, typically characterized by colorful graphics and vibrant characters.
/// </summary>
Anime,
/// <summary>
/// Videos hosted on or originating from the YouTube platform.
/// </summary>
Youtube,
/// <summary>
/// A short video, typically set to music, such as a music video or promotional clip.
/// </summary>
Videoclip,
}
@@ -1,4 +1,4 @@
namespace Lumina.Domain.Common.Enums;
namespace Lumina.Contracts.Enums.VideoLibrary;
/// <summary>
/// Enumeration for the various sources of video ratings.
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Responses\WrittenContentLibrary\BookLibrary\" />
</ItemGroup>
</Project>
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Represents a request to get genre information.
/// </summary>
/// <param name="Name">Gets the name of the genre.</param>
[DebuggerDisplay("{Name}")]
public record GenreModel(
string? Name
);
@@ -1,7 +1,11 @@
namespace Lumina.Application.Common.Models.Common;
#region ========================================================================= USING =====================================================================================
using System;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Interface for storage DTOs, enforces Id.
/// Interface for storage models, enforces Id.
/// </summary>
public interface IStorageEntity
{
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Represents a request to get language information.
/// </summary>
/// <param name="LanguageCode">Gets the ISO code of the language (e.g., "en" for English).</param>
/// <param name="LanguageName">Gets the name of the language in English.</param>
/// <param name="NativeName">Gets the native name of the language (e.g., "Español" for Spanish).</param>
[DebuggerDisplay("{LanguageName}")]
public record LanguageInfoModel(
string? LanguageCode,
string? LanguageName,
string? NativeName
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Represents a rating.
/// </summary>
/// <param name="Value">Gets the rating value.</param>
/// <param name="MaxValue">Gets the maximum possible rating value.</param>
/// <param name="VoteCount">Gets the number of votes that contributed to the rating.</param>
[DebuggerDisplay("{Value}/{MaxValue}")]
public abstract record RatingModel(
decimal? Value,
decimal? MaxValue,
int? VoteCount
);
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Represents a request to get release information.
/// </summary>
/// <param name="OriginalReleaseDate">Gets the original release date of the content.</param>
/// <param name="OriginalReleaseYear">Gets the original release year of the content.</param>
/// <param name="ReReleaseDate">Gets the re-release date of the content, if applicable.</param>
/// <param name="ReReleaseYear">Gets the re-release year of the content, if applicable.</param>
/// <param name="ReleaseCountry">Gets the country where the content was released.</param>
/// <param name="ReleaseVersion">Gets the version or edition of the content's release.</param>
[DebuggerDisplay("{OriginalReleaseDate}")]
public record ReleaseInfoModel(
DateOnly? OriginalReleaseDate,
int? OriginalReleaseYear,
DateOnly? ReReleaseDate,
int? ReReleaseYear,
string? ReleaseCountry,
string? ReleaseVersion
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.Common;
/// <summary>
/// Represents a request to get tag information.
/// </summary>
/// <param name="Name">Gets the name of the tag.</param>
[DebuggerDisplay("{Name}")]
public record TagModel(
string? Name
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.MediaContributors;
/// <summary>
/// Represents a media contributor.
/// </summary>
/// <param name="Name">Gets the name details of the media contributor, including display and legal names.</param>
/// <param name="Role">Gets the role details of the media contributor, including the role name and category.</param>
[DebuggerDisplay("{Name} {Role}")]
public record MediaContributorModel(
MediaContributorNameModel? Name,
MediaContributorRoleModel? Role
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.MediaContributors;
/// <summary>
/// Represents a media contributor name.
/// </summary>
/// <param name="DisplayName">Gets the display name of the media contributor.</param>
/// <param name="LegalName">Gets the legal name of the media contributor.</param>
[DebuggerDisplay("{DisplayName}")]
public record MediaContributorNameModel(
string? DisplayName,
string? LegalName
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.MediaContributors;
/// <summary>
/// Represents a media contributor role.
/// </summary>
/// <param name="Name">Gets the name of the role assigned to the media contributor.</param>
/// <param name="Category">Gets the category of the role, which may describe the type or group of roles.</param>
[DebuggerDisplay("{Name} {Category}")]
public record MediaContributorRoleModel(
string? Name,
string? Category
);
@@ -1,15 +1,22 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.Models.Books;
namespace Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
/// <summary>
/// Represents a book.
/// </summary>
public class BookDto : IStorageEntity
[DebuggerDisplay("{Title}")]
public class BookModel : IStorageEntity
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the Id of the media item.
/// </summary>
public Guid Id { get; init; }
/// <summary>
@@ -91,12 +98,12 @@ public class BookDto : IStorageEntity
/// <summary>
/// Gets the list of tags associated with the media item.
/// </summary>
public HashSet<TagDto> Tags { get; set; } = [];
public HashSet<TagModel> Tags { get; set; } = [];
/// <summary>
/// Gets the list of genres associated with the media item.
/// </summary>
public HashSet<GenreDto> Genres { get; set; } = [];
public HashSet<GenreModel> Genres { get; set; } = [];
/// <summary>
/// Gets the publisher of the written content.
@@ -176,17 +183,17 @@ public class BookDto : IStorageEntity
/// <summary>
/// Gets the list of ISBN (International Standard Book Number) of the book.
/// </summary>
public List<IsbnDto> ISBNs { get; set; } = [];
public List<IsbnModel> ISBNs { get; set; } = [];
/// <summary>
/// Gets the list of media contributors (actors, directors, etc) starring in this book.
/// </summary>
//public List<ContributorIdDto> ContributorIds { get; init; } = [];
//public List<ContributorIdModel> ContributorIds { get; init; } = [];
/// <summary>
/// Gets the list of ratings for this book.
/// </summary>
public List<BookRatingDto> Ratings { get; init; } = [];
public List<BookRatingModel> Ratings { get; init; } = [];
/// <summary>
/// Gets the time and date when the entity was added.
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Contracts.Models.Common;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
/// <summary>
/// Represents a book rating.
/// </summary>
/// <param name="Value">Gets the rating value for the book.</param>
/// <param name="MaxValue">Gets the maximum possible rating value for the book.</param>
/// <param name="Source">Gets the source of the book rating (e.g., a specific website or platform).</param>
/// <param name="VoteCount">Gets the number of votes that contributed to the book rating.</param>
[DebuggerDisplay("{Value}/{MaxValue}")]
public record BookRatingModel(
decimal? Value,
decimal? MaxValue,
BookRatingSource? Source,
int? VoteCount
) : RatingModel(Value, MaxValue, VoteCount);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
/// <summary>
/// Represents a request to get book series information.
/// </summary>
/// <param name="Title">Gets the title of the book series.</param>
[DebuggerDisplay("{Title}")]
public record BookSeriesModel(
string? Title
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.BookLibrary;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
/// <summary>
/// Represents a request to get ISBN information.
/// </summary>
/// <param name="Value">Gets the ISBN value.</param>
/// <param name="Format">Gets the format of the ISBN (e.g., ISBN-10 or ISBN-13).</param>
[DebuggerDisplay("{Value} ({Format})")]
public record IsbnModel(
string? Value,
IsbnFormat? Format
);
@@ -0,0 +1,34 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Models.Common;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Models.WrittenContentLibrary;
/// <summary>
/// Represents written content metadata.
/// </summary>
/// <param name="Title">Gets the title of the written content.</param>
/// <param name="OriginalTitle">Gets the original title of the written content, if different from the current title.</param>
/// <param name="Description">Gets a brief description or summary of the written content.</param>
/// <param name="ReleaseInfo">Gets the release information, including release date and other relevant details.</param>
/// <param name="Genres">Gets the list of genres associated with the written content.</param>
/// <param name="Tags">Gets the list of tags that further describe or categorize the written content.</param>
/// <param name="Language">Gets the language in which the written content is written.</param>
/// <param name="OriginalLanguage">Gets the original language of the written content, if it has been translated.</param>
/// <param name="Publisher">Gets the name of the publisher of the written content.</param>
/// <param name="PageCount">Gets the number of pages in the written content.</param>
[DebuggerDisplay("{Title}")]
public record WrittenContentMetadataModel(
string? Title,
string? OriginalTitle,
string? Description,
ReleaseInfoModel? ReleaseInfo,
List<GenreModel>? Genres,
List<TagModel>? Tags,
LanguageInfoModel? Language,
LanguageInfoModel? OriginalLanguage,
string? Publisher,
int? PageCount
);
@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Contracts.Models.MediaContributors;
using Lumina.Contracts.Models.WrittenContentLibrary;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
using System.Collections.Generic;
#endregion
namespace Lumina.Contracts.Requests.WrittenContentLibrary.BookLibrary;
/// <summary>
/// Represents a request to add a book.
/// </summary>
/// <param name="Metadata">Written content metadata of the book.</param>
/// <param name="Format">The format of the book (e.g., Hardcover, Paperback), if applicable.</param>
/// <param name="Edition">The edition of the book, if applicable.</param>
/// <param name="VolumeNumber">The volume or book number in the series, if applicable.</param>
/// <param name="Series">The series name, if the book is part of a series.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the book, if applicable.</param>
/// <param name="GoodreadsId">The Goodreads ID of the book, if applicable.</param>
/// <param name="LCCN">The Library of Congress Control Number (LCCN) of the book, if applicable.</param>
/// <param name="OCLCNumber">The OCLC Number (WorldCat identifier) of the book, if applicable.</param>
/// <param name="OpenLibraryId">The Open Library ID of the book, if applicable.</param>
/// <param name="LibraryThingId">The LibraryThing ID of the book, if applicable.</param>
/// <param name="GoogleBooksId">The Google Books ID of the book, if applicable.</param>
/// <param name="BarnesAndNobleId">The Barnes & Noble ID of the book, if applicable.</param>
/// <param name="AppleBooksId">The Apple Books ID of the book, if applicable.</param>
/// <param name="ISBNs">The list of ISBN (International Standard Book Number) of the book.</param>
/// <param name="Contributors">The list of media contributors (actors, directors, etc) starring in this book.</param>
/// <param name="Ratings">The list of ratings for this book.</param>
public record AddBookRequest(
WrittenContentMetadataModel? Metadata,
BookFormat? Format,
string? Edition,
int? VolumeNumber,
BookSeriesModel? Series,
string? ASIN,
string? GoodreadsId,
string? LCCN,
string? OCLCNumber,
string? OpenLibraryId,
string? LibraryThingId,
string? GoogleBooksId,
string? BarnesAndNobleId,
string? AppleBooksId,
List<IsbnModel>? ISBNs,
List<MediaContributorModel>? Contributors,
List<BookRatingModel>? Ratings
);
@@ -0,0 +1,46 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.FileSystem;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.FileManagement;
/// <summary>
/// Generic file system node.
/// </summary>
[DebuggerDisplay("{Path}")]
public class FileSystemTreeNodeResponse
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the full path of the file or directory.
/// </summary>
public string Path { get; set; } = null!;
/// <summary>
/// Gets or sets the name of the file or directory.
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// Gets or sets the type of the item, indicating whether it is a file, directory, or drive.
/// </summary>
public FileSystemItemType ItemType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the node is expanded.
/// </summary>
public bool IsExpanded { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the child nodes have been loaded.
/// </summary>
public bool ChildrenLoaded { get; set; }
/// <summary>
/// Gets or sets the list of child nodes.
/// </summary>
public List<FileSystemTreeNodeResponse> Children { get; set; } = [];
#endregion
}
@@ -0,0 +1,13 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.FileSystem;
#endregion
namespace Lumina.Contracts.Responses.FileManagement;
/// <summary>
/// Represents a response containing the file system platform type.
/// </summary>
/// <param name="PlatformType">The returned file system platform type.</param>
public record FileSystemTypeResponse(
PlatformType PlatformType
);
@@ -0,0 +1,9 @@
namespace Lumina.Contracts.Responses.FileManagement;
/// <summary>
/// Represents a response containing a file system path.
/// </summary>
/// <param name="Path">The returned path.</param>
public record PathSegmentResponse(
string Path
);
@@ -0,0 +1,9 @@
namespace Lumina.Contracts.Responses.FileManagement;
/// <summary>
/// Represents a response to the inquiry about the system's path separator.
/// </summary>
/// <param name="Separator">The system's path separator.</param>
public record PathSeparatorResponse(
string Separator
);
@@ -0,0 +1,9 @@
namespace Lumina.Contracts.Responses.FileManagement;
/// <summary>
/// Represents a response containing the result of splitting a file system path.
/// </summary>
/// <param name="PathSegments">The returned path segments.</param>
public record SplitPathResponse(
string[] PathSegments
);
@@ -1,23 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Books;
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.Collections.Generic;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="BookDto"/> entity.
/// Configures the entity mapping for the <see cref="BookModel"/> entity.
/// </summary>
public class BookConfiguration : IEntityTypeConfiguration<BookDto>
public class BookConfiguration : IEntityTypeConfiguration<BookModel>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the <see cref="BookDto"/> entity.
/// Configures the <see cref="BookModel"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<BookDto> builder)
public void Configure(EntityTypeBuilder<BookModel> builder)
{
builder.ToTable("Books");
builder.HasKey(book => book.Id);
@@ -46,8 +47,8 @@ public class BookConfiguration : IEntityTypeConfiguration<BookDto>
.WithMany()
.UsingEntity<Dictionary<string, object>>(
"BookTags",
j => j.HasOne<TagDto>().WithMany().HasForeignKey("TagId"),
j => j.HasOne<BookDto>().WithMany().HasForeignKey("BookId"),
j => j.HasOne<TagModel>().WithMany().HasForeignKey("TagId"),
j => j.HasOne<BookModel>().WithMany().HasForeignKey("BookId"),
j =>
{
j.HasKey("BookId", "TagId");
@@ -58,8 +59,8 @@ public class BookConfiguration : IEntityTypeConfiguration<BookDto>
.WithMany()
.UsingEntity<Dictionary<string, object>>(
"BookGenres",
j => j.HasOne<GenreDto>().WithMany().HasForeignKey("GenreId"),
j => j.HasOne<BookDto>().WithMany().HasForeignKey("BookId"),
j => j.HasOne<GenreModel>().WithMany().HasForeignKey("GenreId"),
j => j.HasOne<BookModel>().WithMany().HasForeignKey("BookId"),
j =>
{
j.HasKey("BookId", "GenreId");
@@ -83,12 +84,12 @@ public class BookConfiguration : IEntityTypeConfiguration<BookDto>
builder.Property(book => book.Created).HasColumnOrder(30);
builder.Property(book => book.Updated).HasColumnOrder(31);
//builder.HasMany<ContributorIdDto>()
//builder.HasMany<ContributorIdModel>()
//.WithMany()
//.UsingEntity<Dictionary<string, object>>(
// "BookContributors",
// j => j.HasOne<ContributorIdDto>().WithMany().HasForeignKey("ContributorId"),
// j => j.HasOne<BookDto>().WithMany().HasForeignKey("BookId"),
// j => j.HasOne<ContributorIdModel>().WithMany().HasForeignKey("ContributorId"),
// j => j.HasOne<BookModel>().WithMany().HasForeignKey("BookId"),
// j =>
// {
// j.HasKey("BookId", "ContributorId");
@@ -150,9 +151,9 @@ public class BookConfiguration : IEntityTypeConfiguration<BookDto>
#endregion
}
//public class ContributorConfiguration : IEntityTypeConfiguration<ContributorIdDto>
//public class ContributorConfiguration : IEntityTypeConfiguration<ContributorIdModel>
//{
// public void Configure(EntityTypeBuilder<ContributorIdDto> builder)
// public void Configure(EntityTypeBuilder<ContributorIdModel> builder)
// {
// builder.ToTable("Contributors");
// builder.HasKey(c => c.Id);
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
@@ -7,16 +7,16 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="GenreDto"/> entity.
/// Configures the entity mapping for the <see cref="GenreModel"/> entity.
/// </summary>
public class GenreConfiguration : IEntityTypeConfiguration<GenreDto>
public class GenreConfiguration : IEntityTypeConfiguration<GenreModel>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the <see cref="GenreDto"/> entity.
/// Configures the <see cref="GenreModel"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<GenreDto> builder)
public void Configure(EntityTypeBuilder<GenreModel> builder)
{
builder.ToTable("Genres");
builder.HasKey(genre => genre.Name);
@@ -1,5 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Models.Common;
using Lumina.Contracts.Models.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
@@ -7,16 +7,16 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="TagDto"/> entity.
/// Configures the entity mapping for the <see cref="TagModel"/> entity.
/// </summary>
public class TagConfiguration : IEntityTypeConfiguration<TagDto>
public class TagConfiguration : IEntityTypeConfiguration<TagModel>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the <see cref="TagDto"/> entity.
/// Configures the <see cref="TagModel"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<TagDto> builder)
public void Configure(EntityTypeBuilder<TagModel> builder)
{
builder.ToTable("Tags");
builder.HasKey(tag => tag.Name);
Loaded 100 of 318 files, more files were not shown because too many files have changed in this diff. Show more