feat: frontend MVP — auth, timeline, upload, albums, admin, image viewer
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
This commit is contained in:
35
k-photos-frontend/hooks/use-duplicates.ts
Normal file
35
k-photos-frontend/hooks/use-duplicates.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
"use client"
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"
|
||||
import api from "@/lib/api"
|
||||
import type { DuplicateGroupResponse } from "@/lib/types"
|
||||
|
||||
export function useDuplicates() {
|
||||
return useQuery({
|
||||
queryKey: ["admin", "duplicates"],
|
||||
queryFn: async () => {
|
||||
const { data } =
|
||||
await api.get<DuplicateGroupResponse[]>("/duplicates")
|
||||
return data
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useResolveDuplicate() {
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
groupId,
|
||||
keepAssetId,
|
||||
}: {
|
||||
groupId: string
|
||||
keepAssetId: string
|
||||
}) => {
|
||||
await api.post(`/duplicates/${groupId}/resolve`, {
|
||||
keep_asset_id: keepAssetId,
|
||||
})
|
||||
},
|
||||
onSuccess: () =>
|
||||
qc.invalidateQueries({ queryKey: ["admin", "duplicates"] }),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user