docs: sync from backend 515bea3 — guard dataCleanupService against MONGO_CONNECT_MODE=never

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-06-02 13:47:01 +04:00
parent 4196c119ea
commit 476aac2b08

View File

@@ -462,4 +462,13 @@ run end-to-end (require live `ADMIN_TOKEN`).
--- ---
### 2026-06-02 — backend@515bea3 — guard dataCleanupService against MONGO_CONNECT_MODE=never
**Commits:** `515bea3`
**Touched:** `src/services/admin/dataCleanupService.ts`
**Why:** dataCleanupService dynamically imported 10 Mongoose models unconditionally; under MONGO_CONNECT_MODE=never this throws at runtime. Routed user counts through AuthUser facade (Postgres-gated). Wrapped all other model access in isMongoAvailable() guard — cleanup ops return a safe error result when MongoDB is disconnected.
**Verification:** 5 test suites 11 tests pass. typecheck clean. Mongo scan: all remaining hits confirmed inside Postgres-gated fallback branches.
**Linked docs updated:** none.
---
<!-- Add new entries above this line. Newest at top. --> <!-- Add new entries above this line. Newest at top. -->