mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
feat(metadata): add configuration for custom book metadata fields
Allow users to define new custom fields for books beyond the standard metadata properties. This provides flexibility for cataloging arbitrary data like reading formats, editions, or personal ratings. Closes #419
This commit is contained in:
@@ -3,6 +3,7 @@ import type { BookMetadataLockField } from "./metadata-lock";
|
||||
import type { AudiobookChapter, NarratorRef } from "./audiobook";
|
||||
import type { ComicMetadataFields } from "./metadata-fetch";
|
||||
import type { BookFileWriteField, WriteResult } from "./file-write";
|
||||
import type { CustomMetadataBookValue } from "./custom-metadata";
|
||||
|
||||
export const BOOK_FORMATS = ["epub", "pdf", "mobi", "azw3", "cbz", "cbr", "cb7", "fb2", "m4b", "mp3", "m4a", "opus", "ogg", "flac"] as const;
|
||||
export type BookFormat = (typeof BOOK_FORMATS)[number];
|
||||
@@ -142,6 +143,7 @@ export type BookDetail = {
|
||||
audioMetadata: AudioMetadata | null;
|
||||
formatPriority: string[];
|
||||
comicMetadata: ComicMetadataFields | null;
|
||||
customMetadata: CustomMetadataBookValue[];
|
||||
lockedFields: BookMetadataLockField[];
|
||||
collections: { id: number; name: string }[];
|
||||
fileWriteStatus?: BookFileWriteStatus;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
export const CUSTOM_METADATA_FIELD_TYPES = ["text", "url", "number", "date", "boolean"] as const;
|
||||
|
||||
export type CustomMetadataFieldType = (typeof CUSTOM_METADATA_FIELD_TYPES)[number];
|
||||
|
||||
export type CustomMetadataPrimitiveValue = string | number | boolean | null;
|
||||
|
||||
export interface CustomMetadataFieldDefinition {
|
||||
id: number;
|
||||
key: string;
|
||||
label: string;
|
||||
type: CustomMetadataFieldType;
|
||||
displayOrder: number;
|
||||
archivedAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
enabledLibraryIds: number[];
|
||||
usageCount: number;
|
||||
}
|
||||
|
||||
export interface CustomMetadataLibraryEnablement {
|
||||
fieldId: number;
|
||||
libraryId: number;
|
||||
displayOrder: number;
|
||||
}
|
||||
|
||||
export interface CustomMetadataBookValue {
|
||||
fieldId: number;
|
||||
key: string;
|
||||
label: string;
|
||||
type: CustomMetadataFieldType;
|
||||
displayOrder: number;
|
||||
value: CustomMetadataPrimitiveValue;
|
||||
}
|
||||
|
||||
export interface CustomMetadataBookValueInput {
|
||||
fieldId: number;
|
||||
value: CustomMetadataPrimitiveValue;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ export * from "./display-preferences";
|
||||
export * from "./permissions";
|
||||
export * from "./content-filter";
|
||||
export * from "./metadata-preferences";
|
||||
export * from "./custom-metadata";
|
||||
export * from "./metadata-lock";
|
||||
export * from "./dashboard";
|
||||
export * from "./book";
|
||||
|
||||
Reference in New Issue
Block a user