Enhance inbound management by removing MaxClients property
CI / Backend (build + test) (push) Successful in 1m23s
CI / Frontend (lint + typecheck + build) (push) Successful in 34s

- Removed the MaxClients property from Inbound-related data models, including InboundDto and PublishInboundCommand.
- Updated related methods and handlers to reflect the removal of MaxClients, ensuring consistent behavior across the application.
- Adjusted API documentation and frontend components to remove references to MaxClients, streamlining the inbound publishing process.
- Enhanced logging in command handlers to handle node unavailability scenarios during user actions.
- Improved database schema and migrations to align with the updated data model.
This commit is contained in:
Leonid Pershin
2026-07-14 23:11:50 +03:00
parent bef3880593
commit 8f6807a456
34 changed files with 1150 additions and 77 deletions
@@ -1,5 +1,7 @@
using Microsoft.Extensions.Logging;
using NSubstitute;
using PnvPanel.Application.Common.Interfaces;
using PnvPanel.Application.Common.Models;
using PnvPanel.Application.Configs;
using PnvPanel.Application.Configs.Revoke;
using PnvPanel.Application.Tests.TestSupport;
@@ -14,6 +16,9 @@ public class RevokeVpnConfigCommandHandlerTests
{
private readonly IXuiPanelGateway _gateway = Substitute.For<IXuiPanelGateway>();
private readonly IRealtimeNotifier _notifier = Substitute.For<IRealtimeNotifier>();
private readonly ILogger<RevokeVpnConfigCommandHandler> _logger = Substitute.For<
ILogger<RevokeVpnConfigCommandHandler>
>();
[Fact]
public async Task Handle_WhenActiveConfigOwnedByUser_RevokesRemovesRemoteClientAndNotifies()
@@ -36,11 +41,22 @@ public class RevokeVpnConfigCommandHandlerTests
dbContext.VpnConfigs.Add(config);
await dbContext.SaveChangesAsync(CancellationToken.None);
_gateway
.RemoveClientAsync(
Arg.Any<PnvPanel.Domain.Nodes.Node>(),
Arg.Any<string>(),
Arg.Any<string>(),
Arg.Any<VpnProtocol>(),
Arg.Any<CancellationToken>()
)
.Returns(Result.Success());
var handler = new RevokeVpnConfigCommandHandler(
dbContext,
_gateway,
_notifier,
FakeCurrentUser.Authenticated(userId)
FakeCurrentUser.Authenticated(userId),
_logger
);
var result = await handler.Handle(
@@ -87,7 +103,8 @@ public class RevokeVpnConfigCommandHandlerTests
dbContext,
_gateway,
_notifier,
FakeCurrentUser.Authenticated(userId)
FakeCurrentUser.Authenticated(userId),
_logger
);
var result = await handler.Handle(
@@ -117,7 +134,8 @@ public class RevokeVpnConfigCommandHandlerTests
dbContext,
_gateway,
_notifier,
FakeCurrentUser.Authenticated(userId)
FakeCurrentUser.Authenticated(userId),
_logger
);
var result = await handler.Handle(
@@ -138,7 +156,8 @@ public class RevokeVpnConfigCommandHandlerTests
dbContext,
_gateway,
_notifier,
FakeCurrentUser.Anonymous()
FakeCurrentUser.Anonymous(),
_logger
);
var result = await handler.Handle(