Implement billing status notification and enhance user management integration
- Added `NotifyBillingStatusChangedAsync` method to `IRealtimeNotifier` for notifying clients about changes in billing status. - Updated `BillingConfigResumer` to call the new notification method after modifying billing configurations, ensuring users receive real-time updates. - Enhanced `ListUsersQueryHandler` to include a `BillingPendingReview` property in `UserSummaryDto`, indicating if a user has a pending payment request awaiting confirmation. - Refactored various command handlers to utilize `AdvisoryLock` for managing concurrent requests, preventing race conditions in billing operations. - Updated tests to cover new notification behaviors and ensure proper functionality in billing status management.
This commit is contained in:
1 parent
b32756d5bc
commit
e19860ba46
49 files changed
+1195
-233
No files matched your search
@@ -51,17 +51,27 @@ public sealed class Inbound : Entity
|
||||
Remark = remark;
|
||||
Port = port;
|
||||
LastSyncAt = DateTimeOffset.UtcNow;
|
||||
// Инбаунд снова пришёл в синхронизации — значит панель его видит, снимаем MarkUnavailable()
|
||||
// (иначе после ЛЮБОГО временного сбоя синка — не только реального удаления — Revoke навсегда
|
||||
// пропускал бы обращение к панели для конфигов на этом инбаунде, хотя клиент в панели жив).
|
||||
IsAvailable = true;
|
||||
}
|
||||
|
||||
public void Publish(string? displayName, IReadOnlyCollection<Guid> allowedRoleIds)
|
||||
{
|
||||
IsPublished = true;
|
||||
IsAvailable = true;
|
||||
DisplayName = displayName;
|
||||
AllowedRoleIds = allowedRoleIds.Distinct().ToList();
|
||||
}
|
||||
|
||||
public void Unpublish() => IsPublished = false;
|
||||
|
||||
/// <summary>Роль удалена админом — снимаем её из списка разрешённых, чтобы не оставлять ссылку на
|
||||
/// несуществующую роль (иначе она навсегда "съедала" бы место в списке, ни на что не влияя, но и
|
||||
/// не позволяя понять, что инбаунд стал доступен меньшему числу ролей, чем задумано).</summary>
|
||||
public void RemoveAllowedRole(Guid roleId) => AllowedRoleIds = AllowedRoleIds.Where(id => id != roleId).ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Инбаунд пропал на панели (не пришёл в очередной синхронизации), но по нему есть конфиги —
|
||||
/// удалить запись нельзя (FK), поэтому помечаем недоступной вместо тихого "не опубликован":
|
||||
|
||||
Reference in new issue
Block a user