fix(geplante-nachrichten): read bot credentials from tool_config_nextcloud, add manual trigger endpoint
This commit is contained in:
@@ -2,7 +2,6 @@ import pool from '../config/database';
|
||||
import settingsService from './settings.service';
|
||||
import nextcloudService from './nextcloud.service';
|
||||
import logger from '../utils/logger';
|
||||
|
||||
// ── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
interface ScheduledMessageRule {
|
||||
@@ -43,10 +42,11 @@ interface RoomsResult {
|
||||
// ── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
async function getBotCredentials(): Promise<{ username: string; appPassword: string } | null> {
|
||||
const usernameRow = await settingsService.get('nextcloud_bot_username');
|
||||
const appPasswordRow = await settingsService.get('nextcloud_bot_app_password');
|
||||
const username = typeof usernameRow?.value === 'string' ? usernameRow.value : null;
|
||||
const appPassword = typeof appPasswordRow?.value === 'string' ? appPasswordRow.value : null;
|
||||
const setting = await settingsService.get('tool_config_nextcloud');
|
||||
if (!setting?.value || typeof setting.value !== 'object') return null;
|
||||
const cfg = setting.value as Record<string, unknown>;
|
||||
const username = typeof cfg.bot_username === 'string' ? cfg.bot_username : null;
|
||||
const appPassword = typeof cfg.bot_app_password === 'string' ? cfg.bot_app_password : null;
|
||||
if (!username || !appPassword) return null;
|
||||
return { username, appPassword };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user