Extends the music library listings with covers, sorting and alpha filtering.

This commit is contained in:
BinaryAlley committed 2026-10-13 13:26:14 +03:00
1 parent 0019821e87
commit 9d82f283e4
69 files changed
+3613 -268

No files matched your search

@@ -1,6 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -15,6 +16,9 @@ namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.Music
[ExcludeFromCodeCoverage]
public class AlbumLiteRowFixture
{
private const int MINIMUM_RELEASE_YEAR = 1900;
private const int MAXIMUM_RELEASE_YEAR = 2026;
private readonly Faker _faker = new();
/// <summary>
@@ -23,17 +27,32 @@ public class AlbumLiteRowFixture
/// <param name="id">Optional. The Id of the album.</param>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="totalTracks">Optional. The number of tracks of the release.</param>
/// <param name="coverPath">Optional. The path of the image representing the album.</param>
/// <param name="releaseYear">Optional. The release year of the album.</param>
/// <param name="releaseTypes">Optional. The set of types of the release.</param>
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseYear">Whether the release year should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseTypes">Whether the release types should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="AlbumLiteRow"/>.</returns>
public AlbumLiteRow Create(
Guid? id = null,
string? title = null,
int? totalTracks = null)
int? totalTracks = null,
string? coverPath = null,
int? releaseYear = null,
List<MusicReleaseType>? releaseTypes = null,
bool includeCoverPath = true,
bool includeReleaseYear = true,
bool includeReleaseTypes = true)
{
return new AlbumLiteRow
{
Id = id ?? _faker.Random.Guid(),
Title = title ?? _faker.Music.Genre(),
TotalTracks = totalTracks ?? _faker.Random.Int(1, 30)
TotalTracks = totalTracks ?? _faker.Random.Int(1, 30),
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
ReleaseYear = includeReleaseYear ? (releaseYear ?? _faker.Random.Int(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR)) : null,
ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(index => _faker.PickRandom<MusicReleaseType>())]) : null
};
}
@@ -22,15 +22,20 @@ public class ArtistLiteRowFixture
/// </summary>
/// <param name="id">Optional. The Id of the artist.</param>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="coverPath">Optional. The path of the image representing the artist.</param>
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="ArtistLiteRow"/>.</returns>
public ArtistLiteRow Create(
Guid? id = null,
string? name = null)
string? name = null,
string? coverPath = null,
bool includeCoverPath = true)
{
return new ArtistLiteRow
{
Id = id ?? _faker.Random.Guid(),
Name = name ?? _faker.Name.FullName()
Name = name ?? _faker.Name.FullName(),
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
};
}
@@ -25,20 +25,23 @@ public class TrackLiteRowFixture
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
/// <returns>The created <see cref="TrackLiteRow"/>.</returns>
public TrackLiteRow Create(
Guid? id = null,
string? title = null,
int? trackNumber = null,
int? discNumber = null,
bool includeDiscNumber = true)
bool includeDiscNumber = true,
int? durationInSeconds = null)
{
return new TrackLiteRow
{
Id = id ?? _faker.Random.Guid(),
Title = title ?? _faker.Lorem.Sentence(),
TrackNumber = trackNumber ?? _faker.Random.Int(1, 30),
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
DurationInSeconds = durationInSeconds ?? _faker.Random.Int(1, 600)
};
}
@@ -3,6 +3,7 @@ using Bogus;
using Lumina.Application.Common.DTO.Pagination;
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite;
using Lumina.Application.Fixtures.Common.DTO.Pagination;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -26,6 +27,10 @@ public class GetArtistsLiteQueryFixture
/// <param name="libraryId">Optional. The Id of the media library whose artists are retrieved, taken from the route.</param>
/// <param name="paginationData">Optional. The pagination data of the query.</param>
/// <param name="searchTerm">Optional. The search term used to filter the artists by name.</param>
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker.</param>
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.</param>
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includePaginationData">Whether the pagination data should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSearchTerm">Whether the search term should be included, or forced to <see langword="null"/>.</param>
@@ -34,6 +39,10 @@ public class GetArtistsLiteQueryFixture
string? libraryId = null,
PaginationDataDto? paginationData = null,
string? searchTerm = null,
string? filterAlphaKey = null,
bool shouldIgnoreThePrefixForAlphaPicker = false,
string? sortBy = null,
SortOrder? sortOrder = null,
bool includeLibraryId = true,
bool includePaginationData = true,
bool includeSearchTerm = true)
@@ -41,7 +50,11 @@ public class GetArtistsLiteQueryFixture
return new GetArtistsLiteQuery(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null,
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null,
filterAlphaKey,
shouldIgnoreThePrefixForAlphaPicker,
sortBy ?? _faker.Lorem.Word(),
sortOrder ?? _faker.PickRandom<SortOrder>());
}
/// <summary>