Enhance admin endpoints and queries for improved filtering and management
CI / Backend (build + test) (push) Successful in 1m22s
CI / Frontend (lint + typecheck + build) (push) Successful in 34s

- 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:
Leonid Pershin
2026-07-20 10:35:48 +03:00
parent e19860ba46
commit 33ad98cf62
37 changed files with 1115 additions and 124 deletions
@@ -53,7 +53,13 @@ public static class AdminBillingEndpoints
CancellationToken cancellationToken
)
{
var query = new ListPaymentRequestsQuery(request.Status, request.Page, request.PageSize);
var query = new ListPaymentRequestsQuery(
request.Status,
request.Kind,
request.Search,
request.Page,
request.PageSize
);
var result = await sender.Send(query, cancellationToken);
return result.ToHttpResult();
}
@@ -98,6 +104,8 @@ public static class AdminBillingEndpoints
public sealed record ListPaymentRequestsRequest(
PaymentRequestStatus? Status,
PaymentRequestKind? Kind,
string? Search,
int Page = 1,
int PageSize = 20
);
@@ -3,6 +3,7 @@ using PnvPanel.Application.Admin.Audit;
using PnvPanel.Application.Admin.Stats;
using PnvPanel.Application.Common.Messaging;
using PnvPanel.Application.Common.Models;
using PnvPanel.Domain.Audit;
using PnvPanel.Infrastructure.Identity;
namespace PnvPanel.Api.Endpoints;
@@ -30,11 +31,20 @@ public static class AdminStatsEndpoints
private static async Task<IResult> GetAudit(
int page,
int pageSize,
AuditSource? source,
string? targetType,
string? action,
ISender sender,
CancellationToken cancellationToken
)
{
var query = new ListAuditLogsQuery(page <= 0 ? 1 : page, pageSize <= 0 ? 50 : pageSize);
var query = new ListAuditLogsQuery(
page <= 0 ? 1 : page,
pageSize <= 0 ? 50 : pageSize,
source,
targetType,
action
);
var result = await sender.Send(query, cancellationToken);
return result.ToHttpResult();
}
@@ -6,6 +6,7 @@ using PnvPanel.Application.Common.Messaging;
using PnvPanel.Application.Common.Models;
using PnvPanel.Application.Configs;
using PnvPanel.Domain.Configs;
using PnvPanel.Domain.Inbounds;
using PnvPanel.Infrastructure.Identity;
namespace PnvPanel.Api.Endpoints;
@@ -44,11 +45,23 @@ public static class AdminUserEndpoints
int page,
int pageSize,
string? search,
Guid? roleId,
bool? isActivated,
bool? isBlocked,
bool? billingExpired,
ISender sender,
CancellationToken cancellationToken
)
{
var query = new ListUsersQuery(page <= 0 ? 1 : page, pageSize <= 0 ? 20 : pageSize, search);
var query = new ListUsersQuery(
page <= 0 ? 1 : page,
pageSize <= 0 ? 20 : pageSize,
search,
roleId,
isActivated,
isBlocked,
billingExpired
);
var result = await sender.Send(query, cancellationToken);
return result.ToHttpResult();
}
@@ -112,6 +125,8 @@ public static class AdminUserEndpoints
int pageSize,
string? search,
ConfigStatus? status,
VpnProtocol? protocol,
Guid? nodeId,
ISender sender,
CancellationToken cancellationToken
)
@@ -120,7 +135,9 @@ public static class AdminUserEndpoints
page <= 0 ? 1 : page,
pageSize <= 0 ? 20 : pageSize,
search,
status
status,
protocol,
nodeId
);
var result = await sender.Send(query, cancellationToken);
return result.ToHttpResult();
@@ -15,6 +15,7 @@ public static class InboundEndpoints
admin.MapGet("", ListInbounds).Produces<IReadOnlyList<InboundDto>>();
admin.MapPut("/{id:guid}/publish", PublishInbound).Produces<InboundDto>();
admin.MapDelete("/{id:guid}", DeleteInbound);
return app;
}
@@ -45,6 +46,16 @@ public static class InboundEndpoints
var result = await sender.Send(command, cancellationToken);
return result.ToHttpResult();
}
private static async Task<IResult> DeleteInbound(
Guid id,
ISender sender,
CancellationToken cancellationToken
)
{
var result = await sender.Send(new DeleteInboundCommand(id), cancellationToken);
return result.ToHttpResult();
}
}
public sealed record PublishInboundBody(