Repositories gitConnections/brewGitLinks (Mongo/PG), Krypto, SSRF-Policy mit net.BlockList, git-Client ohne Arbeitskopie, Sync/Konflikte, /api/git/*, Client (Verbindungen, Git-Status, Konfliktdialog), Autosave 60 s für Git-Brews (F6), Tests und Doku. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Dev (Paperclip) <dev-bot@noreply.git.morlana.online>
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
import mongoose from 'mongoose';
|
|
import DB from '../../db.js';
|
|
import { createUserRepository } from './users.js';
|
|
import { createBrewRepository } from './brews.js';
|
|
import { createNotificationRepository } from './notifications.js';
|
|
import { createGitConnectionRepository, createBrewGitLinkRepository } from './git.js';
|
|
|
|
// Mongo-Implementierung der Storage-Schicht (ADR 0002). Ruft die Statics und Methoden der
|
|
// unveränderten Upstream-Modelle (homebrew.model.js, notifications.model.js) auf.
|
|
export const createMongoStorage = (config)=>{
|
|
const brews = createBrewRepository();
|
|
const notifications = createNotificationRepository();
|
|
let users;
|
|
let gitConnections;
|
|
let brewGitLinks;
|
|
return {
|
|
driver : 'mongo',
|
|
brews,
|
|
notifications,
|
|
async connect() {
|
|
await DB.connect(config);
|
|
if(!config.get('local_environments').includes(config.get('node_env'))) {
|
|
await this.users.Model.syncIndexes(); // nur Fork-Modelle, nie Homebrew
|
|
await this.gitConnections.Model.syncIndexes();
|
|
await this.brewGitLinks.Model.syncIndexes();
|
|
}
|
|
},
|
|
async disconnect() {
|
|
await DB.disconnect();
|
|
},
|
|
isReady() {
|
|
return mongoose.connection.readyState === 1;
|
|
},
|
|
get users() {
|
|
users ??= createUserRepository();
|
|
return users;
|
|
},
|
|
get gitConnections() {
|
|
gitConnections ??= createGitConnectionRepository();
|
|
return gitConnections;
|
|
},
|
|
get brewGitLinks() {
|
|
brewGitLinks ??= createBrewGitLinkRepository();
|
|
return brewGitLinks;
|
|
}
|
|
};
|
|
};
|