import { api } from '../index'; import type { StorageStats } from '../types'; // NOTE: the backend `/storage` routes are still unimplemented stubs (no body / // no schema), and the real paths differ from these placeholders (`GET /storage`, // `/storage/duplicates`, `/storage/broken`, `/storage/missing-metadata`, // `POST /storage/cleanup`). Re-point paths and add snake→camel mappers (see // `mappers.ts`) once the backend defines the storage response shapes; until then // these are provisional and unused by the UI. export const storageApi = api.injectEndpoints({ endpoints: (build) => ({ getStorageStats: build.query({ query: () => '/storage/stats', providesTags: ['Storage'], }), scanStorage: build.mutation<{ jobId: string }, void>({ query: () => ({ url: '/storage/scan', method: 'POST' }), invalidatesTags: ['Storage', 'Track', 'Album', 'Artist'], }), deleteTrackFile: build.mutation({ query: (trackId) => ({ url: `/storage/tracks/${trackId}`, method: 'DELETE', }), invalidatesTags: ['Storage', { type: 'Track', id: undefined }], }), }), overrideExisting: false, }); export const { useGetStorageStatsQuery, useScanStorageMutation, useDeleteTrackFileMutation, } = storageApi;