From 376fb5bca44b3c61261bbebcb43b73ef5efc4c89 Mon Sep 17 00:00:00 2001 From: jubnl Date: Thu, 20 Aug 2026 13:58:08 +0200 Subject: [PATCH] =?UTF-8?q?feat(client):=20adminApi=20storage=20endpoints?= =?UTF-8?q?=20=E2=80=94=20getStorage,=20updateStorage,=20testStorageBacken?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/client.surface.test.ts | 3 +++ client/src/api/client.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/client/src/api/client.surface.test.ts b/client/src/api/client.surface.test.ts index 5c0afe7f3..e594e06b4 100644 --- a/client/src/api/client.surface.test.ts +++ b/client/src/api/client.surface.test.ts @@ -267,6 +267,9 @@ describe('client > endpoint wiring', () => { { n: 'updateNotificationPreferences', r: () => adminApi.updateNotificationPreferences({ email: { trip_invite: true } }), e: 'PUT /api/admin/notification-preferences' }, { n: 'getDefaultUserSettings', r: () => adminApi.getDefaultUserSettings(), e: 'GET /api/admin/default-user-settings' }, { n: 'updateDefaultUserSettings', r: () => adminApi.updateDefaultUserSettings({ language: 'de' }), e: 'PUT /api/admin/default-user-settings' }, + { n: 'getStorage', r: () => adminApi.getStorage(), e: 'GET /api/admin/storage' }, + { n: 'updateStorage', r: () => adminApi.updateStorage({ backends: [], categories: {} }), e: 'PUT /api/admin/storage' }, + { n: 'testStorageBackend', r: () => adminApi.testStorageBackend({ name: 'x', type: 'local', options: { root: '/data' } }), e: 'POST /api/admin/storage/test' }, { n: 'mcpTokens', r: () => adminApi.mcpTokens(), e: 'GET /api/admin/mcp-tokens' }, { n: 'deleteMcpToken', r: () => adminApi.deleteMcpToken(4), e: 'DELETE /api/admin/mcp-tokens/4' }, { n: 'oauthSessions', r: () => adminApi.oauthSessions(), e: 'GET /api/admin/oauth-sessions' }, diff --git a/client/src/api/client.ts b/client/src/api/client.ts index af4c5f61e..5380f0e4d 100644 --- a/client/src/api/client.ts +++ b/client/src/api/client.ts @@ -47,6 +47,10 @@ import { type BookingImportPreviewResponse, type BookingImportConfirmResponse, type BookingImportMode, + type StorageAdminState, + type StorageBackend, + type StorageConfig, + type StorageTestResponse, } from '@trek/shared' import { getSocketId } from './websocket' import { probeNow } from '../sync/connectivity' @@ -637,6 +641,15 @@ export const adminApi = { updateNotificationPreferences: (prefs: Record>) => apiClient.put('/admin/notification-preferences', prefs).then(r => r.data), getDefaultUserSettings: () => apiClient.get('/admin/default-user-settings').then(r => r.data), updateDefaultUserSettings: (settings: Record) => apiClient.put('/admin/default-user-settings', settings).then(r => r.data), + getStorage: (): Promise => apiClient.get('/admin/storage').then(r => r.data), + updateStorage: (config: StorageConfig): Promise => + apiClient.put('/admin/storage', config).then(r => r.data), + // A probe is bounded by the target driver's own timeout (default 30s, ×2 with + // one retry) and a mirror probes its targets sequentially — the instance-wide + // 8s axios timeout would abort a legitimate slow probe, so this call carries + // its own generous ceiling. + testStorageBackend: (backend: StorageBackend): Promise => + apiClient.post('/admin/storage/test', { backend }, { timeout: 120_000 }).then(r => r.data), } export const addonsApi = {