Change editor rule
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
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)
|
||||
namespace Musify.Api.Models
|
||||
{
|
||||
public static bool TryParse(string? value, out GenreParameter result)
|
||||
/// <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)
|
||||
{
|
||||
if (Enum.TryParse<Genre>(value, ignoreCase: true, out var genre) && Enum.IsDefined(genre))
|
||||
public static bool TryParse(string? value, out GenreParameter result)
|
||||
{
|
||||
result = new GenreParameter(genre);
|
||||
return true;
|
||||
}
|
||||
if (Enum.TryParse<Genre>(value, ignoreCase: true, out var genre) && Enum.IsDefined(genre))
|
||||
{
|
||||
result = new GenreParameter(genre);
|
||||
return true;
|
||||
}
|
||||
|
||||
result = default;
|
||||
return false;
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Musify.Application.Shared;
|
||||
|
||||
namespace Musify.Api.Models;
|
||||
|
||||
/// <summary>Query-string binding for <see cref="PageRequest"/>, keeping the camelCase parameter names of the API.</summary>
|
||||
public record PageQuery(
|
||||
[property: FromQuery(Name = "pageNumber")] int PageNumber = 1,
|
||||
[property: FromQuery(Name = "pageSize")] int PageSize = 20);
|
||||
namespace Musify.Api.Models
|
||||
{
|
||||
/// <summary>Query-string binding for <see cref="PageRequest"/>, keeping the camelCase parameter names of the API.</summary>
|
||||
public record PageQuery(
|
||||
[property: FromQuery(Name = "pageNumber")] int PageNumber = 1,
|
||||
[property: FromQuery(Name = "pageSize")] int PageSize = 20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user