Refactor messaging system to utilize LiteCqrs library
CI / Backend (build + test) (push) Failing after 1m28s
CI / Frontend (lint + typecheck + build) (push) Successful in 47s

- Replaced instances of the previous messaging system with LiteCqrs across various application components, enhancing the CQRS implementation.
- Updated dependency injection to register LiteCqrs services and behaviors, streamlining command and query handling.
- Adjusted multiple command and query handlers to align with the new messaging framework, ensuring consistent functionality and improved maintainability.
- Added LiteCqrs package reference in the project file for better dependency management.
This commit is contained in:
Leonid Pershin
2026-07-24 04:16:38 +03:00
parent 4e1b63645f
commit b05b76f32f
266 changed files with 577 additions and 641 deletions
+7 -4
View File
@@ -98,10 +98,13 @@ backend/
- **Rich domain model**: инварианты в сущностях (приватные сеттеры, фабричные методы `Node.Register(...)`,
поведенческие методы `config.Revoke()`), а не анемичные DTO-сущности.
- **CQRS через собственный диспетчер**: хендлеры реализуют `ICommandHandler<TCommand,TResult>` /
`IQueryHandler<,>`; `ISender` резолвит их из DI и прогоняет через `IPipelineBehavior<,>`
(`ValidationBehavior` `LoggingBehavior``UnitOfWorkBehavior`). Без внешних CQRS-библиотек, без
доменных событий — хендлер сам вызывает нужные порты (realtime/Telegram/аудит) синхронно.
- **CQRS через [LiteCqrs.Net](https://github.com/mrleo1nid/LiteCqrs.Net)** (собственная лёгкая
CQRS-библиотека, не MediatR — сосед-репозиторий, пока подключён `ProjectReference`'ом): хендлеры
реализуют `ICommandHandler<TCommand,TResult>` / `IQueryHandler<,>`; `ISender` резолвит их из DI и
прогоняет через `IPipelineBehavior<,>` (`LoggingBehavior``ValidationBehavior`
`RequireActivationBehavior``UnitOfWorkBehavior`, порядок задан в `AddLiteCqrs(...)`). Без
доменных событий — хендлер сам вызывает нужные порты (realtime/Telegram/аудит) синхронно;
библиотека умеет Notifications/pub-sub, но PnvPanel их не использует.
- **Порты в Application, адаптеры в Infrastructure/Api**: никакого `Npgsql`/`SignalR`/`ThreeXui.Net` в
Application/Domain — только интерфейсы, реализации могут жить и в `Infrastructure`, и в `Api`
(`IRealtimeNotifier` реализован в `Api/Hubs`, т.к. завязан на `IHubContext<PanelHub>`).