Enhance admin endpoints and queries for improved filtering and management
- Updated `ListPaymentRequestsQuery` to include `Kind` and `Search` parameters for better filtering of payment requests. - Enhanced `ListAuditLogsQuery` to support additional filters: `Source`, `TargetType`, and `Action`, improving audit log retrieval. - Modified `ListUsersQuery` to accept new filters: `RoleId`, `IsActivated`, `IsBlocked`, and `BillingExpired`, allowing for more granular user management. - Introduced `DeleteInbound` endpoint to allow deletion of inbounds that are not currently available, enhancing inbound management capabilities. - Updated frontend API calls to reflect new query parameters and support for additional filtering options in the admin interface. - Revised API documentation to include new parameters and endpoint functionalities for better clarity and usage guidance.
This commit is contained in:
@@ -21,6 +21,18 @@ public sealed class ListPaymentRequestsQueryHandler(
|
||||
var requestsQuery = dbContext.PaymentRequests.AsNoTracking();
|
||||
if (query.StatusFilter is { } status)
|
||||
requestsQuery = requestsQuery.Where(r => r.Status == status);
|
||||
if (query.KindFilter is { } kind)
|
||||
requestsQuery = requestsQuery.Where(r => r.Kind == kind);
|
||||
if (!string.IsNullOrWhiteSpace(query.Search))
|
||||
{
|
||||
// PaymentRequest хранит только UserId — резолвим совпадающих пользователей ДО пагинации
|
||||
// (иначе "поиск по имени" фильтровал бы уже отобранную страницу, а не весь набор).
|
||||
var matchingUserIds = await identityService.FindUserIdsByUserNameAsync(
|
||||
query.Search.Trim(),
|
||||
cancellationToken
|
||||
);
|
||||
requestsQuery = requestsQuery.Where(r => matchingUserIds.Contains(r.UserId));
|
||||
}
|
||||
|
||||
var page1 = await requestsQuery
|
||||
.OrderByDescending(r => r.CreatedAt)
|
||||
|
||||
Reference in New Issue
Block a user