Refactor AdminUserEndpoints and MediaEndpoints to include default parameter values for pagination and filtering, improving API usability. Update ManualInboxDialog to enhance show selection logic with auto-detection based on file names, and improve user feedback with new translations. Refactor PostgresFixture for better container management in integration tests.
This commit is contained in:
@@ -32,16 +32,20 @@ public static class AdminUserEndpoints
|
||||
return app;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Все параметры со значениями по умолчанию: обязательный <c>bool</c> в query превращает
|
||||
/// запрос без него в 400 ещё до хендлера — ошибку в таком виде отладить тяжело.
|
||||
/// </summary>
|
||||
private static async Task<IResult> ListUsers(
|
||||
int page,
|
||||
int pageSize,
|
||||
string? search,
|
||||
Guid? roleId,
|
||||
bool? isBlocked,
|
||||
string? sort,
|
||||
bool desc,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
CancellationToken cancellationToken,
|
||||
int page = 1,
|
||||
int pageSize = 20,
|
||||
string? search = null,
|
||||
Guid? roleId = null,
|
||||
bool? isBlocked = null,
|
||||
string? sort = null,
|
||||
bool desc = false
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(
|
||||
|
||||
@@ -109,15 +109,20 @@ public static class MediaEndpoints
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Все параметры со значениями по умолчанию: обязательный <c>bool</c> в query заставлял
|
||||
/// минимальный API отвечать 400 на запросы без него — например, из выборок «все готовые ассеты»,
|
||||
/// которым сортировка не нужна.
|
||||
/// </summary>
|
||||
private static async Task<IResult> List(
|
||||
int page,
|
||||
int pageSize,
|
||||
MediaAssetStatus[]? status,
|
||||
string? search,
|
||||
string? sort,
|
||||
bool desc,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
CancellationToken cancellationToken,
|
||||
int page = 1,
|
||||
int pageSize = 20,
|
||||
MediaAssetStatus[]? status = null,
|
||||
string? search = null,
|
||||
string? sort = null,
|
||||
bool desc = false
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(
|
||||
|
||||
@@ -74,6 +74,8 @@ public sealed class GetShowQueryHandler(IAppDbContext dbContext)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Сортировка идёт до сборки DTO: по свойству record'а EF порядок не переводит и падает
|
||||
// на компиляции запроса («The LINQ expression could not be translated»).
|
||||
var collections = await dbContext
|
||||
.CollectionItems.AsNoTracking()
|
||||
.Where(i => i.ShowId == show.Id)
|
||||
@@ -82,9 +84,15 @@ public sealed class GetShowQueryHandler(IAppDbContext dbContext)
|
||||
item => item.CollectionId,
|
||||
collection => collection.Id,
|
||||
(item, collection) =>
|
||||
new ShowCollectionRefDto(collection.Id, collection.Name, item.Position)
|
||||
new
|
||||
{
|
||||
collection.Id,
|
||||
collection.Name,
|
||||
item.Position,
|
||||
}
|
||||
)
|
||||
.OrderBy(c => c.Name)
|
||||
.Select(c => new ShowCollectionRefDto(c.Id, c.Name, c.Position))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return Result.Success(
|
||||
|
||||
Reference in New Issue
Block a user