- Replace 4 duplicate meta DTOs (AuthResponseMetaDto, PortfolioResponseMetaDto, BrokerResponseMetaDto, ScreenerResponseMetaDto) with shared ApiResponseMeta - Wrap shares getShare() in ApiEnvelopePayload (was raw object, unlike bonds) - Remove unnecessary CacheModule import from securities module - Update portfolio controller nullDataEnvelopeSchema to use shared ApiResponseMeta - All 116 tests pass
54 lines
2.9 KiB
Markdown
54 lines
2.9 KiB
Markdown
# Backend Architecture Improvements — Tasks
|
||
|
||
## Итерация 1: Shared envelope DTO + consistency fixes ✅
|
||
|
||
- [x] 1.1 Создать документ аудита в `docs/research/`
|
||
- [x] 1.2 Вынести `ApiResponseMeta` в `common/dto/api-response.dto.ts` как единый shared класс
|
||
- [x] 1.3 Заменить `AuthResponseMetaDto` на `ApiResponseMeta` в `auth/`
|
||
- [x] 1.4 Заменить `PortfolioResponseMetaDto` на `ApiResponseMeta` в `portfolio/`
|
||
- [x] 1.5 Заменить `BrokerResponseMetaDto` на `ApiResponseMeta` в `tbank/`
|
||
- [x] 1.6 Поправить `shares/shares.service.ts:getShare()` — обернуть в `ApiEnvelopePayload`
|
||
- [x] 1.7 Убрать лишний импорт `CacheModule` из `securities/securities.module.ts`
|
||
- [x] 1.8 Удалить дублирующиеся envelope DTO (`ScreenerResponseMetaDto`, `AuthResponseMetaDto`, `PortfolioResponseMetaDto`, `BrokerResponseMetaDto`)
|
||
- [x] 1.9 `npm run build` успешен, 116 тестов проходят
|
||
|
||
## Итерация 2: Screener caching
|
||
|
||
- [ ] 2.1 Добавить `getFullDataset()` метод в `ScreenerService` с кешированием
|
||
- [ ] 2.2 Использовать кеш в `screen()` при пустых фильтрах
|
||
- [ ] 2.3 Тесты на кеширование screener'а
|
||
|
||
## Итерация 3: Domain exceptions
|
||
|
||
- [ ] 3.1 Создать `common/exceptions/domain.exception.ts`
|
||
- [ ] 3.2 Создать `common/exceptions/entity-not-found.exception.ts`
|
||
- [ ] 3.3 Создать `common/exceptions/moex-api.exception.ts`
|
||
- [ ] 3.4 Создать `common/exceptions/tbank-api.exception.ts`
|
||
- [ ] 3.5 Создать `common/exceptions/portfolio-access.exception.ts`
|
||
- [ ] 3.6 Обновить `HttpExceptionFilter` для доменных исключений
|
||
- [ ] 3.7 Заменить generic исключения в сервисах на доменные
|
||
- [ ] 3.8 Тесты на фильтр + исключения
|
||
|
||
## Итерация 4: Health check
|
||
|
||
- [ ] 4.1 Добавить `PrismaHealthIndicator` в `health/`
|
||
- [ ] 4.2 Добавить `MoexHealthIndicator`
|
||
- [ ] 4.3 Добавить `TBankHealthIndicator`
|
||
- [ ] 4.4 Обновить `HealthResponseDto` с `checks`
|
||
- [ ] 4.5 Тесты health module
|
||
|
||
## Итерация 5: RequestLoggingMiddleware DI
|
||
|
||
- [ ] 5.1 Переписать подключение через `configure()` в `AppModule`
|
||
- [ ] 5.2 Убрать `app.use()` из `main.ts`
|
||
|
||
## Итерация 6: MoexClientService split (отдельный эпик)
|
||
|
||
- [ ] 6.1 ADR на разделение MoexClientService
|
||
- [ ] 6.2 spec/plan/tasks отдельного эпика
|
||
- [ ] 6.3 Выделение rate limiter + circuit breaker в shared utils
|
||
- [ ] 6.4 Создание MoexSecuritiesClient
|
||
- [ ] 6.5 Создание MoexMarketDataClient
|
||
- [ ] 6.6 Создание MoexCandlesClient
|
||
- [ ] 6.7 Обновление всех потребителей
|