CI/CD / BackEnd (push) Successful in 1m22s
CI/CD / WebPlayer (push) Successful in 38s
CI/CD / Deploy (push) Skipped
CI/CD / BackEnd (pull_request) Successful in 1m21s
CI/CD / WebPlayer (pull_request) Successful in 40s
CI/CD / Deploy (pull_request) Skipped
Discover used a hardcoded list of genre tiles that searched track titles, and the upload form kept its own copy of the genre list and compatibility rules. Both now come from the backend. Backend: - GET /genres returns genres with at least one track and their counts. - GET /genres/available returns every assignable genre with the genres it cannot be combined with, so the rules live only in GenreCompatibility. - GET /tracks accepts ?genre= (case-insensitive, 400 on unknown values). web-player: - Discover tiles are built from /genres; each opens /explore?genre=X, a song list filtered by that tag. Unknown genres fall back to a label derived from their name. - The upload form loads /genres/available, disables incompatible genres as you pick, and the server validates before reserving upload URLs. - lib/data/trackGenres.ts is removed; its helpers merge into lib/data/genres.ts. - Regenerate the typed API client.
27 lines
962 B
C#
27 lines
962 B
C#
using Mediator;
|
|
using Musify.Domain.ValueObjects;
|
|
|
|
namespace Musify.Application.Genres
|
|
{
|
|
public record GetAvailableGenresQuery : IQuery<IReadOnlyList<AvailableGenreResponse>>;
|
|
|
|
public record AvailableGenreResponse(Genre Genre, IReadOnlyList<Genre> IncompatibleWith);
|
|
|
|
public class GetAvailableGenresQueryHandler
|
|
: IQueryHandler<GetAvailableGenresQuery, IReadOnlyList<AvailableGenreResponse>>
|
|
{
|
|
public ValueTask<IReadOnlyList<AvailableGenreResponse>> Handle(GetAvailableGenresQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var all = Enum.GetValues<Genre>();
|
|
|
|
IReadOnlyList<AvailableGenreResponse> result = all
|
|
.Select(genre => new AvailableGenreResponse(
|
|
genre,
|
|
all.Where(other => !GenreCompatibility.AreCompatible(genre, other)).ToList()))
|
|
.ToList();
|
|
|
|
return ValueTask.FromResult(result);
|
|
}
|
|
}
|
|
}
|