Enhance inbound management by removing MaxClients property
- 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:
+23
-4
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user