Add UploadLimits service and refactor user and media listing endpoints to use filter records for improved parameter handling. Update audio upload logic to streamline parameter passing and enhance clarity. Adjust ImageEndpoints to use HashSet for allowed extensions, and refine StreamingEndpoints to clarify token handling.
ci / build-backend (push) Successful in 1m29s
ci / build-frontend (push) Successful in 51s
ci / tests (push) Successful in 2m1s
ci / sonar (push) Successful in 4m22s

This commit is contained in:
Leonid Pershin
2026-07-26 23:05:37 +03:00
parent 0f0657e523
commit 69d1319564
7 changed files with 108 additions and 58 deletions
@@ -32,31 +32,21 @@ public static class AdminUserEndpoints
return app;
}
/// <summary>
/// Все параметры со значениями по умолчанию: обязательный <c>bool</c> в query превращает
/// запрос без него в 400 ещё до хендлера — ошибку в таком виде отладить тяжело.
/// </summary>
private static async Task<IResult> ListUsers(
[AsParameters] ListUsersFilter filter,
ISender sender,
CancellationToken cancellationToken,
int page = 1,
int pageSize = 20,
string? search = null,
Guid? roleId = null,
bool? isBlocked = null,
string? sort = null,
bool desc = false
CancellationToken cancellationToken
)
{
var result = await sender.Send(
new ListUsersQuery(
page <= 0 ? 1 : page,
pageSize <= 0 ? 20 : pageSize,
search,
roleId,
isBlocked,
sort,
desc
filter.Page is > 0 ? filter.Page.Value : 1,
filter.PageSize is > 0 ? filter.PageSize.Value : 20,
filter.Search,
filter.RoleId,
filter.IsBlocked,
filter.Sort,
filter.Desc ?? false
),
cancellationToken
);
@@ -126,6 +116,22 @@ public static class AdminUserEndpoints
}
}
/// <summary>
/// Фильтр и страница списка пользователей. Все поля nullable намеренно: обязательный параметр в query
/// превращает запрос без него в 400 ещё до хендлера — ошибку в таком виде отладить тяжело. Умолчания
/// подставляет сам хендлер, а не объявление: при <c>AsParameters</c> обязательность определяется
/// nullable-типом, а не наличием значения по умолчанию в конструкторе.
/// </summary>
public sealed record ListUsersFilter(
int? Page,
int? PageSize,
string? Search,
Guid? RoleId,
bool? IsBlocked,
string? Sort,
bool? Desc
);
public sealed record CreateUserBody(string UserName, string Password, Guid RoleId);
public sealed record ResetPasswordBody(string NewPassword);