Backend: - user roles (DB + JWT + first-user-is-admin) - volume-aware file resolver (multi-volume asset serving) - directory scanner uses volume URI directly - date-summary endpoint (capture date from EXIF) - timeline ordered by capture date - list endpoints: volumes, plugins, pipelines, library paths - delete endpoints: volumes, library paths - configurable upload body limit (MAX_UPLOAD_BYTES) Frontend: - auth: login/register, token refresh, role-based admin gate - timeline: date-grouped grid, infinite scroll, date scrubber - image viewer: fullscreen zoom/pan/pinch, metadata sidebar - upload: drag-drop, sequential upload, progress tracking - albums: create, add/remove photos, asset picker dialog - admin: storage (import library), jobs (pagination, error details), plugins (list + toggle), pipelines, sidecars, duplicates - multi-select mode with add-to-album action - TanStack Query for all data fetching
72 lines
1.4 KiB
TypeScript
72 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { useMutation } from "@tanstack/react-query"
|
|
import api from "@/lib/api"
|
|
import type {
|
|
SidecarExportResponse,
|
|
SidecarImportResponse,
|
|
DetectChangesResponse,
|
|
} from "@/lib/types"
|
|
|
|
export function useExportSidecar() {
|
|
return useMutation({
|
|
mutationFn: async (assetId: string) => {
|
|
const { data } = await api.post<SidecarExportResponse>(
|
|
`/sidecar/export/${assetId}`,
|
|
)
|
|
return data
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useImportSidecar() {
|
|
return useMutation({
|
|
mutationFn: async (assetId: string) => {
|
|
const { data } = await api.post<SidecarImportResponse>(
|
|
`/sidecar/import/${assetId}`,
|
|
)
|
|
return data
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useDetectChanges() {
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
const { data } =
|
|
await api.post<DetectChangesResponse>("/sidecar/detect-changes")
|
|
return data
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useResolveSidecarConflict() {
|
|
return useMutation({
|
|
mutationFn: async ({
|
|
assetId,
|
|
policy,
|
|
}: {
|
|
assetId: string
|
|
policy: string
|
|
}) => {
|
|
await api.post(`/sidecar/resolve/${assetId}`, { policy })
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useFullExport() {
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
await api.post("/sidecar/full-export")
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useFullImport() {
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
await api.post("/sidecar/full-import")
|
|
},
|
|
})
|
|
}
|