Refactor client update handling to support nullable parameters for name and expiration
CI / Backend (build + test) (push) Successful in 1m18s
CI / Frontend (lint + typecheck + build) (push) Successful in 59s

- Updated the `UpdateClientAsync` method in `IXuiPanelGateway` to accept nullable parameters for `name` and `expiresAt`, allowing for more flexible client management without unintended modifications.
- Adjusted the `BlockUserCommandHandler`, `UnblockUserCommandHandler`, and other related command handlers to utilize the new nullable parameters, ensuring that client names remain unchanged during block/unblock operations and that expiration dates are managed correctly.
- Enhanced the billing and configuration handling to reflect the new logic for managing client states based on expiration rather than enabling/disabling, improving reliability in client status management.
- Updated tests to cover the new behavior and ensure proper functionality across the application.
This commit is contained in:
Leonid Pershin
2026-07-19 18:58:36 +03:00
parent 5ff5224935
commit 979eddf72e
20 changed files with 282 additions and 29 deletions
@@ -42,13 +42,17 @@ public sealed class BlockUserCommandHandler(
if (inbound is not null && node is not null)
{
// name: null — не трогаем текущее имя клиента в панели, это не переименование.
// expiresAt: null — блокировка админом отдельная ось от биллинга (см.
// IXuiPanelGateway.UpdateClientAsync), срок оплаты не трогаем.
var updateResult = await gateway.UpdateClientAsync(
node,
inbound.RemoteInboundId,
config.ClientExternalId,
config.Protocol,
config.Label ?? config.ClientEmail,
name: null,
enable: false,
expiresAt: null,
cancellationToken
);