mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Adds media library advanced options
This commit is contained in:
1 parent
1c28355197
commit
f89ba4960a
60 files changed
+1877
-51
No files matched your search
+20
@@ -45,6 +45,26 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
|
||||
/// </summary>
|
||||
public required ICollection<LibraryContentLocationEntity> ContentLocations { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this media library is enabled or not. A disabled media library is never shown or changed.
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this media library is locked or not. A locked media library is displayed, but is never changed or updated.
|
||||
/// </summary>
|
||||
public bool IsLocked { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this media library should update the metadata of its elements from the web, or not.
|
||||
/// </summary>
|
||||
public bool DownloadMedatadaFromWeb { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this media library should copy the downloaded metadata into the media library content locations, or not.
|
||||
/// </summary>
|
||||
public bool SaveMetadataInMediaDirectories { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user that owns the media library.
|
||||
/// </summary>
|
||||
|
||||
+17
@@ -1,8 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
@@ -17,4 +21,17 @@ public interface ILibraryRepository : IRepository<LibraryEntity>,
|
||||
IUpdateRepositoryAction<LibraryEntity>,
|
||||
IDeleteByIdRepositoryAction<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all media libraries that are marked as enabled and unlocked, from the storage medium.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="LibraryEntity"/>, or an error.</returns>
|
||||
Task<ErrorOr<IEnumerable<LibraryEntity>>> GetAllEnabledAndUnlockedAsync(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all media libraries that are marked as enabled from the storage medium.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="LibraryEntity"/>, or an error.</returns>
|
||||
Task<ErrorOr<IEnumerable<LibraryEntity>>> GetAllEnabledAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
+5
-1
@@ -24,7 +24,11 @@ public static class AddMediaLibraryRequestMapping
|
||||
request.Title,
|
||||
request.LibraryType,
|
||||
request.ContentLocations,
|
||||
request.CoverImage
|
||||
request.CoverImage,
|
||||
request.IsEnabled,
|
||||
request.IsLocked,
|
||||
request.DownloadMedatadaFromWeb,
|
||||
request.SaveMetadataInMediaDirectories
|
||||
);
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -29,6 +29,10 @@ public static class LibraryEntityMapping
|
||||
repositoryEntity.LibraryType,
|
||||
repositoryEntity.ContentLocations.Select(location => location.Path).ToList(),
|
||||
repositoryEntity.CoverImage,
|
||||
repositoryEntity.IsEnabled,
|
||||
repositoryEntity.IsLocked,
|
||||
repositoryEntity.DownloadMedatadaFromWeb,
|
||||
repositoryEntity.SaveMetadataInMediaDirectories,
|
||||
repositoryEntity.CreatedOnUtc,
|
||||
repositoryEntity.UpdatedOnUtc
|
||||
);
|
||||
@@ -47,7 +51,11 @@ public static class LibraryEntityMapping
|
||||
repositoryEntity.Title,
|
||||
repositoryEntity.LibraryType,
|
||||
repositoryEntity.ContentLocations.Select(contentLocation => contentLocation.Path),
|
||||
repositoryEntity.CoverImage
|
||||
repositoryEntity.CoverImage,
|
||||
repositoryEntity.IsEnabled,
|
||||
repositoryEntity.IsLocked,
|
||||
repositoryEntity.DownloadMedatadaFromWeb,
|
||||
repositoryEntity.SaveMetadataInMediaDirectories
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ public static class LibraryMapping
|
||||
UserId = domainEntity.UserId.Value,
|
||||
ContentLocations = domainEntity.ContentLocations.Select(path => new LibraryContentLocationEntity() { Path = path.Path }).ToList(),
|
||||
CoverImage = domainEntity.CoverImage,
|
||||
IsEnabled = domainEntity.IsEnabled,
|
||||
IsLocked = domainEntity.IsLocked,
|
||||
DownloadMedatadaFromWeb = domainEntity.DownloadMedatadaFromWeb,
|
||||
SaveMetadataInMediaDirectories = domainEntity.SaveMetadataInMediaDirectories,
|
||||
CreatedOnUtc = domainEntity.CreatedOnUtc,
|
||||
CreatedBy = Guid.Empty,
|
||||
UpdatedOnUtc = domainEntity.UpdatedOnUtc.HasValue ? domainEntity.UpdatedOnUtc : null,
|
||||
|
||||
+5
-1
@@ -24,7 +24,11 @@ public static class UpdateLibraryRequestMapping
|
||||
request.Title,
|
||||
request.LibraryType,
|
||||
request.ContentLocations,
|
||||
request.CoverImage
|
||||
request.CoverImage,
|
||||
request.IsEnabled,
|
||||
request.IsLocked,
|
||||
request.DownloadMedatadaFromWeb,
|
||||
request.SaveMetadataInMediaDirectories
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user