Separate responsibilities: start-listening command, API-side JSON converters, bulk track endpoints, mix kinds
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Api.Models;
|
||||
|
||||
/// <summary>Query-string binding for a genre name (case-insensitive); unknown names are rejected with a 400.</summary>
|
||||
public readonly record struct GenreParameter(Genre Value)
|
||||
{
|
||||
public static bool TryParse(string? value, out GenreParameter result)
|
||||
{
|
||||
if (Enum.TryParse<Genre>(value, ignoreCase: true, out var genre) && Enum.IsDefined(genre))
|
||||
{
|
||||
result = new GenreParameter(genre);
|
||||
return true;
|
||||
}
|
||||
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user