mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12: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
@@ -7,6 +7,7 @@ using Lumina.Domain.Common.Errors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -58,6 +59,32 @@ internal sealed class LibraryRepository : ILibraryRepository
|
||||
.FirstOrDefaultAsync(library => library.Id == id, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
public async Task<ErrorOr<IEnumerable<LibraryEntity>>> GetAllEnabledAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return await _luminaDbContext.Libraries
|
||||
.Include(library => library.ContentLocations)
|
||||
.Where(library => library.IsEnabled)
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
public async Task<ErrorOr<IEnumerable<LibraryEntity>>> GetAllEnabledAndUnlockedAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return await _luminaDbContext.Libraries
|
||||
.Include(library => library.ContentLocations)
|
||||
.Where(library => library.IsEnabled && !library.IsLocked)
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all media libraries.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user