- Add board_channel_links table to db.js with CRUD helpers

- Add mm_file_id column to images table for dedup tracking
- mm-pull fetches posts from MM API, downloads media files, uploads with LOD to MinIO
- Register bridge routes in server.js under /api/boards
This commit is contained in:
Hiren Kangad
2026-03-09 23:34:42 +05:30
parent 86ae4dacd8
commit 7f6c9cd409
4 changed files with 771 additions and 4 deletions
+15
View File
@@ -71,12 +71,14 @@ const collectionRoutes = require('./routes/collections');
const boardRoutes = require('./routes/boards');
const uploadRoutes = require('./routes/upload');
const adminRoutes = require('./routes/admin');
const mmBridgeRoutes = require('./routes/mattermost-bridge');
app.use('/api/auth', authRoutes);
app.use('/api/collections', collectionRoutes);
app.use('/api/boards', boardRoutes);
app.use('/api/upload', uploadRoutes);
app.use('/api/admin', adminRoutes);
app.use('/api/boards', mmBridgeRoutes);
// Public shared collection route (no auth required)
app.get('/api/c/:shareToken', (req, res) => {
@@ -136,6 +138,14 @@ async function start() {
console.error('[server] Image uploads will not work until MinIO is available');
}
// Start Mattermost auto-sync watcher (no-op if env vars missing)
try {
const { startWatcher } = require('./services/mm-watcher');
startWatcher(io);
} catch (err) {
console.error('[server] MM watcher failed to start:', err.message);
}
server.listen(PORT, '0.0.0.0', () => {
console.log(`[server] RefBoard backend listening on port ${PORT}`);
});
@@ -145,6 +155,11 @@ async function start() {
function shutdown(signal) {
console.log(`[server] Received ${signal}, shutting down gracefully...`);
try {
const { stopWatcher } = require('./services/mm-watcher');
stopWatcher();
} catch {}
io.close(() => {
console.log('[server] Socket.IO closed');
});