refactor(storage): Upstream-Aufrufstellen auf getStorage().brews/notifications umgestellt (ADR 0002 §4)
Mechanischer Ersatz der Datenzugriffe, Wartungsjobs unter Postgres mit 501. Specs minimal angepasst (_id -> id, Mocks). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a55c403527
commit
23d9b83567
8 files changed
+119
-243
No files matched your search
@@ -1,15 +1,16 @@
|
||||
import mongoose from 'mongoose';
|
||||
import config from '../config.js';
|
||||
import { getStorage } from '../storage/index.js';
|
||||
|
||||
export default (req, res, next)=>{
|
||||
// Bypass DB checks during testing
|
||||
if(config.get('node_env') == 'test') return next();
|
||||
|
||||
if(mongoose.connection.readyState == 1) return next();
|
||||
// [fork] ADR-0002: aktives Storage-Backend (Mongo oder Postgres) statt mongoose.connection.readyState
|
||||
if(getStorage().isReady()) return next();
|
||||
throw {
|
||||
HBErrorCode : '13',
|
||||
name : 'Database Connection Error',
|
||||
message : 'Unable to connect to database',
|
||||
status : mongoose.connection.readyState
|
||||
status : 0
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user