fix(storage): let the app boot with the reclaim routes and keep the ratchets where they were

The two admin routes go on the managed allow list, without which buildApp
refused to start. The reclaim calls move to their own api module so
client.ts stays at its size, the phone card sizes its text through the
type tiers, and the tests drop a hand-built service, a non-null assertion
and a promise read as a boolean.
This commit is contained in:
Maurice
2026-11-01 14:44:53 +01:00
parent a1d9cdc8f2
commit 382797febc
9 changed files with 58 additions and 29 deletions
-8
View File
@@ -56,8 +56,6 @@ import {
type BookingImportMode,
type ReceiptScanResult,
type StorageAdminState,
type StorageReclaimReport,
type StorageReclaimState,
type StorageBackend,
type StorageConfigPut,
type StorageTestResponse,
@@ -736,12 +734,6 @@ export const adminApi = {
// A full scan of a large install can exceed the 8s instance timeout.
refreshStorageStats: (): Promise<StorageUsage> =>
apiClient.post('/admin/storage/stats/refresh', undefined, { timeout: 120_000 }).then(r => r.data),
setStorageReclaimDelete: (deleteEnabled: boolean): Promise<StorageReclaimState> =>
apiClient.put('/admin/storage/reclaim', { deleteEnabled }).then(r => r.data),
// A check lists every reclaimable category and asks each domain about it; a
// large bucket outlasts the 8s instance timeout. It only reports, whatever the switch says.
runStorageReclaimCheck: (): Promise<StorageReclaimReport> =>
apiClient.post('/admin/storage/reclaim/run', { reportOnly: true }, { timeout: 300_000 }).then(r => r.data),
}
export const addonsApi = {
+12
View File
@@ -0,0 +1,12 @@
import type { StorageReclaimReport, StorageReclaimState } from '@trek/shared';
import { apiClient } from './client';
/** Admin > Storage, unreferenced files: the nightly deletion switch and a check on demand. */
export const storageReclaimApi = {
setDelete: (deleteEnabled: boolean): Promise<StorageReclaimState> =>
apiClient.put('/admin/storage/reclaim', { deleteEnabled }).then((r) => r.data),
// A check lists every reclaimable category and asks each domain about it; a
// large bucket outlasts the 8s instance timeout. It only reports, whatever the switch says.
check: (): Promise<StorageReclaimReport> =>
apiClient.post('/admin/storage/reclaim/run', { reportOnly: true }, { timeout: 300_000 }).then((r) => r.data),
};