Files
bookorbit/client/src/features/book/composables/useFileMetadata.ts
T
Kyungwook Park 6677f2f5ea feat(metadata): add Aladin Korean book metadata provider (#351)
* feat(metadata): add Aladin Korean book metadata provider

Add support for fetching Korean book metadata from Aladin OpenAPI.
Includes search by title/author/ISBN and lookup by ISBN-10/13.

- Add ALADIN to MetadataProviderKey in @bookorbit/types
- Add AladinProviderConfig to ProviderConfigurations
- Create AladinProvider with IdentifiableProvider interface
- Add mapper for Aladin API response to MetadataCandidate
- Register provider in MetadataFetchModule
- Add provider config merge, validation, and connection test
- Include 24 unit tests (provider + mapper)

* feat(client): add Aladin provider UI integration

* refactor(metadata): use 'Aladin' label and favicon-based icon

* feat(metadata): complete Aladin provider end-to-end wiring

Persist the Aladin ItemId across fetch, scoring, locks, and file metadata round-trip, and update the affected tests.

Co-authored-by: Kyungwook Park <288273+kyungw00k@users.noreply.github.com>

---------

Co-authored-by: neon <18559658+neonsolstice@users.noreply.github.com>
Co-authored-by: Kyungwook Park <288273+kyungw00k@users.noreply.github.com>
2026-06-17 13:33:35 -06:00

54 lines
1.4 KiB
TypeScript

import { ref } from 'vue'
import { api } from '@/lib/api'
import type { ComicMetadataFields } from '@bookorbit/types'
export interface FileMetadata {
title?: string | null
subtitle?: string | null
description?: string | null
publisher?: string | null
publishedYear?: number | null
language?: string | null
pageCount?: number | null
seriesName?: string | null
seriesIndex?: number | null
isbn10?: string | null
isbn13?: string | null
googleBooksId?: string | null
goodreadsId?: string | null
amazonId?: string | null
hardcoverId?: string | null
openLibraryId?: string | null
itunesId?: string | null
audibleId?: string | null
koboId?: string | null
comicvineId?: string | null
ranobedbId?: string | null
lubimyczytacId?: string | null
aladinId?: string | null
authors?: string[]
genres?: string[]
narrators?: string[]
durationSeconds?: number | null
comicMetadata?: ComicMetadataFields
}
export function useFileMetadata() {
const loading = ref(false)
async function loadFromFile(bookId: number): Promise<FileMetadata | null> {
loading.value = true
try {
const res = await api(`/api/v1/books/${bookId}/metadata-from-file`)
if (!res.ok) return null
return (await res.json()) as FileMetadata
} catch {
return null
} finally {
loading.value = false
}
}
return { loading, loadFromFile }
}