mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Implements first stage library management system
This commit is contained in:
1 parent
5e0f94cd82
commit
36352ea9e8
291 files changed
+3733
-1384
No files matched your search
@@ -38,6 +38,8 @@ Several icons used in this project were adapted from icons sourced from [svgrepo
|
||||
|
||||
- [`toggle-thumbnails.svg`](https://www.svgrepo.com/svg/370469/page-image) (Public Domain license)
|
||||
- [`toggle-hidden.svg`](https://www.svgrepo.com/svg/470389/hidden) (MIT License)
|
||||
- [`delete.svg`](https://www.svgrepo.com/svg/488148/delete) (MIT License)
|
||||
- [`add-directory.svg`](https://www.svgrepo.com/svg/488040/add-folder) (MIT License)
|
||||
|
||||
## License
|
||||
|
||||
|
||||
+1
-29
@@ -99,39 +99,11 @@ public interface IUserService
|
||||
|
||||
### C# Specific
|
||||
#### Code Conventions:
|
||||
- Each class, interface and struct should use the following `#region`s to group code sections:
|
||||
- Group `using`s with the following `#region`:
|
||||
```csharp
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Current.Namespace;
|
||||
|
||||
public class DhlDeliveryServiceProvider : IDeliveryServiceProvider
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly ITaxCalculator _taxCalculator;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
public GetDirectoryTreeQueryHandler(ITaxCalculator taxCalculator)
|
||||
{
|
||||
_taxCalculator = taxCalculator;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
public void Deliver()
|
||||
{
|
||||
// code
|
||||
}
|
||||
|
||||
public decimal CalculateCost()
|
||||
{
|
||||
// code
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
```
|
||||
- Enforce one type per file. For example:
|
||||
```csharp
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<span style="color: #FF0000;">Domain</span>
|
||||
├── <span style="color: #004BFF;">Audio Library Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">Audio Library Aggregate</span>
|
||||
│ └── <span style="color: #BDE180;">Audio Metadata</span>
|
||||
├── <span style="color: #004BFF;">Video Library Bounded Context</span>
|
||||
│ ├── <span style="color: #F589DD;">Movie Library Aggregate</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Movie Id</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Video Metadata</span>
|
||||
│ │ ├── <span style="color: #FEB423;">Movie Library Service</span>
|
||||
│ │ └── <span style="color: #B46DD4;">Movie</span>
|
||||
│ ├── <span style="color: #F589DD;">Tv Show Library Aggregate</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Episode Id</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Season Id</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Tv Show Id</span>
|
||||
│ │ ├── <span style="color: #80B0E0;">Episode</span>
|
||||
│ │ ├── <span style="color: #80B0E0;">Season</span>
|
||||
│ │ ├── <span style="color: #FEB423;">Tv Show Library Service</span>
|
||||
│ │ └── <span style="color: #B46DD4;">Tv Show</span>
|
||||
│ └── <span style="color: #FEB423;">Video Library Service</span>
|
||||
├── <span style="color: #004BFF;">Photo Library Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">Photo Library Aggregate</span>
|
||||
├── <span style="color: #004BFF;">Written Content Library Bounded Context</span>
|
||||
│ ├── <span style="color: #F589DD;">Book Library Aggregate</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Book Id</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Book Rating</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Book Series Id</span>
|
||||
│ │ ├── <span style="color: #BDE180;">ISBN</span>
|
||||
│ │ ├── <span style="color: #BDE180;">Written Content Metadata</span>
|
||||
│ │ ├── <span style="color: #80B0E0;">Book Series</span>
|
||||
│ │ ├── <span style="color: #FEB423;">Book Library Service</span>
|
||||
│ │ └── <span style="color: #B46DD4;">Book</span>
|
||||
│ ├── <span style="color: #F589DD;">Magazine Library Aggregate</span>
|
||||
│ │ └── <span style="color: #B46DD4;">Magazine</span>
|
||||
│ └── <span style="color: #FEB423;">Written Content Library Service</span>
|
||||
├── <span style="color: #004BFF;">Media Contributor Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">Media Contributor Aggregate</span>
|
||||
│ ├── <span style="color: #BDE180;">Contributor Name</span>
|
||||
│ ├── <span style="color: #BDE180;">Media Contributor Id</span>
|
||||
│ ├── <span style="color: #BDE180;">Media Contributor Role</span>
|
||||
│ └── <span style="color: #B46DD4;">Media Contributor</span>
|
||||
├── <span style="color: #004BFF;">Library Management Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">Library Aggregate</span>
|
||||
│ ├── <span style="color: #BDE180;">Library Id</span>
|
||||
│ └── <span style="color: #B46DD4;">Library</span>
|
||||
├── <span style="color: #004BFF;">User Management Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">User Aggregate</span>
|
||||
│ ├── <span style="color: #BDE180;">User Id</span>
|
||||
│ └── <span style="color: #B46DD4;">User</span>
|
||||
├── <span style="color: #004BFF;">File System Management Bounded Context</span>
|
||||
│ └── <span style="color: #F589DD;">File System Management Aggregate</span>
|
||||
│ ├── <span style="color: #BDE180;">File System Path Id</span>
|
||||
│ ├── <span style="color: #BDE180;">Path Segment</span>
|
||||
│ ├── <span style="color: #BDE180;">Stream Info</span>
|
||||
│ ├── <span style="color: #BDE180;">Thumbnail</span>
|
||||
│ ├── <span style="color: #80B0E0;">Directory</span>
|
||||
│ ├── <span style="color: #80B0E0;">File</span>
|
||||
│ ├── <span style="color: #80B0E0;">UNIX Root Item</span>
|
||||
│ ├── <span style="color: #80B0E0;">Windows Root Item</span>
|
||||
│ ├── <span style="color: #FEB423;">Directory Provider Service</span>
|
||||
│ ├── <span style="color: #FEB423;">File Provider Service</span>
|
||||
│ ├── <span style="color: #FEB423;">Directory Service</span>
|
||||
│ ├── <span style="color: #FEB423;">File Service</span>
|
||||
│ ├── <span style="color: #FEB423;">Drive Service</span>
|
||||
│ ├── <span style="color: #FEB423;">Path Service</span>
|
||||
│ ├── <span style="color: #FEB423;">Thumbnail Service</span>
|
||||
│ ├── <span style="color: #FEB423;">File System Permissions Service</span>
|
||||
│ ├── <span style="color: #FEB423;">File Type Service</span>
|
||||
│ └── <span style="color: #B46DD4;">File System Item</span>
|
||||
|
||||
<span style="color: #004BFF;">• Bounded Context</span>
|
||||
<span style="color: #F589DD;">• Aggregate</span>
|
||||
<span style="color: #B46DD4;">• Aggregate Root</span>
|
||||
<span style="color: #80B0E0;">• Entity</span>
|
||||
<span style="color: #BDE180;">• Value Object</span>
|
||||
<span style="color: #E14B5B;">• Event</span>
|
||||
<span style="color: #FEB423;">• Service</span>
|
||||
@@ -95,6 +95,7 @@
|
||||
- ComicSeries
|
||||
- Magazine
|
||||
- MagazineIssue
|
||||
- Newspaper
|
||||
- Manga
|
||||
- GraphicNovel
|
||||
- AcademicPaper
|
||||
@@ -117,7 +118,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, EBook, BookSeries, ComicBook, ComicSeries, Magazine, MagazineIssue, Manga, GraphicNovel, AcademicPaper, SheetMusic, Screenplay)
|
||||
- WrittenContentLibrary (root: WrittenContentLibrary, entities: Book, EBook, BookSeries, ComicBook, ComicSeries, Magazine, MagazineIssue, Newspaper, 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)
|
||||
@@ -133,7 +134,7 @@
|
||||
- Value Objects: ComicMetadata, SeriesInfo
|
||||
|
||||
- PeriodicalLibrary (root: PeriodicalLibrary)
|
||||
- Entities: Magazine, MagazineIssue
|
||||
- Entities: Magazine, MagazineIssue, Newspaper
|
||||
- Value Objects: PeriodicalMetadata, IssueInfo
|
||||
|
||||
- AcademicLibrary (root: AcademicLibrary)
|
||||
@@ -235,4 +236,4 @@
|
||||
- PlaylistRepository
|
||||
- CollectionRepository
|
||||
- FileRepository
|
||||
- StreamRepository
|
||||
- StreamRepository
|
||||
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the repository for media libraries.
|
||||
/// </summary>
|
||||
public interface ILibraryRepository : IRepository<LibraryEntity>,
|
||||
IInsertRepositoryAction<LibraryEntity>
|
||||
{
|
||||
}
|
||||
+8
-8
@@ -11,14 +11,14 @@ namespace Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GenreEntity"/>.
|
||||
/// </summary>
|
||||
public static class GenreModelMapping
|
||||
public static class GenreEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="GenreEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository model to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
public static ErrorOr<Genre> ToDomainModel(this GenreEntity repositoryEntity)
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted domain entity.</returns>
|
||||
public static ErrorOr<Genre> ToDomainEntity(this GenreEntity repositoryEntity)
|
||||
{
|
||||
return Genre.Create(
|
||||
repositoryEntity.Name
|
||||
@@ -28,10 +28,10 @@ public static class GenreModelMapping
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="Genre"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository models to be converted.</param>
|
||||
/// <returns>The converted domain models.</returns>
|
||||
public static IEnumerable<ErrorOr<Genre>> ToDomainModels(this IEnumerable<GenreEntity> repositoryEntities)
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted domain entities.</returns>
|
||||
public static IEnumerable<ErrorOr<Genre>> ToDomainEntities(this IEnumerable<GenreEntity> repositoryEntities)
|
||||
{
|
||||
return repositoryEntities.Select(repositoryEntity => repositoryEntity.ToDomainModel());
|
||||
return repositoryEntities.Select(repositoryEntity => repositoryEntity.ToDomainEntity());
|
||||
}
|
||||
}
|
||||
@@ -13,24 +13,24 @@ namespace Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
public static class GenreMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="GenreEntity"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="GenreEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static GenreEntity ToRepositoryEntity(this Genre domainModel)
|
||||
public static GenreEntity ToRepositoryEntity(this Genre domainEntity)
|
||||
{
|
||||
return new GenreEntity(
|
||||
domainModel.Name
|
||||
domainEntity.Name
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="GenreEntity"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="GenreEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<GenreEntity> ToRepositoryEntities(this IEnumerable<Genre> domainModels)
|
||||
public static IEnumerable<GenreEntity> ToRepositoryEntities(this IEnumerable<Genre> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToRepositoryEntity());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -11,14 +11,14 @@ namespace Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="TagEntity"/>.
|
||||
/// </summary>
|
||||
public static class TagModelMapping
|
||||
public static class TagEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="Tag"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
public static ErrorOr<Tag> ToDomainModel(this TagEntity repositoryEntity)
|
||||
/// <returns>The converted domain entity.</returns>
|
||||
public static ErrorOr<Tag> ToDomainEntity(this TagEntity repositoryEntity)
|
||||
{
|
||||
return Tag.Create(
|
||||
repositoryEntity.Name
|
||||
@@ -29,9 +29,9 @@ public static class TagModelMapping
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="Tag"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted domain models.</returns>
|
||||
public static IEnumerable<ErrorOr<Tag>> ToDomainModels(this IEnumerable<TagEntity> repositoryEntities)
|
||||
/// <returns>The converted domain entities.</returns>
|
||||
public static IEnumerable<ErrorOr<Tag>> ToDomainEntities(this IEnumerable<TagEntity> repositoryEntities)
|
||||
{
|
||||
return repositoryEntities.Select(domainModel => domainModel.ToDomainModel());
|
||||
return repositoryEntities.Select(domainEntity => domainEntity.ToDomainEntity());
|
||||
}
|
||||
}
|
||||
@@ -13,24 +13,24 @@ namespace Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
public static class TagMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="TagEntity"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="TagEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static TagEntity ToRepositoryEntity(this Tag domainModel)
|
||||
public static TagEntity ToRepositoryEntity(this Tag domainEntity)
|
||||
{
|
||||
return new TagEntity(
|
||||
domainModel.Name
|
||||
domainEntity.Name
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="TagEntity"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="TagEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain model to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<TagEntity> ToRepositoryEntities(this IEnumerable<Tag> domainModels)
|
||||
public static IEnumerable<TagEntity> ToRepositoryEntities(this IEnumerable<Tag> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToRepositoryEntity());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Common;
|
||||
@@ -16,7 +16,7 @@ public static class FileSystemTreeNodeResponseMapping
|
||||
/// Converts <paramref name="response"/> to <see cref="WindowsRootItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="response">The response to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
/// <returns>The converted domain entity.</returns>
|
||||
public static ErrorOr<WindowsRootItem> ToWindowsRootItem(this FileSystemTreeNodeResponse response)
|
||||
{
|
||||
return WindowsRootItem.Create(
|
||||
@@ -30,7 +30,7 @@ public static class FileSystemTreeNodeResponseMapping
|
||||
/// Converts <paramref name="_"/> to <see cref="UnixRootItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="_">The response to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
/// <returns>The converted domain entity.</returns>
|
||||
public static ErrorOr<UnixRootItem> ToUnixRootItem(this FileSystemTreeNodeResponse _)
|
||||
{
|
||||
return UnixRootItem.Create(
|
||||
|
||||
+26
-26
@@ -2,7 +2,7 @@
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
@@ -15,58 +15,58 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
public static class DirectoryMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this Directory domainModel)
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this Directory domainEntity)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Name = domainModel.Name,
|
||||
Path = domainModel.Id.Path,
|
||||
ItemType = domainModel.Type,
|
||||
Name = domainEntity.Name,
|
||||
Path = domainEntity.Id.Path,
|
||||
ItemType = domainEntity.Type,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
Children = domainEntity.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<Directory> domainModels)
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<Directory> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToTreeNodeResponse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="DirectoryResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="DirectoryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static DirectoryResponse ToResponse(this Directory domainModel)
|
||||
public static DirectoryResponse ToResponse(this Directory domainEntity)
|
||||
{
|
||||
return new DirectoryResponse(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
domainModel.DateCreated.Value,
|
||||
domainModel.DateModified.Value,
|
||||
domainModel.Items.Select(fileSystemItem => fileSystemItem.ToFileSystemItemModel())
|
||||
.ToList()
|
||||
domainEntity.Id.Path,
|
||||
domainEntity.Name,
|
||||
domainEntity.DateCreated.Value,
|
||||
domainEntity.DateModified.Value,
|
||||
domainEntity.Items.Select(fileSystemItem => fileSystemItem.ToFileSystemItemEntity())
|
||||
.ToList()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="DirectoryResponse"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="DirectoryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<DirectoryResponse> ToResponses(this IEnumerable<Directory> domainModels)
|
||||
public static IEnumerable<DirectoryResponse> ToResponses(this IEnumerable<Directory> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
|
||||
}
|
||||
}
|
||||
+21
-21
@@ -3,8 +3,8 @@ using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Entities.FileSystemManagement;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,47 +18,47 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
public static class FileSystemItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemItemEntity"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemItemEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted model.</returns>
|
||||
public static FileSystemItemEntity ToFileSystemItemModel(this FileSystemItem domainModel)
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted entity.</returns>
|
||||
public static FileSystemItemEntity ToFileSystemItemEntity(this FileSystemItem domainEntity)
|
||||
{
|
||||
return new FileSystemItemEntity(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
domainEntity.Id.Path,
|
||||
domainEntity.Name,
|
||||
DateTime.Now,
|
||||
DateTime.Now
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted model.</returns>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted entity.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when the provided parameter is not an expected descendant of <see cref="FileSystemItem"/>.</exception>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this FileSystemItem domainModel)
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this FileSystemItem domainEntity)
|
||||
{
|
||||
if (domainModel is Directory directory)
|
||||
if (domainEntity is Directory directory)
|
||||
return directory.ToFileSystemTreeNodeResponse();
|
||||
else if (domainModel is File file)
|
||||
else if (domainEntity is File file)
|
||||
return file.ToFileSystemTreeNodeResponse();
|
||||
else if (domainModel is WindowsRootItem windowsRootItem)
|
||||
else if (domainEntity is WindowsRootItem windowsRootItem)
|
||||
return windowsRootItem.ToTreeNodeResponse();
|
||||
else if (domainModel is UnixRootItem unixRootItem)
|
||||
else if (domainEntity is UnixRootItem unixRootItem)
|
||||
return unixRootItem.ToTreeNodeResponse();
|
||||
else
|
||||
throw new ArgumentException("Invalid FileSystemItem");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to <see cref="IEnumerable<FileSystemTreeNodeResponse>"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to <see cref="IEnumerable<FileSystemTreeNodeResponse>"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted models.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToTreeNodeResponses(this IEnumerable<FileSystemItem> domainModels)
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted entities.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToTreeNodeResponses(this IEnumerable<FileSystemItem> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToTreeNodeResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToTreeNodeResponse());
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
@@ -13,21 +13,21 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
public static class UnixRootItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this UnixRootItem domainModel)
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this UnixRootItem domainEntity)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Path = domainModel.Id.Path,
|
||||
Name = domainModel.Name,
|
||||
Path = domainEntity.Id.Path,
|
||||
Name = domainEntity.Name,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = domainModel.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
Children = domainEntity.Items.Select(item => item.ToTreeNodeResponse())
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
+6
-9
@@ -1,10 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using System.Linq;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
@@ -15,16 +12,16 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
public static class WindowsRootItemMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this WindowsRootItem domainModel)
|
||||
public static FileSystemTreeNodeResponse ToTreeNodeResponse(this WindowsRootItem domainEntity)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Path = domainModel.Id.Path,
|
||||
Name = domainModel.Name,
|
||||
Path = domainEntity.Id.Path,
|
||||
Name = domainEntity.Name,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
IsExpanded = false
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
@@ -14,55 +14,55 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
public static class FileMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this File domainModel)
|
||||
public static FileSystemTreeNodeResponse ToFileSystemTreeNodeResponse(this File domainEntity)
|
||||
{
|
||||
return new FileSystemTreeNodeResponse()
|
||||
{
|
||||
Name = domainModel.Name,
|
||||
Path = domainModel.Id.Path,
|
||||
ItemType = domainModel.Type,
|
||||
Name = domainEntity.Name,
|
||||
Path = domainEntity.Id.Path,
|
||||
ItemType = domainEntity.Type,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileSystemTreeNodeResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<File> domainModels)
|
||||
public static IEnumerable<FileSystemTreeNodeResponse> ToFileSystemTreeNodeResponses(this IEnumerable<File> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToFileSystemTreeNodeResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToFileSystemTreeNodeResponse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="FileResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="FileResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static FileResponse ToResponse(this File domainModel)
|
||||
public static FileResponse ToResponse(this File domainEntity)
|
||||
{
|
||||
return new FileResponse(
|
||||
domainModel.Id.Path,
|
||||
domainModel.Name,
|
||||
domainModel.DateCreated.HasValue ? domainModel.DateCreated.Value : default,
|
||||
domainModel.DateModified.HasValue ? domainModel.DateModified.Value : default,
|
||||
domainModel.Size
|
||||
domainEntity.Id.Path,
|
||||
domainEntity.Name,
|
||||
domainEntity.DateCreated.HasValue ? domainEntity.DateCreated.Value : default,
|
||||
domainEntity.DateModified.HasValue ? domainEntity.DateModified.Value : default,
|
||||
domainEntity.Size
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="FileResponse"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="FileResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<FileResponse> ToResponses(this IEnumerable<File> domainModels)
|
||||
public static IEnumerable<FileResponse> ToResponses(this IEnumerable<File> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
@@ -13,24 +13,24 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
public static class PathSegmentMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="PathSegmentResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="PathSegmentResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static PathSegmentResponse ToResponse(this PathSegment domainModel)
|
||||
public static PathSegmentResponse ToResponse(this PathSegment domainEntity)
|
||||
{
|
||||
return new PathSegmentResponse(
|
||||
domainModel.Name
|
||||
domainEntity.Name
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="PathSegmentResponse"/>.
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="PathSegmentResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IEnumerable<PathSegmentResponse> ToResponses(this IEnumerable<PathSegment> domainModels)
|
||||
public static IEnumerable<PathSegmentResponse> ToResponses(this IEnumerable<PathSegment> domainEntities)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToResponse());
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToResponse());
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
@@ -11,15 +11,15 @@ namespace Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
public static class ThumbnailMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="ThumbnailResponse"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="ThumbnailResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static ThumbnailResponse ToResponse(this Thumbnail domainModel)
|
||||
public static ThumbnailResponse ToResponse(this Thumbnail domainEntity)
|
||||
{
|
||||
return new ThumbnailResponse(
|
||||
domainModel.Type,
|
||||
domainModel.Bytes
|
||||
domainEntity.Type,
|
||||
domainEntity.Bytes
|
||||
);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="AddLibraryRequest"/>.
|
||||
/// </summary>
|
||||
public static class AddMediaLibraryRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="AddLibraryCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static AddLibraryCommand ToCommand(this AddLibraryRequest request)
|
||||
{
|
||||
return new AddLibraryCommand(
|
||||
request.UserId,
|
||||
request.Title,
|
||||
request.LibraryType,
|
||||
request.ContentLocations
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="LibraryEntity"/>.
|
||||
/// </summary>
|
||||
public static class LibraryEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="LibraryResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted response entity.</returns>
|
||||
public static LibraryResponse ToResponse(this LibraryEntity repositoryEntity)
|
||||
{
|
||||
return new LibraryResponse(
|
||||
repositoryEntity.Id,
|
||||
repositoryEntity.UserId,
|
||||
repositoryEntity.Title,
|
||||
repositoryEntity.LibraryType,
|
||||
repositoryEntity.ContentLocations.Select(location => location.Path).ToList(),
|
||||
repositoryEntity.Created,
|
||||
repositoryEntity.Updated
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Library"/>.
|
||||
/// </summary>
|
||||
public static class LibraryMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="LibraryEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static LibraryEntity ToRepositoryEntity(this Library domainEntity)
|
||||
{
|
||||
return new LibraryEntity
|
||||
{
|
||||
Id = domainEntity.Id.Value,
|
||||
Title = domainEntity.Title,
|
||||
LibraryType = domainEntity.LibraryType,
|
||||
UserId = domainEntity.UserId.Value,
|
||||
ContentLocations = domainEntity.ContentLocations.Select(path => new LibraryContentLocationEntity() { Path = path.Path }).ToList(),
|
||||
Created = domainEntity.Created,
|
||||
Updated = domainEntity.Updated.HasValue ? domainEntity.Updated : null
|
||||
};
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
using Lumina.Contracts.Requests.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="AddBookRequest"/>.
|
||||
+39
-38
@@ -1,54 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="BookEntity"/>.
|
||||
/// </summary>
|
||||
public static class BookModelMapping
|
||||
public static class BookEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="Book"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository model to be converted.</param>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully converted <see cref="Book"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<Book> ToDomainModel(this BookEntity repositoryEntity)
|
||||
public static ErrorOr<Book> ToDomainEntity(this BookEntity repositoryEntity)
|
||||
{
|
||||
IEnumerable<ErrorOr<Tag>> tagsResult = repositoryEntity.Tags.ToDomainModels();
|
||||
IEnumerable<ErrorOr<Tag>> tagsResult = repositoryEntity.Tags.ToDomainEntities();
|
||||
foreach (ErrorOr<Tag> tagResult in tagsResult)
|
||||
if (tagResult.IsError)
|
||||
return tagResult.Errors;
|
||||
|
||||
IEnumerable<ErrorOr<Genre>> genresResult = repositoryEntity.Genres.ToDomainModels();
|
||||
IEnumerable<ErrorOr<Genre>> genresResult = repositoryEntity.Genres.ToDomainEntities();
|
||||
foreach (ErrorOr<Genre> genreResult in genresResult)
|
||||
if (genreResult.IsError)
|
||||
return genreResult.Errors;
|
||||
|
||||
IEnumerable<ErrorOr<Isbn>> isbnsResult = repositoryEntity.ISBNs.ToDomainModels();
|
||||
IEnumerable<ErrorOr<Isbn>> isbnsResult = repositoryEntity.ISBNs.ToDomainEntities();
|
||||
foreach (ErrorOr<Isbn> isbnResult in isbnsResult)
|
||||
if (isbnResult.IsError)
|
||||
return isbnResult.Errors;
|
||||
|
||||
IEnumerable<ErrorOr<BookRating>> bookRatingsResult = repositoryEntity.Ratings.ToDomainModels();
|
||||
IEnumerable<ErrorOr<BookRating>> bookRatingsResult = repositoryEntity.Ratings.ToDomainEntities();
|
||||
foreach (ErrorOr<BookRating> bookRatingResult in bookRatingsResult)
|
||||
if (bookRatingResult.IsError)
|
||||
return bookRatingResult.Errors;
|
||||
@@ -63,7 +64,7 @@ public static class BookModelMapping
|
||||
);
|
||||
if (releaseInfoResult.IsError)
|
||||
return releaseInfoResult.Errors;
|
||||
|
||||
|
||||
Optional<LanguageInfo> languageInfo = Optional<LanguageInfo>.None();
|
||||
if (repositoryEntity.LanguageCode is not null)
|
||||
{
|
||||
@@ -105,8 +106,8 @@ public static class BookModelMapping
|
||||
if (writtenContentMetadataResult.IsError)
|
||||
return writtenContentMetadataResult.Errors;
|
||||
|
||||
Optional<BookFormat> bookFormat = Optional<BookFormat>.FromNullable(!string.IsNullOrWhiteSpace(repositoryEntity.Format) ? Enum.Parse<BookFormat>(repositoryEntity.Format) : (BookFormat?)null);
|
||||
|
||||
Optional<BookFormat> bookFormat = Optional<BookFormat>.FromNullable(repositoryEntity.Format);
|
||||
|
||||
return Book.Create(
|
||||
BookId.Create(repositoryEntity.Id),
|
||||
writtenContentMetadataResult.Value,
|
||||
@@ -133,24 +134,24 @@ public static class BookModelMapping
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="Book"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository models to be converted.</param>
|
||||
/// <returns>The converted domain models.</returns>
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted domain entities.</returns>
|
||||
/// <returns>
|
||||
/// An colection of <see cref="ErrorOr{TValue}"/> containing either successfully converted <see cref="Book"/>, or error messages.
|
||||
/// </returns>
|
||||
public static IEnumerable<ErrorOr<Book>> ToDomainModels(this IEnumerable<BookEntity> repositoryEntities)
|
||||
public static IEnumerable<ErrorOr<Book>> ToDomainEntities(this IEnumerable<BookEntity> repositoryEntities)
|
||||
{
|
||||
return repositoryEntities.Select(repositoryEntity => repositoryEntity.ToDomainModel());
|
||||
return repositoryEntities.Select(repositoryEntity => repositoryEntity.ToDomainEntity());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="BookResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository model to be converted.</param>
|
||||
/// <returns>The converted response model.</returns>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted response entity.</returns>
|
||||
public static BookResponse ToResponse(this BookEntity repositoryEntity)
|
||||
{
|
||||
ReleaseInfoEntity releaseInfoModel = new(
|
||||
ReleaseInfoEntity releaseInfoEntity = new(
|
||||
repositoryEntity.OriginalReleaseDate,
|
||||
repositoryEntity.OriginalReleaseYear,
|
||||
repositoryEntity.ReReleaseDate,
|
||||
@@ -159,38 +160,38 @@ public static class BookModelMapping
|
||||
repositoryEntity.ReleaseVersion
|
||||
);
|
||||
// language and original language make sense only if their subproperties have values
|
||||
LanguageInfoEntity? languageInfoModel = (!string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) ||
|
||||
LanguageInfoEntity? languageInfoEntity = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName))
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName)
|
||||
? new LanguageInfoEntity(
|
||||
repositoryEntity.LanguageCode,
|
||||
repositoryEntity.LanguageName,
|
||||
repositoryEntity.LanguageNativeName
|
||||
) : null;
|
||||
LanguageInfoEntity? originalLanguageInfoModel = (!string.IsNullOrWhiteSpace(repositoryEntity.OriginalLanguageCode) ||
|
||||
LanguageInfoEntity? originalLanguageInfoEntity = !string.IsNullOrWhiteSpace(repositoryEntity.OriginalLanguageCode) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.OriginalLanguageName) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.OriginalLanguageNativeName))
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.OriginalLanguageNativeName)
|
||||
? new LanguageInfoEntity(
|
||||
repositoryEntity.OriginalLanguageCode,
|
||||
repositoryEntity.OriginalLanguageName,
|
||||
repositoryEntity.OriginalLanguageNativeName
|
||||
) : null;
|
||||
WrittenContentMetadataEntity metadata = new(
|
||||
repositoryEntity.Title,
|
||||
repositoryEntity.OriginalTitle,
|
||||
repositoryEntity.Title,
|
||||
repositoryEntity.OriginalTitle,
|
||||
repositoryEntity.Description,
|
||||
releaseInfoModel,
|
||||
releaseInfoEntity,
|
||||
[.. repositoryEntity.Genres],
|
||||
[.. repositoryEntity.Tags],
|
||||
languageInfoModel,
|
||||
originalLanguageInfoModel,
|
||||
languageInfoEntity,
|
||||
originalLanguageInfoEntity,
|
||||
repositoryEntity.Publisher,
|
||||
repositoryEntity.PageCount
|
||||
);
|
||||
return new BookResponse(
|
||||
repositoryEntity.Id,
|
||||
repositoryEntity.Id,
|
||||
metadata,
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.Format) ? Enum.Parse<BookFormat>(repositoryEntity.Format) : null,
|
||||
repositoryEntity.Format,
|
||||
repositoryEntity.Edition,
|
||||
repositoryEntity.VolumeNumber,
|
||||
null,
|
||||
@@ -198,7 +199,7 @@ public static class BookModelMapping
|
||||
repositoryEntity.GoodreadsId,
|
||||
repositoryEntity.LCCN,
|
||||
repositoryEntity.OCLCNumber,
|
||||
repositoryEntity.OpenLibraryId,
|
||||
repositoryEntity.OpenLibraryId,
|
||||
repositoryEntity.LibraryThingId,
|
||||
repositoryEntity.GoogleBooksId,
|
||||
repositoryEntity.BarnesAndNobleId,
|
||||
@@ -214,7 +215,7 @@ public static class BookModelMapping
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="Book"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository models to be converted.</param>
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted reponses.</returns>
|
||||
public static IEnumerable<BookResponse> ToResponses(this IEnumerable<BookEntity> repositoryEntities)
|
||||
{
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Book"/>.
|
||||
/// </summary>
|
||||
public static class BookMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="BookEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static BookEntity ToRepositoryEntity(this Book domainEntity)
|
||||
{
|
||||
return new BookEntity
|
||||
{
|
||||
Id = domainEntity.Id.Value,
|
||||
Title = domainEntity.Metadata.Title,
|
||||
OriginalTitle = domainEntity.Metadata.OriginalTitle.HasValue ? domainEntity.Metadata.OriginalTitle.Value : null,
|
||||
Description = domainEntity.Metadata.Description.HasValue ? domainEntity.Metadata.Description.Value : null,
|
||||
OriginalReleaseDate = domainEntity.Metadata.ReleaseInfo.OriginalReleaseDate.HasValue ? domainEntity.Metadata.ReleaseInfo.OriginalReleaseDate.Value : null,
|
||||
OriginalReleaseYear = domainEntity.Metadata.ReleaseInfo.OriginalReleaseYear.HasValue ? domainEntity.Metadata.ReleaseInfo.OriginalReleaseYear.Value : null,
|
||||
ReReleaseDate = domainEntity.Metadata.ReleaseInfo.ReReleaseDate.HasValue ? domainEntity.Metadata.ReleaseInfo.ReReleaseDate.Value : null,
|
||||
ReReleaseYear = domainEntity.Metadata.ReleaseInfo.ReReleaseYear.HasValue ? domainEntity.Metadata.ReleaseInfo.ReReleaseYear.Value : null,
|
||||
ReleaseCountry = domainEntity.Metadata.ReleaseInfo.ReleaseCountry.HasValue ? domainEntity.Metadata.ReleaseInfo.ReleaseCountry.Value : null,
|
||||
ReleaseVersion = domainEntity.Metadata.ReleaseInfo.ReleaseVersion.HasValue ? domainEntity.Metadata.ReleaseInfo.ReleaseVersion.Value : null,
|
||||
LanguageCode = domainEntity.Metadata.Language.HasValue ? domainEntity.Metadata.Language.Value.LanguageCode : null,
|
||||
LanguageName = domainEntity.Metadata.Language.HasValue ? domainEntity.Metadata.Language.Value.LanguageName : null,
|
||||
LanguageNativeName = domainEntity.Metadata.Language.HasValue ? domainEntity.Metadata.Language.Value.NativeName.Value : null,
|
||||
OriginalLanguageCode = domainEntity.Metadata.OriginalLanguage.HasValue ? domainEntity.Metadata.OriginalLanguage.Value.LanguageCode : null,
|
||||
OriginalLanguageName = domainEntity.Metadata.OriginalLanguage.HasValue ? domainEntity.Metadata.OriginalLanguage.Value.LanguageName : null,
|
||||
OriginalLanguageNativeName = domainEntity.Metadata.OriginalLanguage.HasValue ? domainEntity.Metadata.OriginalLanguage.Value.NativeName.Value : null,
|
||||
Tags = domainEntity.Metadata.Tags.ToRepositoryEntities().ToHashSet(),
|
||||
Genres = domainEntity.Metadata.Genres.ToRepositoryEntities().ToHashSet(),
|
||||
Publisher = domainEntity.Metadata.Publisher.HasValue ? domainEntity.Metadata.Publisher.Value : null,
|
||||
PageCount = domainEntity.Metadata.PageCount.HasValue ? domainEntity.Metadata.PageCount.Value : null,
|
||||
Format = domainEntity.Format.HasValue ? domainEntity.Format.Value : null,
|
||||
Edition = domainEntity.Edition.HasValue ? domainEntity.Edition.Value : null,
|
||||
VolumeNumber = domainEntity.VolumeNumber.HasValue ? domainEntity.VolumeNumber.Value : null,
|
||||
ASIN = domainEntity.ASIN.HasValue ? domainEntity.ASIN.Value : null,
|
||||
GoodreadsId = domainEntity.GoodreadsId.HasValue ? domainEntity.GoodreadsId.Value : null,
|
||||
LCCN = domainEntity.LCCN.HasValue ? domainEntity.LCCN.Value : null,
|
||||
OCLCNumber = domainEntity.OCLCNumber.HasValue ? domainEntity.OCLCNumber.Value : null,
|
||||
OpenLibraryId = domainEntity.OpenLibraryId.HasValue ? domainEntity.OpenLibraryId.Value : null,
|
||||
LibraryThingId = domainEntity.LibraryThingId.HasValue ? domainEntity.LibraryThingId.Value : null,
|
||||
GoogleBooksId = domainEntity.GoogleBooksId.HasValue ? domainEntity.GoogleBooksId.Value : null,
|
||||
BarnesAndNobleId = domainEntity.BarnesAndNobleId.HasValue ? domainEntity.BarnesAndNobleId.Value : null,
|
||||
AppleBooksId = domainEntity.AppleBooksId.HasValue ? domainEntity.AppleBooksId.Value : null,
|
||||
ISBNs = domainEntity.ISBNs.ToRepositoryEntities().ToList(),
|
||||
Ratings = domainEntity.Ratings.ToRepositoryEntities().ToList(),
|
||||
Created = domainEntity.Created,
|
||||
Updated = domainEntity.Updated.HasValue ? domainEntity.Updated : null
|
||||
};
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -1,26 +1,26 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="BookRatingEntity"/>.
|
||||
/// </summary>
|
||||
public static class BookRatingModelMapping
|
||||
public static class BookRatingEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="BookRating"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository model to be converted.</param>
|
||||
/// <returns>The converted domain model.</returns>
|
||||
public static ErrorOr<BookRating> ToDomainModel(this BookRatingEntity repositoryEntity)
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted domain entity.</returns>
|
||||
public static ErrorOr<BookRating> ToDomainEntity(this BookRatingEntity repositoryEntity)
|
||||
{
|
||||
return BookRating.Create(
|
||||
repositoryEntity.Value ?? default,
|
||||
@@ -33,10 +33,10 @@ public static class BookRatingModelMapping
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="BookRating"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository models to be converted.</param>
|
||||
/// <returns>The converted domain models.</returns>
|
||||
public static IEnumerable<ErrorOr<BookRating>> ToDomainModels(this IEnumerable<BookRatingEntity> repositoryEntities)
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted domain entities.</returns>
|
||||
public static IEnumerable<ErrorOr<BookRating>> ToDomainEntities(this IEnumerable<BookRatingEntity> repositoryEntities)
|
||||
{
|
||||
return repositoryEntities.Select(domainModel => domainModel.ToDomainModel());
|
||||
return repositoryEntities.Select(domainEntity => domainEntity.ToDomainEntity());
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="BookRating"/>.
|
||||
/// </summary>
|
||||
public static class BookRatingMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="BookRatingEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static BookRatingEntity ToRepositoryEntity(this BookRating domainEntity)
|
||||
{
|
||||
return new BookRatingEntity(
|
||||
domainEntity.Value,
|
||||
domainEntity.MaxValue,
|
||||
domainEntity.Source.HasValue ? domainEntity.Source.Value : null,
|
||||
domainEntity.VoteCount.HasValue ? domainEntity.VoteCount.Value : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="BookRatingEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<BookRatingEntity> ToRepositoryEntities(this IEnumerable<BookRating> domainEntities)
|
||||
{
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -1,27 +1,27 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="IsbnEntity"/>.
|
||||
/// </summary>
|
||||
public static class IsbnModelMapping
|
||||
public static class IsbnEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="Isbn"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository model to be converted.</param>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully converted <see cref="Isbn"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<Isbn> ToDomainModel(this IsbnEntity repositoryEntity)
|
||||
public static ErrorOr<Isbn> ToDomainEntity(this IsbnEntity repositoryEntity)
|
||||
{
|
||||
return Isbn.Create(
|
||||
repositoryEntity.Value,
|
||||
@@ -32,10 +32,10 @@ public static class IsbnModelMapping
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntities"/> to a collection of <see cref="Isbn"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntities">The repository models to be converted.</param>
|
||||
/// <returns>The converted domain models.</returns>
|
||||
public static IEnumerable<ErrorOr<Isbn>> ToDomainModels(this IEnumerable<IsbnEntity> repositoryEntities)
|
||||
/// <param name="repositoryEntities">The repository entities to be converted.</param>
|
||||
/// <returns>The converted domain entities.</returns>
|
||||
public static IEnumerable<ErrorOr<Isbn>> ToDomainEntities(this IEnumerable<IsbnEntity> repositoryEntities)
|
||||
{
|
||||
return repositoryEntities.Select(domainModel => domainModel.ToDomainModel());
|
||||
return repositoryEntities.Select(domainEntity => domainEntity.ToDomainEntity());
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Isbn"/>.
|
||||
/// </summary>
|
||||
public static class IsbnMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="IsbnEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static IsbnEntity ToRepositoryEntity(this Isbn domainEntity)
|
||||
{
|
||||
return new IsbnEntity(
|
||||
domainEntity.Value,
|
||||
domainEntity.Format
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainEntities"/> to a collection of <see cref="IsbnEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEntities">The domain entities to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<IsbnEntity> ToRepositoryEntities(this IEnumerable<Isbn> domainEntities)
|
||||
{
|
||||
return domainEntities.Select(domainEntity => domainEntity.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Users;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.UsersManagement.Users;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="UserEntity"/>.
|
||||
/// </summary>
|
||||
public static class UserEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="UserResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted response entity.</returns>
|
||||
public static UserResponse ToResponse(this UserEntity repositoryEntity)
|
||||
{
|
||||
return new UserResponse(
|
||||
repositoryEntity.Id,
|
||||
repositoryEntity.Username,
|
||||
repositoryEntity.Created,
|
||||
repositoryEntity.Updated
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,19 +11,19 @@ namespace Lumina.Application.Common.Mapping.UsersManagement.Users;
|
||||
public static class UserMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="UserEntity"/>.
|
||||
/// Converts <paramref name="domainEntity"/> to <see cref="UserEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <param name="repositoryEntity">The repository entity containing sensitive information not mapped to the Domain model.</param>
|
||||
/// <param name="domainEntity">The domain entity to be converted.</param>
|
||||
/// <param name="repositoryEntity">The repository entity containing sensitive information not mapped to the Domain entity.</param>
|
||||
/// <remarks>
|
||||
/// Because Authentication and Authorization are Application Layer concerns, the members involved in those concerns are not mirrored in the Domain entity.
|
||||
/// However, since Entity Framework updates an entire entity, when mapping from the Domain entity to the DAL entity, one still needs to provide the
|
||||
/// values of the non-included members, such that they are not overriden with <see langword="null"/>. Those values should come in the requested <paramref name="repositoryEntity"/>.
|
||||
/// </remarks>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static UserEntity ToRepositoryEntity(this User domainModel, UserEntity repositoryEntity)
|
||||
public static UserEntity ToRepositoryEntity(this User domainEntity, UserEntity repositoryEntity)
|
||||
{
|
||||
repositoryEntity.Username = domainModel.Username;
|
||||
repositoryEntity.Username = domainEntity.Username;
|
||||
return repositoryEntity;
|
||||
}
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Book"/>.
|
||||
/// </summary>
|
||||
public static class BookMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="BookEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static BookEntity ToRepositoryEntity(this Book domainModel)
|
||||
{
|
||||
return new BookEntity
|
||||
{
|
||||
Id = domainModel.Id.Value,
|
||||
Title = domainModel.Metadata.Title,
|
||||
OriginalTitle = domainModel.Metadata.OriginalTitle.HasValue ? domainModel.Metadata.OriginalTitle.Value : null,
|
||||
Description = domainModel.Metadata.Description.HasValue ? domainModel.Metadata.Description.Value : null,
|
||||
OriginalReleaseDate = domainModel.Metadata.ReleaseInfo.OriginalReleaseDate.HasValue ? domainModel.Metadata.ReleaseInfo.OriginalReleaseDate.Value : null,
|
||||
OriginalReleaseYear = domainModel.Metadata.ReleaseInfo.OriginalReleaseYear.HasValue ? domainModel.Metadata.ReleaseInfo.OriginalReleaseYear.Value : null,
|
||||
ReReleaseDate = domainModel.Metadata.ReleaseInfo.ReReleaseDate.HasValue ? domainModel.Metadata.ReleaseInfo.ReReleaseDate.Value : null,
|
||||
ReReleaseYear = domainModel.Metadata.ReleaseInfo.ReReleaseYear.HasValue ? domainModel.Metadata.ReleaseInfo.ReReleaseYear.Value : null,
|
||||
ReleaseCountry = domainModel.Metadata.ReleaseInfo.ReleaseCountry.HasValue ? domainModel.Metadata.ReleaseInfo.ReleaseCountry.Value : null,
|
||||
ReleaseVersion = domainModel.Metadata.ReleaseInfo.ReleaseVersion.HasValue ? domainModel.Metadata.ReleaseInfo.ReleaseVersion.Value : null,
|
||||
LanguageCode = domainModel.Metadata.Language.HasValue ? domainModel.Metadata.Language.Value.LanguageCode : null,
|
||||
LanguageName = domainModel.Metadata.Language.HasValue ? domainModel.Metadata.Language.Value.LanguageName : null,
|
||||
LanguageNativeName = domainModel.Metadata.Language.HasValue ? domainModel.Metadata.Language.Value.NativeName.Value : null,
|
||||
OriginalLanguageCode = domainModel.Metadata.OriginalLanguage.HasValue ? domainModel.Metadata.OriginalLanguage.Value.LanguageCode : null,
|
||||
OriginalLanguageName = domainModel.Metadata.OriginalLanguage.HasValue ? domainModel.Metadata.OriginalLanguage.Value.LanguageName : null,
|
||||
OriginalLanguageNativeName = domainModel.Metadata.OriginalLanguage.HasValue ? domainModel.Metadata.OriginalLanguage.Value.NativeName.Value : null,
|
||||
Tags = domainModel.Metadata.Tags.ToRepositoryEntities().ToHashSet(),
|
||||
Genres = domainModel.Metadata.Genres.ToRepositoryEntities().ToHashSet(),
|
||||
Publisher = domainModel.Metadata.Publisher.HasValue ? domainModel.Metadata.Publisher.Value : null,
|
||||
PageCount = domainModel.Metadata.PageCount.HasValue ? domainModel.Metadata.PageCount.Value : null,
|
||||
Format = domainModel.Format.ToString(),
|
||||
Edition = domainModel.Edition.HasValue ? domainModel.Edition.Value : null,
|
||||
VolumeNumber = domainModel.VolumeNumber.HasValue ? domainModel.VolumeNumber.Value : null,
|
||||
ASIN = domainModel.ASIN.HasValue ? domainModel.ASIN.Value : null,
|
||||
GoodreadsId = domainModel.GoodreadsId.HasValue ? domainModel.GoodreadsId.Value : null,
|
||||
LCCN = domainModel.LCCN.HasValue ? domainModel.LCCN.Value : null,
|
||||
OCLCNumber = domainModel.OCLCNumber.HasValue ? domainModel.OCLCNumber.Value : null,
|
||||
OpenLibraryId = domainModel.OpenLibraryId.HasValue ? domainModel.OpenLibraryId.Value : null,
|
||||
LibraryThingId = domainModel.LibraryThingId.HasValue ? domainModel.LibraryThingId.Value : null,
|
||||
GoogleBooksId = domainModel.GoogleBooksId.HasValue ? domainModel.GoogleBooksId.Value : null,
|
||||
BarnesAndNobleId = domainModel.BarnesAndNobleId.HasValue ? domainModel.BarnesAndNobleId.Value : null,
|
||||
AppleBooksId = domainModel.AppleBooksId.HasValue ? domainModel.AppleBooksId.Value : null,
|
||||
ISBNs = domainModel.ISBNs.ToRepositoryEntities().ToList(),
|
||||
Ratings = domainModel.Ratings.ToRepositoryEntities().ToList(),
|
||||
Created = domainModel.Created,
|
||||
Updated = domainModel.Updated.HasValue ? domainModel.Updated : null
|
||||
};
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="BookRating"/>.
|
||||
/// </summary>
|
||||
public static class BookRatingMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="BookRatingEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static BookRatingEntity ToRepositoryEntity(this BookRating domainModel)
|
||||
{
|
||||
return new BookRatingEntity(
|
||||
domainModel.Value,
|
||||
domainModel.MaxValue,
|
||||
domainModel.Source.HasValue ? domainModel.Source.Value : null,
|
||||
domainModel.VoteCount.HasValue ? domainModel.VoteCount.Value : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="BookRatingEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<BookRatingEntity> ToRepositoryEntities(this IEnumerable<BookRating> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="Isbn"/>.
|
||||
/// </summary>
|
||||
public static class IsbnMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModel"/> to <see cref="IsbnEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModel">The domain model to be converted.</param>
|
||||
/// <returns>The converted repository entity.</returns>
|
||||
public static IsbnEntity ToRepositoryEntity(this Isbn domainModel)
|
||||
{
|
||||
return new IsbnEntity(
|
||||
domainModel.Value,
|
||||
domainModel.Format
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="domainModels"/> to a collection of <see cref="IsbnEntity"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainModels">The domain models to be converted.</param>
|
||||
/// <returns>The converted repository entities.</returns>
|
||||
public static IEnumerable<IsbnEntity> ToRepositoryEntities(this IEnumerable<Isbn> domainModels)
|
||||
{
|
||||
return domainModels.Select(domainModel => domainModel.ToRepositoryEntity());
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.MediaLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Command for adding a media library.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user owning the media library.</param>
|
||||
/// <param name="LibraryType">The type of the media library.</param>
|
||||
/// <param name="ContentLocations">The file system paths of the directories where the media library elements are located.</param>
|
||||
/// <param name="Title">The title of the media library.</param>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public record AddLibraryCommand(
|
||||
Guid UserId,
|
||||
string? Title,
|
||||
LibraryType? LibraryType,
|
||||
string[]? ContentLocations
|
||||
) : IRequest<ErrorOr<LibraryResponse>>;
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Enums.MediaLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the command to add a media library.
|
||||
/// </summary>
|
||||
public class AddLibraryCommandHandler : IRequestHandler<AddLibraryCommand, ErrorOr<LibraryResponse>>
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddLibraryCommandHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
public AddLibraryCommandHandler(IUnitOfWork unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the command to add a media library.
|
||||
/// </summary>
|
||||
/// <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{TValue}"/> containing either a successfully created <see cref="LibraryResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public async ValueTask<ErrorOr<LibraryResponse>> Handle(AddLibraryCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Library> createLibraryResult = Library.Create(
|
||||
request.UserId,
|
||||
request.Title!,
|
||||
request.LibraryType ?? LibraryType.Other,
|
||||
request.ContentLocations!
|
||||
);
|
||||
|
||||
if (createLibraryResult.IsError)
|
||||
return createLibraryResult.Errors;
|
||||
|
||||
ILibraryRepository libraryRepository = _unitOfWork.GetRepository<ILibraryRepository>();
|
||||
LibraryEntity persistenceLibrary = createLibraryResult.Value.ToRepositoryEntity();
|
||||
ErrorOr<Created> insertLibraryResult = await libraryRepository.InsertAsync(persistenceLibrary, cancellationToken).ConfigureAwait(false);
|
||||
if (insertLibraryResult.IsError)
|
||||
return insertLibraryResult.Errors;
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return persistenceLibrary.ToResponse();
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="AddLibraryCommand"/>.
|
||||
/// </summary>
|
||||
public class AddLibraryCommandValidator : AbstractValidator<AddLibraryCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddLibraryCommandValidator"/> class.
|
||||
/// </summary>
|
||||
public AddLibraryCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(Errors.Library.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.UserIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.LibraryType)
|
||||
.NotNull().WithMessage(Errors.Library.LibraryTypeCannotBeNull.Description)
|
||||
.IsInEnum().WithMessage(Errors.Library.UnknownLibraryType.Description);
|
||||
|
||||
RuleFor(x => x.ContentLocations)
|
||||
.NotNull().WithMessage(Errors.Library.PathsListCannotBeNull.Description)
|
||||
.NotEmpty().WithMessage(Errors.Library.PathsListCannotBeEmpty.Description);
|
||||
|
||||
RuleForEach(x => x.ContentLocations)
|
||||
.NotEmpty().WithMessage(Errors.FileSystemManagement.PathCannotBeEmpty.Description)
|
||||
.MaximumLength(260).WithMessage(Errors.FileSystemManagement.PathMustBeMaximum260CharactersLong.Description);
|
||||
|
||||
RuleFor(x => x.Title)
|
||||
.NotEmpty().WithMessage(Errors.Library.TitleCannotBeEmpty.Description)
|
||||
.MaximumLength(255).WithMessage(Errors.Library.TitleMustBeMaximum255CharactersLong.Description);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Entities.MediaContributors;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
namespace Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
|
||||
/// <summary>
|
||||
/// Command for adding a book.
|
||||
+9
-9
@@ -2,17 +2,17 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Entities.MediaContributors;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
using Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -21,7 +21,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
namespace Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the command to add a book.
|
||||
@@ -45,7 +45,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{TValue}"/> containing either a successfully created <see cref="Book"/>, or an error message.
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="BookResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public async ValueTask<ErrorOr<BookResponse>> Handle(AddBookCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@ using Lumina.Contracts.Enums.BookLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
namespace Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="AddBookCommand"/>.
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queries.GetBooks;
|
||||
namespace Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Queries.GetBooks;
|
||||
|
||||
/// <summary>
|
||||
/// Query for getting all books.
|
||||
+4
-4
@@ -2,16 +2,16 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queries.GetBooks;
|
||||
namespace Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Queries.GetBooks;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to get all books.
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
@@ -15,12 +15,12 @@ public interface IStorageEntity
|
||||
Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The time and date when the entity was added.
|
||||
/// Gets or sets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time and date when the entity was updated.
|
||||
/// Gets or sets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
DateTime? Updated { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a media library content location.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("Path: {Path}")]
|
||||
public class LibraryContentLocationEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the path of the media library content location.
|
||||
/// </summary>
|
||||
public required string Path { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a media library.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public class LibraryEntity : IStorageEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the media library.
|
||||
/// </summary>
|
||||
public required Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the user that owns the media library.
|
||||
/// </summary>
|
||||
public required Guid UserId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the media library.
|
||||
/// </summary>
|
||||
public required string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the media library.
|
||||
/// </summary>
|
||||
public required LibraryType LibraryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of file system paths that make up the media library.
|
||||
/// </summary>
|
||||
public required ICollection<LibraryContentLocationEntity> ContentLocations { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user that owns the media library.
|
||||
/// </summary>
|
||||
public UserEntity User { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
public required DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a book.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public class BookEntity : IStorageEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the media item.
|
||||
/// </summary>
|
||||
public required Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the media item.
|
||||
/// </summary>
|
||||
public required string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original title of the media item.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional description of the media item.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional original release date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? OriginalReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional original release year of the media item.
|
||||
/// This is useful when only the year of original release is known.
|
||||
/// </summary>
|
||||
public int? OriginalReleaseYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional re-release or reissue date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? ReReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional re-release or reissue year of the media item.
|
||||
/// </summary>
|
||||
public int? ReReleaseYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional country or region of release.
|
||||
/// </summary>
|
||||
public string? ReleaseCountry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
/// </summary>
|
||||
public string? ReleaseVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ISO 639-1 two-letter language code.
|
||||
/// </summary>
|
||||
public string? LanguageCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the full name of the language in English.
|
||||
/// </summary>
|
||||
public string? LanguageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional native name of the language.
|
||||
/// </summary>
|
||||
public string? LanguageNativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional ISO 639-1 two-letter original language code.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional full name of the original language in English.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional native name of the original language.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageNativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of tags associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<TagEntity> Tags { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<GenreEntity> Genres { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable.
|
||||
/// </summary>
|
||||
public BookFormat? Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the edition of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? Edition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the volume or book number in the series, if applicable.
|
||||
/// </summary>
|
||||
public int? VolumeNumber { get; set; }
|
||||
// TODO: uncomment when series is implemented
|
||||
/// <summary>
|
||||
/// Gets or sets the series id, if the book is part of a series.
|
||||
/// </summary>
|
||||
//public Guid? BookSeriesId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ASIN (Amazon Standard Identification Number) of the book.
|
||||
/// </summary>
|
||||
public string? ASIN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Goodreads ID of the book.
|
||||
/// </summary>
|
||||
public string? GoodreadsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Library of Congress Control Number (LCCN) of the book.
|
||||
/// </summary>
|
||||
public string? LCCN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OCLC Number (WorldCat identifier) of the book.
|
||||
/// </summary>
|
||||
public string? OCLCNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Open Library ID of the book.
|
||||
/// </summary>
|
||||
public string? OpenLibraryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LibraryThing ID of the book.
|
||||
/// </summary>
|
||||
public string? LibraryThingId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Google Books ID of the book.
|
||||
/// </summary>
|
||||
public string? GoogleBooksId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Barnes & Noble ID of the book.
|
||||
/// </summary>
|
||||
public string? BarnesAndNobleId { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Apple Books ID of the book.
|
||||
/// </summary>
|
||||
public string? AppleBooksId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of ISBN (International Standard Book Number) of the book.
|
||||
/// </summary>
|
||||
public List<IsbnEntity> ISBNs { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of media contributors (actors, directors, etc) starring in this book.
|
||||
/// </summary>
|
||||
//public List<ContributorIdModel> ContributorIds { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of ratings for this book.
|
||||
/// </summary>
|
||||
public List<BookRatingEntity> Ratings { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
public required DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ using Lumina.Contracts.Enums.BookLibrary;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a book rating.
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for book series.
|
||||
+2
-2
@@ -3,7 +3,7 @@ using Lumina.Contracts.Enums.BookLibrary;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for ISBN information.
|
||||
@@ -13,5 +13,5 @@ namespace Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
[DebuggerDisplay("ISBN: {Value} ({Format})")]
|
||||
public record IsbnEntity(
|
||||
string? Value,
|
||||
IsbnFormat? Format
|
||||
IsbnFormat? Format // TODO: perhaps it should be string, for consistency (see Format property on BookEntity) (check HaveConversion<string>())
|
||||
);
|
||||
+1
-1
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.WrittenContentLibrary;
|
||||
namespace Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for written content metadata.
|
||||
@@ -1,6 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
@@ -42,6 +44,11 @@ public class UserEntity : IStorageEntity
|
||||
/// </summary>
|
||||
public DateTime? VerificationTokenCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of libraries owned by this user.
|
||||
/// </summary>
|
||||
public required ICollection<LibraryEntity> Libraries { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a book.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public class BookEntity : IStorageEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the media item.
|
||||
/// </summary>
|
||||
public Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title of the media item.
|
||||
/// </summary>
|
||||
public string Title { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original title of the media item.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional description of the media item.
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original release date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? OriginalReleaseDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original release year of the media item.
|
||||
/// This is useful when only the year of original release is known.
|
||||
/// </summary>
|
||||
public int? OriginalReleaseYear { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? ReReleaseDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue year of the media item.
|
||||
/// </summary>
|
||||
public int? ReReleaseYear { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional country or region of release.
|
||||
/// </summary>
|
||||
public string? ReleaseCountry { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
/// </summary>
|
||||
public string? ReleaseVersion { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ISO 639-1 two-letter language code.
|
||||
/// </summary>
|
||||
public string? LanguageCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full name of the language in English.
|
||||
/// </summary>
|
||||
public string? LanguageName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an optional native name of the language.
|
||||
/// </summary>
|
||||
public string? LanguageNativeName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional ISO 639-1 two-letter original language code.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional full name of the original language in English.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an optional native name of the original language.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageNativeName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of tags associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<TagEntity> Tags { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<GenreEntity> Genres { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format of the book (e.g., Hardcover, Paperback), if applicable.
|
||||
/// </summary>
|
||||
public string Format { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the edition of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? Edition { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the volume or book number in the series, if applicable.
|
||||
/// </summary>
|
||||
public int? VolumeNumber { get; init; }
|
||||
// TODO: uncomment when series is implemented
|
||||
/// <summary>
|
||||
/// Gets the series id, if the book is part of a series.
|
||||
/// </summary>
|
||||
//public Guid? BookSeriesId { get; init; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ASIN (Amazon Standard Identification Number) of the book.
|
||||
/// </summary>
|
||||
public string? ASIN { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Goodreads ID of the book.
|
||||
/// </summary>
|
||||
public string? GoodreadsId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Library of Congress Control Number (LCCN) of the book.
|
||||
/// </summary>
|
||||
public string? LCCN { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OCLC Number (WorldCat identifier) of the book.
|
||||
/// </summary>
|
||||
public string? OCLCNumber { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Open Library ID of the book.
|
||||
/// </summary>
|
||||
public string? OpenLibraryId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LibraryThing ID of the book.
|
||||
/// </summary>
|
||||
public string? LibraryThingId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Google Books ID of the book.
|
||||
/// </summary>
|
||||
public string? GoogleBooksId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Barnes & Noble ID of the book.
|
||||
/// </summary>
|
||||
public string? BarnesAndNobleId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Apple Books ID of the book.
|
||||
/// </summary>
|
||||
public string? AppleBooksId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of ISBN (International Standard Book Number) of the book.
|
||||
/// </summary>
|
||||
public List<IsbnEntity> ISBNs { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of media contributors (actors, directors, etc) starring in this book.
|
||||
/// </summary>
|
||||
//public List<ContributorIdModel> ContributorIds { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of ratings for this book.
|
||||
/// </summary>
|
||||
public List<BookRatingEntity> Ratings { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
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,187 @@
|
||||
namespace Lumina.Contracts.Enums.MediaLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of libraries.
|
||||
/// </summary>
|
||||
public enum LibraryType
|
||||
{
|
||||
/// <summary>
|
||||
/// Traditional printed books in physical format.
|
||||
/// </summary>
|
||||
Book,
|
||||
|
||||
/// <summary>
|
||||
/// Digital books in electronic format (e.g., PDF, EPUB, MOBI).
|
||||
/// </summary>
|
||||
EBook,
|
||||
|
||||
/// <summary>
|
||||
/// Comic books in digital or physical format.
|
||||
/// </summary>
|
||||
ComicBook,
|
||||
|
||||
/// <summary>
|
||||
/// Periodical publications containing articles and illustrations.
|
||||
/// </summary>
|
||||
Magazine,
|
||||
|
||||
/// <summary>
|
||||
/// Periodical publication containing news.
|
||||
/// </summary>
|
||||
Newspaper,
|
||||
|
||||
/// <summary>
|
||||
/// Japanese-style comics and graphic novels.
|
||||
/// </summary>
|
||||
Manga,
|
||||
|
||||
/// <summary>
|
||||
/// Extended comic-format narratives, typically containing a complete story.
|
||||
/// </summary>
|
||||
GraphicNovel,
|
||||
|
||||
/// <summary>
|
||||
/// Scholarly articles and research papers.
|
||||
/// </summary>
|
||||
AcademicPaper,
|
||||
|
||||
/// <summary>
|
||||
/// Musical notation and scores.
|
||||
/// </summary>
|
||||
SheetMusic,
|
||||
|
||||
/// <summary>
|
||||
/// Television series and episodic content.
|
||||
/// </summary>
|
||||
TvShow,
|
||||
|
||||
/// <summary>
|
||||
/// Feature-length films and motion pictures.
|
||||
/// </summary>
|
||||
Movie,
|
||||
|
||||
/// <summary>
|
||||
/// Non-fiction films presenting factual information.
|
||||
/// </summary>
|
||||
Documentary,
|
||||
|
||||
/// <summary>
|
||||
/// Japanese animation series and films.
|
||||
/// </summary>
|
||||
Anime,
|
||||
|
||||
/// <summary>
|
||||
/// Recorded live music performances and concerts.
|
||||
/// </summary>
|
||||
ConcertVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Educational and instructional videos.
|
||||
/// </summary>
|
||||
TutorialVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Personally recorded videos and family footage.
|
||||
/// </summary>
|
||||
HomeVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Videos sourced from YouTube platform.
|
||||
/// </summary>
|
||||
YouTubeVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Professional or amateur music video productions.
|
||||
/// </summary>
|
||||
MusicVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Videos recorded during live performances or events.
|
||||
/// </summary>
|
||||
LiveRecordingVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Recorded conversations and Q&A sessions in video format.
|
||||
/// </summary>
|
||||
InterviewVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Videos of musical performances covering other artists' work.
|
||||
/// </summary>
|
||||
CoverSongVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Video format podcasts and episodic content.
|
||||
/// </summary>
|
||||
PodcastVideo,
|
||||
|
||||
/// <summary>
|
||||
/// Audio recordings of musical content.
|
||||
/// </summary>
|
||||
Music,
|
||||
|
||||
/// <summary>
|
||||
/// Narrated books in audio format.
|
||||
/// </summary>
|
||||
Audiobook,
|
||||
|
||||
/// <summary>
|
||||
/// Audio recordings from live performances or events.
|
||||
/// </summary>
|
||||
LiveRecordingAudio,
|
||||
|
||||
/// <summary>
|
||||
/// Recorded conversations and Q&A sessions in audio format.
|
||||
/// </summary>
|
||||
InterviewAudio,
|
||||
|
||||
/// <summary>
|
||||
/// Audio recordings of musical performances covering other artists' work.
|
||||
/// </summary>
|
||||
CoverSongAudio,
|
||||
|
||||
/// <summary>
|
||||
/// Modified or reinterpreted versions of original musical recordings.
|
||||
/// </summary>
|
||||
Remix,
|
||||
|
||||
/// <summary>
|
||||
/// Audio clips used for sound design and production.
|
||||
/// </summary>
|
||||
SoundEffect,
|
||||
|
||||
/// <summary>
|
||||
/// Audio format podcasts and episodic content.
|
||||
/// </summary>
|
||||
PodcastAudio,
|
||||
|
||||
/// <summary>
|
||||
/// Digital images and photographs.
|
||||
/// </summary>
|
||||
Photo,
|
||||
|
||||
/// <summary>
|
||||
/// Curated sequences of media items.
|
||||
/// </summary>
|
||||
Playlist,
|
||||
|
||||
/// <summary>
|
||||
/// Grouped sets of related media items.
|
||||
/// </summary>
|
||||
Collection,
|
||||
|
||||
/// <summary>
|
||||
/// Text files containing dialogue translations for video content.
|
||||
/// </summary>
|
||||
Subtitles,
|
||||
|
||||
/// <summary>
|
||||
/// Text files containing words and timing for musical content.
|
||||
/// </summary>
|
||||
Lyrics,
|
||||
|
||||
/// <summary>
|
||||
/// A collection of media that does not fit into any other category.
|
||||
/// </summary>
|
||||
Other
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Contracts.Enums.Library;
|
||||
namespace Lumina.Contracts.Enums.MediaLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of miscellaneous content libraries.
|
||||
@@ -9,4 +9,4 @@ public enum MiscellaneousContentType
|
||||
/// A collection of media that does not fit into any other category.
|
||||
/// </summary>
|
||||
Other,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a media library.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user owning the media library.</param>
|
||||
/// <param name="Title">The title of the media library.</param>
|
||||
/// <param name="LibraryType">The type of the media library.</param>
|
||||
/// <param name="ContentLocations">The file system paths of the directories where the media library elements are located.</param>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public record AddLibraryRequest(
|
||||
Guid UserId,
|
||||
string? Title,
|
||||
LibraryType? LibraryType,
|
||||
string[]? ContentLocations
|
||||
);
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaContributors;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a book.
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Diagnostics;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get a book by the specified Id.
|
||||
@@ -0,0 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media library response.
|
||||
/// </summary>
|
||||
/// <param name="Id">The id of the media library.</param>
|
||||
/// <param name="UserId">The Id of the user owning the media library.</param>
|
||||
/// <param name="Title">The title of the media library.</param>
|
||||
/// <param name="LibraryType">The type of the media library.</param>
|
||||
/// <param name="ContentLocations">The file system paths of the directories where the media library elements are located.</param>
|
||||
/// <param name="Created">The date and time when the library was created.</param>
|
||||
/// <param name="Updated">The optional date and time when the library was updated.</param>
|
||||
[DebuggerDisplay("Title: {Title}")]
|
||||
public record LibraryResponse(
|
||||
Guid Id,
|
||||
Guid UserId,
|
||||
string Title,
|
||||
LibraryType LibraryType,
|
||||
List<string> ContentLocations,
|
||||
DateTime Created,
|
||||
DateTime? Updated
|
||||
);
|
||||
+7
-4
@@ -1,18 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaContributors;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a book.
|
||||
/// Represents a book response.
|
||||
/// </summary>
|
||||
/// <param name="Id">The id of the book.</param>
|
||||
/// <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>
|
||||
@@ -30,6 +31,8 @@ namespace Lumina.Contracts.Responses.WrittenContentLibrary.BookLibrary.Books;
|
||||
/// <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>
|
||||
/// <param name="Created">The date and time when the book was created.</param>
|
||||
/// <param name="Updated">The optional date and time when the book was updated.</param>
|
||||
[DebuggerDisplay("Title: {Metadata.Title}")]
|
||||
public record BookResponse(
|
||||
Guid Id,
|
||||
@@ -0,0 +1,21 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.UsersManagement.Users;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a user response.
|
||||
/// </summary>
|
||||
/// <param name="Id">The id of the user.</param>
|
||||
/// <param name="Username">The username of the user.</param>
|
||||
/// <param name="Created">The date and time when the user was created.</param>
|
||||
/// <param name="Updated">The optional date and time when the user was updated.</param>
|
||||
[DebuggerDisplay("Username: {Username}")]
|
||||
public record UserResponse(
|
||||
Guid Id,
|
||||
string Username,
|
||||
DateTime Created,
|
||||
DateTime? Updated
|
||||
);
|
||||
@@ -1,8 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
@@ -25,63 +26,114 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(book => book.Title).IsRequired().HasMaxLength(255).HasColumnOrder(1);
|
||||
builder.Property(book => book.OriginalTitle).HasMaxLength(255).HasColumnOrder(2);
|
||||
builder.Property(book => book.Description).HasMaxLength(2000).HasColumnOrder(3);
|
||||
builder.Property(book => book.OriginalReleaseDate).HasColumnOrder(4);
|
||||
builder.Property(book => book.OriginalReleaseYear).HasColumnOrder(5);
|
||||
builder.Property(book => book.ReReleaseDate).HasColumnOrder(6);
|
||||
builder.Property(book => book.ReReleaseYear).HasColumnOrder(7);
|
||||
builder.Property(book => book.ReleaseCountry).HasColumnOrder(8);
|
||||
builder.Property(book => book.ReleaseVersion).HasColumnOrder(9);
|
||||
builder.Property(book => book.LanguageCode).HasColumnOrder(10);
|
||||
builder.Property(book => book.LanguageName).HasColumnOrder(11);
|
||||
builder.Property(book => book.LanguageNativeName).HasColumnOrder(12);
|
||||
builder.Property(book => book.OriginalLanguageCode).HasColumnOrder(13);
|
||||
builder.Property(book => book.OriginalLanguageName).HasColumnOrder(14);
|
||||
builder.Property(book => book.OriginalLanguageNativeName).HasColumnOrder(15);
|
||||
builder.Property(book => book.Title)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnOrder(1);
|
||||
builder.Property(book => book.OriginalTitle)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnOrder(2);
|
||||
builder.Property(book => book.Description)
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnOrder(3);
|
||||
builder.Property(book => book.OriginalReleaseDate)
|
||||
.HasColumnOrder(4);
|
||||
builder.Property(book => book.OriginalReleaseYear)
|
||||
.HasColumnOrder(5);
|
||||
builder.Property(book => book.ReReleaseDate)
|
||||
.HasColumnOrder(6);
|
||||
builder.Property(book => book.ReReleaseYear)
|
||||
.HasColumnOrder(7);
|
||||
builder.Property(book => book.ReleaseCountry)
|
||||
.HasColumnOrder(8);
|
||||
builder.Property(book => book.ReleaseVersion)
|
||||
.HasColumnOrder(9);
|
||||
builder.Property(book => book.LanguageCode)
|
||||
.HasColumnOrder(10);
|
||||
builder.Property(book => book.LanguageName)
|
||||
.HasColumnOrder(11);
|
||||
builder.Property(book => book.LanguageNativeName)
|
||||
.HasColumnOrder(12);
|
||||
builder.Property(book => book.OriginalLanguageCode)
|
||||
.HasColumnOrder(13);
|
||||
builder.Property(book => book.OriginalLanguageName)
|
||||
.HasColumnOrder(14);
|
||||
builder.Property(book => book.OriginalLanguageNativeName)
|
||||
.HasColumnOrder(15);
|
||||
// since Tag is a Domain ValueObject (no identity), but we also don't want to have duplicates,
|
||||
// we need to configure it as a many-to-many relationship, where the tag itself is the primary key
|
||||
builder.HasMany(book => book.Tags)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BookTags",
|
||||
j => j.HasOne<TagEntity>().WithMany().HasForeignKey("TagId"),
|
||||
j => j.HasOne<BookEntity>().WithMany().HasForeignKey("BookId"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BookId", "TagId");
|
||||
j.ToTable("BookTags");
|
||||
});
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BookTags",
|
||||
j => j.HasOne<TagEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey("TagId"),
|
||||
j => j.HasOne<BookEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BookId", "TagId");
|
||||
j.ToTable("BookTags");
|
||||
});
|
||||
|
||||
builder.HasMany(book => book.Genres)
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BookGenres",
|
||||
j => j.HasOne<GenreEntity>().WithMany().HasForeignKey("GenreId"),
|
||||
j => j.HasOne<BookEntity>().WithMany().HasForeignKey("BookId"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BookId", "GenreId");
|
||||
j.ToTable("BookGenres");
|
||||
});
|
||||
.WithMany()
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BookGenres",
|
||||
j => j.HasOne<GenreEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreId"),
|
||||
j => j.HasOne<BookEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BookId", "GenreId");
|
||||
j.ToTable("BookGenres");
|
||||
});
|
||||
|
||||
builder.Property(book => book.Publisher).HasMaxLength(100).HasColumnOrder(16);
|
||||
builder.Property(book => book.PageCount).HasColumnOrder(17);
|
||||
builder.Property(book => book.Format).HasColumnOrder(18);
|
||||
builder.Property(book => book.Edition).HasMaxLength(50).HasColumnOrder(19);
|
||||
builder.Property(book => book.VolumeNumber).HasColumnOrder(20);
|
||||
builder.Property(book => book.ASIN).HasMaxLength(10).HasColumnOrder(21);
|
||||
builder.Property(book => book.GoodreadsId).HasColumnOrder(22);
|
||||
builder.Property(book => book.LCCN).HasColumnOrder(23);
|
||||
builder.Property(book => book.OCLCNumber).HasColumnOrder(24);
|
||||
builder.Property(book => book.OpenLibraryId).HasMaxLength(50).HasColumnOrder(25);
|
||||
builder.Property(book => book.LibraryThingId).HasMaxLength(50).HasColumnOrder(26);
|
||||
builder.Property(book => book.GoogleBooksId).HasMaxLength(12).HasColumnOrder(27);
|
||||
builder.Property(book => book.BarnesAndNobleId).HasMaxLength(10).HasColumnOrder(28);
|
||||
builder.Property(book => book.AppleBooksId).HasColumnOrder(29);
|
||||
builder.Property(book => book.Created).HasColumnOrder(30);
|
||||
builder.Property(book => book.Updated).HasColumnOrder(31);
|
||||
builder.Property(book => book.Publisher)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnOrder(16);
|
||||
builder.Property(book => book.PageCount)
|
||||
.HasColumnOrder(17);
|
||||
builder.Property(book => book.Format)
|
||||
.HasConversion<string>()
|
||||
.HasColumnOrder(18);
|
||||
builder.Property(book => book.Edition)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnOrder(19);
|
||||
builder.Property(book => book.VolumeNumber)
|
||||
.HasColumnOrder(20);
|
||||
builder.Property(book => book.ASIN)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnOrder(21);
|
||||
builder.Property(book => book.GoodreadsId)
|
||||
.HasColumnOrder(22);
|
||||
builder.Property(book => book.LCCN)
|
||||
.HasColumnOrder(23);
|
||||
builder.Property(book => book.OCLCNumber)
|
||||
.HasColumnOrder(24);
|
||||
builder.Property(book => book.OpenLibraryId)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnOrder(25);
|
||||
builder.Property(book => book.LibraryThingId)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnOrder(26);
|
||||
builder.Property(book => book.GoogleBooksId)
|
||||
.HasMaxLength(12)
|
||||
.HasColumnOrder(27);
|
||||
builder.Property(book => book.BarnesAndNobleId)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnOrder(28);
|
||||
builder.Property(book => book.AppleBooksId)
|
||||
.HasColumnOrder(29);
|
||||
builder.Property(book => book.Created)
|
||||
.HasColumnOrder(30);
|
||||
builder.Property(book => book.Updated)
|
||||
.HasColumnOrder(31);
|
||||
|
||||
//builder.HasMany<ContributorIdModel>()
|
||||
//.WithMany()
|
||||
@@ -108,8 +160,10 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
builder.OwnsMany(book => book.Ratings, ratingBuilder =>
|
||||
{
|
||||
ratingBuilder.ToTable("BookRatings");
|
||||
ratingBuilder.WithOwner().HasForeignKey("BookId");
|
||||
ratingBuilder.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
ratingBuilder.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
ratingBuilder.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
ratingBuilder.HasKey("Id");
|
||||
|
||||
ratingBuilder.Property(rating => rating.Value)
|
||||
@@ -132,8 +186,10 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
builder.OwnsMany(book => book.ISBNs, isbnBuilder =>
|
||||
{
|
||||
isbnBuilder.ToTable("BookISBNs");
|
||||
isbnBuilder.WithOwner().HasForeignKey("BookId");
|
||||
isbnBuilder.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
isbnBuilder.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
isbnBuilder.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
isbnBuilder.HasKey("Id");
|
||||
|
||||
isbnBuilder.Property(isbn => isbn.Value)
|
||||
@@ -157,4 +213,4 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
||||
// builder.HasKey(c => c.Id);
|
||||
// builder.Property(c => c.Id).ValueGeneratedNever();
|
||||
// }
|
||||
//}
|
||||
//}
|
||||
@@ -0,0 +1,60 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.Common.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Configures the entity mapping for the <see cref="LibraryEntity"/> entity.
|
||||
/// </summary>
|
||||
public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures the <see cref="LibraryEntity"/> entity.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder to be used to configure the entity.</param>
|
||||
public void Configure(EntityTypeBuilder<LibraryEntity> builder)
|
||||
{
|
||||
builder.ToTable("Libraries");
|
||||
builder.HasKey(library => library.Id);
|
||||
builder.Property(library => library.Id)
|
||||
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
|
||||
.HasColumnOrder(0);
|
||||
|
||||
builder.Property(library => library.Title)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnOrder(1);
|
||||
|
||||
builder.Property(library => library.LibraryType)
|
||||
.IsRequired()
|
||||
.HasConversion<string>()
|
||||
.HasColumnOrder(2);
|
||||
|
||||
// one user with many libraries
|
||||
builder.HasOne(library => library.User)
|
||||
.WithMany(user => user.Libraries)
|
||||
.HasForeignKey(library => library.UserId)
|
||||
.IsRequired();
|
||||
|
||||
// using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library
|
||||
builder.OwnsMany(library => library.ContentLocations, contentLocationBuilder =>
|
||||
{
|
||||
contentLocationBuilder.ToTable("LibraryContentLocations");
|
||||
contentLocationBuilder.WithOwner()
|
||||
.HasForeignKey("LibraryId");
|
||||
|
||||
contentLocationBuilder.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
contentLocationBuilder.HasKey("Id");
|
||||
|
||||
contentLocationBuilder.Property(location => location.Path)
|
||||
.HasColumnName("Path")
|
||||
.HasMaxLength(260)
|
||||
.IsRequired();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -40,5 +40,11 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
|
||||
builder.Property(user => user.VerificationTokenCreated)
|
||||
.HasColumnOrder(5);
|
||||
|
||||
builder.HasMany(user => user.Libraries)
|
||||
.WithOne(library => library.User)
|
||||
.HasForeignKey(library => library.UserId)
|
||||
.IsRequired() // a library must have a user
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
+441
@@ -0,0 +1,441 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
{
|
||||
[DbContext(typeof(LuminaDbContext))]
|
||||
[Migration("20241103170430_AddLibrariesTable")]
|
||||
partial class AddLibrariesTable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
|
||||
|
||||
modelBuilder.Entity("BookGenres", b =>
|
||||
{
|
||||
b.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GenreId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("BookId", "GenreId");
|
||||
|
||||
b.HasIndex("GenreId");
|
||||
|
||||
b.ToTable("BookGenres", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookTags", b =>
|
||||
{
|
||||
b.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TagId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("BookId", "TagId");
|
||||
|
||||
b.HasIndex("TagId");
|
||||
|
||||
b.ToTable("BookTags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.Common.GenreEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.ToTable("Genres", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.Common.TagEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.ToTable("Tags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LibraryType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Libraries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("ASIN")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(21);
|
||||
|
||||
b.Property<string>("AppleBooksId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(29);
|
||||
|
||||
b.Property<string>("BarnesAndNobleId")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(28);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(30);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Edition")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(19);
|
||||
|
||||
b.Property<string>("Format")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(18);
|
||||
|
||||
b.Property<string>("GoodreadsId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(22);
|
||||
|
||||
b.Property<string>("GoogleBooksId")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(27);
|
||||
|
||||
b.Property<string>("LCCN")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(23);
|
||||
|
||||
b.Property<string>("LanguageCode")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(10);
|
||||
|
||||
b.Property<string>("LanguageName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(11);
|
||||
|
||||
b.Property<string>("LanguageNativeName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(12);
|
||||
|
||||
b.Property<string>("LibraryThingId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(26);
|
||||
|
||||
b.Property<string>("OCLCNumber")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(24);
|
||||
|
||||
b.Property<string>("OpenLibraryId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(25);
|
||||
|
||||
b.Property<string>("OriginalLanguageCode")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(13);
|
||||
|
||||
b.Property<string>("OriginalLanguageName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(14);
|
||||
|
||||
b.Property<string>("OriginalLanguageNativeName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(15);
|
||||
|
||||
b.Property<DateOnly?>("OriginalReleaseDate")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<int?>("OriginalReleaseYear")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.Property<string>("OriginalTitle")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<int?>("PageCount")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(17);
|
||||
|
||||
b.Property<string>("Publisher")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(16);
|
||||
|
||||
b.Property<DateOnly?>("ReReleaseDate")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<int?>("ReReleaseYear")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(7);
|
||||
|
||||
b.Property<string>("ReleaseCountry")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(8);
|
||||
|
||||
b.Property<string>("ReleaseVersion")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(9);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(31);
|
||||
|
||||
b.Property<int?>("VolumeNumber")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(20);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Books", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("TotpSecret")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("VerificationToken")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime?>("VerificationTokenCreated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookGenres", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Contracts.Entities.Common.GenreEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookTags", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Contracts.Entities.Common.TagEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Contracts.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithMany("Libraries")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryContentLocationEntity", "ContentLocations", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("LibraryId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("Path");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("LibraryId");
|
||||
|
||||
b1.ToTable("LibraryContentLocations", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LibraryId");
|
||||
});
|
||||
|
||||
b.Navigation("ContentLocations");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<decimal?>("MaxValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("decimal(3,2)");
|
||||
|
||||
b1.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<decimal?>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("decimal(3,2)");
|
||||
|
||||
b1.Property<int?>("VoteCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("BookId");
|
||||
|
||||
b1.ToTable("BookRatings", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
});
|
||||
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Format")
|
||||
.IsRequired()
|
||||
.HasMaxLength(6)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(13)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("ISBN");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("BookId");
|
||||
|
||||
b1.ToTable("BookISBNs", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
});
|
||||
|
||||
b.Navigation("ISBNs");
|
||||
|
||||
b.Navigation("Ratings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Navigation("Libraries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddLibrariesTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Format",
|
||||
table: "Books",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "Id",
|
||||
table: "BookRatings",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER")
|
||||
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "Id",
|
||||
table: "BookISBNs",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER")
|
||||
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Libraries",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Title = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
LibraryType = table.Column<string>(type: "TEXT", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Created = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Updated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Libraries", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Libraries_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LibraryContentLocations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Path = table.Column<string>(type: "TEXT", maxLength: 260, nullable: false),
|
||||
LibraryId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LibraryContentLocations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryContentLocations_Libraries_LibraryId",
|
||||
column: x => x.LibraryId,
|
||||
principalTable: "Libraries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Libraries_UserId",
|
||||
table: "Libraries",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryContentLocations_LibraryId",
|
||||
table: "LibraryContentLocations",
|
||||
column: "LibraryId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LibraryContentLocations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Libraries");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Format",
|
||||
table: "Books",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "BookRatings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT")
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "BookISBNs",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "TEXT")
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
b.ToTable("Tags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.UsersManagement.UserEntity", b =>
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
@@ -78,38 +78,31 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Password")
|
||||
b.Property<string>("LibraryType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("TotpSecret")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("VerificationToken")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("VerificationTokenCreated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Libraries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
@@ -144,7 +137,6 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.HasColumnOrder(19);
|
||||
|
||||
b.Property<string>("Format")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(18);
|
||||
|
||||
@@ -256,9 +248,49 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
b.ToTable("Books", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("TotpSecret")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("VerificationToken")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime?>("VerificationTokenCreated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookGenres", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
b.HasOne("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@@ -273,7 +305,7 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
|
||||
modelBuilder.Entity("BookTags", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
b.HasOne("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@@ -286,13 +318,51 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.OwnsMany("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 =>
|
||||
b.HasOne("Lumina.Contracts.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithMany("Libraries")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.Management.LibraryContentLocationEntity", "ContentLocations", b1 =>
|
||||
{
|
||||
b1.Property<int>("Id")
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("LibraryId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("Path");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("LibraryId");
|
||||
|
||||
b1.ToTable("LibraryContentLocations", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LibraryId");
|
||||
});
|
||||
|
||||
b.Navigation("ContentLocations");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
@@ -323,11 +393,11 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.HasForeignKey("BookId");
|
||||
});
|
||||
|
||||
b.OwnsMany("Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 =>
|
||||
b.OwnsMany("Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 =>
|
||||
{
|
||||
b1.Property<int>("Id")
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
@@ -357,6 +427,11 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
|
||||
b.Navigation("Ratings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Contracts.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Navigation("Libraries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.Core.Repositories.Libraries;
|
||||
|
||||
/// <summary>
|
||||
/// Repository for media libraries.
|
||||
/// </summary>
|
||||
internal sealed class LibraryRepository : ILibraryRepository
|
||||
{
|
||||
private readonly LuminaDbContext _luminaDbContext;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryRepository"/> class.
|
||||
/// </summary>
|
||||
/// <param name="luminaDbContext">Injected Entity Framework DbContext.</param>
|
||||
public LibraryRepository(LuminaDbContext luminaDbContext)
|
||||
{
|
||||
_luminaDbContext = luminaDbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new library.
|
||||
/// </summary>
|
||||
/// <param name="library">The library to add.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
|
||||
public async Task<ErrorOr<Created>> InsertAsync(LibraryEntity library, CancellationToken cancellationToken)
|
||||
{
|
||||
bool libraryExists = await _luminaDbContext.Libraries.AnyAsync(repositoryLibrary => repositoryLibrary.Id == library.Id, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (libraryExists)
|
||||
return Errors.Library.LibraryAlreadyExists;
|
||||
|
||||
_luminaDbContext.Libraries.Add(library);
|
||||
return Result.Created;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Entities.Common;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Entities.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
@@ -21,6 +22,7 @@ public class LuminaDbContext : DbContext
|
||||
{
|
||||
public virtual DbSet<BookEntity> Books { get; set; } = null!;
|
||||
public virtual DbSet<UserEntity> Users { get; set; } = null!;
|
||||
public virtual DbSet<LibraryEntity> Libraries { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LuminaDbContext"/> class.
|
||||
@@ -43,6 +45,8 @@ public class LuminaDbContext : DbContext
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
// TODO: implement async versions of SaveChanges
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the SaveChanges method of the DbContext class to automatically set the Created and Updated properties of entities that implement the <see cref="IStorageEntity"/>.
|
||||
/// </summary>
|
||||
@@ -51,8 +55,8 @@ public class LuminaDbContext : DbContext
|
||||
{
|
||||
// get all the entity entries that are either added or modified
|
||||
IEnumerable<EntityEntry> entries = ChangeTracker.Entries()
|
||||
.Where(e => e.Entity is IStorageEntity &&
|
||||
(e.State is EntityState.Added or EntityState.Modified));
|
||||
.Where(entity => entity.Entity is IStorageEntity &&
|
||||
(entity.State is EntityState.Added or EntityState.Modified));
|
||||
foreach (EntityEntry? entityEntry in entries)
|
||||
{
|
||||
// if the entity is in Added state, set the Created property to the current date and time
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.DependencyInjection;
|
||||
|
||||
@@ -12,6 +12,7 @@ public static partial class Errors
|
||||
public static class FileSystemManagement
|
||||
{
|
||||
public static Error ParentNodeCannotBeNull => Error.Failure(description: nameof(ParentNodeCannotBeNull));
|
||||
public static Error PathMustBeMaximum260CharactersLong => Error.Failure(description: nameof(PathMustBeMaximum260CharactersLong));
|
||||
public static Error FileCopyError => Error.Failure(description: nameof(FileCopyError));
|
||||
public static Error FileMoveError => Error.Failure(description: nameof(FileMoveError));
|
||||
public static Error DirectoryCopyError => Error.Failure(description: nameof(DirectoryCopyError));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Media Library error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
public static class Library
|
||||
{
|
||||
public static Error UserIdCannotBeEmpty => Error.Forbidden(description: nameof(UserIdCannotBeEmpty));
|
||||
public static Error LibraryAlreadyExists => Error.Conflict(description: nameof(LibraryAlreadyExists));
|
||||
public static Error LibraryTypeCannotBeNull => Error.Validation(description: nameof(LibraryTypeCannotBeNull));
|
||||
public static Error UnknownLibraryType => Error.Unexpected(description: nameof(UnknownLibraryType));
|
||||
public static Error PathsListCannotBeNull => Error.Validation(description: nameof(PathsListCannotBeNull));
|
||||
public static Error PathsListCannotBeEmpty => Error.Validation(description: nameof(PathsListCannotBeEmpty));
|
||||
public static Error TitleCannotBeEmpty => Error.Validation(description: nameof(TitleCannotBeEmpty));
|
||||
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(description: nameof(TitleMustBeMaximum255CharactersLong));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.AudioLibrary.AudioLibraryAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.AudioLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Value Object for the audio metadata of a media element.
|
||||
@@ -150,4 +150,4 @@ public class AudioMetadata : BaseMetadata
|
||||
yield return AudioCodec;
|
||||
yield return Bitrate;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -2,14 +2,14 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system directory.
|
||||
+3
-3
@@ -3,13 +3,13 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system file.
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system root item on Unix platforms.
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system root item on Windows platforms.
|
||||
+2
-2
@@ -4,11 +4,11 @@ using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a generic file system element.
|
||||
+3
-4
@@ -3,7 +3,8 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -11,7 +12,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Directory provider for local file systems.
|
||||
@@ -240,14 +241,12 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
string destFilePath = _fileSystem.Path.Combine(destDir, fileName);
|
||||
// if a file with the same name exists in the destination
|
||||
if (_fileSystem.File.Exists(destFilePath))
|
||||
{
|
||||
if (overwrite)
|
||||
{
|
||||
// overwrite the file in the destination directory
|
||||
_fileSystem.File.Delete(destFilePath);
|
||||
_fileSystem.File.Move(sourceFilePath, destFilePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
_fileSystem.File.Move(sourceFilePath, destFilePath); // move the file if it does not exist in the destination directory
|
||||
}
|
||||
+5
-5
@@ -3,15 +3,15 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling directories.
|
||||
+5
-4
@@ -1,15 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling drives.
|
||||
+2
-2
@@ -3,7 +3,7 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -11,7 +11,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// File provider for local file systems.
|
||||
+5
-5
@@ -3,15 +3,15 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling file system files.
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
using System;
|
||||
@@ -11,7 +11,7 @@ using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for file system permissions.
|
||||
+3
-3
@@ -3,8 +3,8 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Entities;
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
@@ -13,7 +13,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Class defining methods for handling file-related operations.
|
||||
Loaded 100 of 291 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user