74704dbf5b364fabacedcce66a8cce3b1ba2b28b
User задаёт quiet window (e.g. 22:00–08:00 Europe/Moscow) — external channels (email + express) DROP'аются dispatcher'ом. In-app bell badge остаётся (юзер видит при следующем визите UI). Cross-midnight aware. ## Backend - Migration 0026: user_notification_settings table (user_id PK + quiet_hours_start/end LocalTime + tz) - Entity UserNotificationSettings + Repository (stock CRUD) - UserPreferencesGate extended: - Constructor takes settingsRepo - allows() checks isQuiet(userId) первым for external channels (EMAIL/EXPRESS/TELEGRAM) - isQuiet: load settings → if hasEffectiveQuietHours() → check current LocalTime в user's TZ - inWindow() helper: cross-midnight semantics (22:00–08:00 wraps midnight) - Invalid TZ → fallback к DEFAULT_TZ (Europe/Moscow) с WARN log - Test seam: setClockForTesting(Clock) для deterministic tests - MeNotificationsSettingsController: GET/PUT /api/v1/me/notifications/settings - HH:mm input parsing, IANA TZ validation, enabled=false clears window - Auth required (JWT sub claim) ## Frontend - NotificationSettings type в client.ts - useMyNotificationSettings query (60s stale) - useUpdateNotificationSettings mutation - QuietHoursSection в /me/notifications/preferences route: - Switch toggle + 2 time inputs + TZ select (12 RU/UTC zones) - Optimistic local state synced from query - Save button с pending/success/error states - i18n RU + EN ## Tests - 9 new tests UserPreferencesGateQuietHoursTest: - Same-day window match (inclusive start, exclusive end) - Cross-midnight window match (22:00–08:00) - No settings row → не блокирует - Quiet window active → email + express dropped - Outside window → email allowed - start == end → disabled (zero-duration treated as off) - Reviewer pool bypasses (always ON) - Invalid TZ → fallback default - Specific pref ON + quiet ON → quiet wins (drop) - NotificationsDispatcherTest constructor updated к new signature - Total notifications tests: 53 → 62, все green ## Design rationale (drop vs defer) Drop chosen за defer (queue + re-fire scheduler) потому что: - Defer needs persistent queue + scheduled retry — high complexity - Most notifications time-relevant (draft N hours ago less actionable) - Bell badge показывает full feed — ничего не «теряется» - Phase D summary digest можно build later если demand surfaces
Ordinis
MDM сервис для НСИ ЦУОД ОДХ (Оперативное и Долговременное Хранение). Часть линейки Terravault. Ордо/порядок (от лат. ordo) — упорядоченные классификаторы и справочные данные.
ЦУОД — anchor-клиент v1, второй клиент = свой config bundle, без code change.
Maven multimodule
ordinis/
├── ordinis-domain JPA entities, JSONB types, bitemporal model
├── ordinis-validation JSON Schema validator (networknt)
├── ordinis-events-api DTO для Kafka (semver shared module)
├── ordinis-outbox Outbox pattern + @Scheduled poller
├── ordinis-rest-api Admin write API (CRUD, bundle import)
├── ordinis-app Spring Boot main: writer side
├── ordinis-read-api Read service (PG replica + scope filtering)
├── ordinis-projection-writer Опц.: Kafka → Redis projection (feature-flagged)
├── ordinis-cuod-bundle ЦУОД config: JSON Schema, seed, Grafana dashboards
└── ordinis-migrations Liquibase changelogs → Helm pre-upgrade Job (1-shot)
Стек
- Java 21, Spring Boot 3.4
- PostgreSQL 18 + PostGIS 3.6 + btree_gist (EXCLUSION CONSTRAINT)
- Apache Kafka 4.2 (KRaft, SASL SCRAM-SHA-512)
- Hibernate Envers (tx-time) + valid_from/valid_to (effective-time) — bitemporal
- Liquibase
- Spring Cloud Config + Spring Cloud Vault (Kubernetes auth)
- Micrometer + Prometheus
- LogstashEncoder JSON stdout → Loki через Alloy
- OpenTelemetry → Tempo (OTLP gRPC)
Архитектурные принципы
- Generic dictionary engine + ЦУОД config bundle (Approach B). Engine не знает про "КА"/"наземные станции" — узнаёт через JSON Schema из bundle
- Bitemporal: Envers для tx-time + valid_from/valid_to для effective-time + EXCLUSION CONSTRAINT
- 3 scope-топика Kafka (
public/internal/restricted) — изоляция через ACL, не через filter в consumer - System boundary: 3 deployable делят БД (master+replica). Внешние consumers — только REST/Kafka, никогда прямо в БД
- Tiered performance: 1k RPS из коробки (PG replica + Caffeine). 10k+ RPS включается per-dictionary через Redis projection
- Audit log в БД (compliance), технические логи в Loki
Build
mvn clean install # все модули
mvn -pl ordinis-app -am package -DskipTests # только app + transitive
docker build -f ordinis-app/Dockerfile -t ordinis-app:0.1.0 .
docker build -f ordinis-migrations/Dockerfile -t ordinis-migrations:0.1.0 ordinis-migrations/
Связанные репо
- terravault/ordinis-infra — k8s манифесты, helm values
- terravault/ordinis-config — Spring Cloud Config (feature flags, business params)
Description
Languages
TypeScript
49.7%
Java
43.7%
HTML
5.5%
CSS
0.7%
Dockerfile
0.3%