ваше сообщение коммита
This commit is contained in:
@@ -669,7 +669,7 @@ router.get('/db-settings', async (req, res) => {
|
||||
});
|
||||
|
||||
// Обновить настройки базы данных
|
||||
router.put('/db-settings', requireAdmin, async (req, res) => {
|
||||
router.put('/db-settings', requireAdmin, async (req, res, next) => {
|
||||
try {
|
||||
const { db_host, db_port, db_name, db_user, db_password } = req.body;
|
||||
const updated = await dbSettingsService.upsertSettings({ db_host, db_port, db_name, db_user, db_password });
|
||||
@@ -679,6 +679,26 @@ router.put('/db-settings', requireAdmin, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Получить статус подключения к БД
|
||||
router.get('/db-settings/connection-status', requireAdmin, async (req, res, next) => {
|
||||
try {
|
||||
const status = await dbSettingsService.getConnectionStatus();
|
||||
res.json({ success: true, status });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Принудительное переподключение к БД
|
||||
router.post('/db-settings/reconnect', requireAdmin, async (req, res, next) => {
|
||||
try {
|
||||
const result = await dbSettingsService.reconnect();
|
||||
res.json({ success: true, result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Получить все LLM-модели
|
||||
router.get('/llm-models', requireAdmin, async (req, res) => {
|
||||
try {
|
||||
|
||||
@@ -218,8 +218,8 @@ router.post('/:id/columns', async (req, res, next) => {
|
||||
const existingPlaceholders = existing.map(c => c.placeholder).filter(Boolean);
|
||||
const placeholder = generatePlaceholder(name, existingPlaceholders);
|
||||
const result = await db.getQuery()(
|
||||
'INSERT INTO user_columns (table_id, name_encrypted, type_encrypted, placeholder_encrypted, "order", placeholder) VALUES ($1, encrypt_text($2, $7), encrypt_text($3, $7), encrypt_text($6, $7), $4, $5) RETURNING *',
|
||||
[tableId, name, type, order || 0, placeholder, placeholder, encryptionKey]
|
||||
'INSERT INTO user_columns (table_id, name_encrypted, type_encrypted, placeholder_encrypted, "order", placeholder, options) VALUES ($1, encrypt_text($2, $7), encrypt_text($3, $7), encrypt_text($6, $7), $4, $5, $8) RETURNING *',
|
||||
[tableId, name, type, order || 0, placeholder, placeholder, encryptionKey, JSON.stringify(finalOptions)]
|
||||
);
|
||||
res.json(result.rows[0]);
|
||||
broadcastTableUpdate(tableId);
|
||||
|
||||
Reference in New Issue
Block a user