- api: cbr utilitaire (extraction RAR), scanner/métadonnées (+ tests), books, schéma - web: ReaderPage/locators (+ tests), mockData, types partagés - deps: pnpm-lock Refs: #17
109 lines
3.0 KiB
TypeScript
109 lines
3.0 KiB
TypeScript
import type { BookDto, JobDto, LibraryDto, ProgressDto, UserDto } from "@readabook/shared";
|
|
import type { ContinueItem } from "./types";
|
|
|
|
const now = new Date().toISOString();
|
|
|
|
export const mockUser: UserDto = {
|
|
id: 1,
|
|
email: "admin@readabook.local",
|
|
name: "Conservateur",
|
|
role: "admin",
|
|
createdAt: now
|
|
};
|
|
|
|
export const mockLibraries: LibraryDto[] = [
|
|
{ id: 1, name: "Reserve des EPUB", path: "/library/epub", enabled: true, createdAt: now, updatedAt: now },
|
|
{ id: 2, name: "Atlas PDF", path: "/library/pdf", enabled: true, createdAt: now, updatedAt: now }
|
|
];
|
|
|
|
export const mockBooks: BookDto[] = [
|
|
{
|
|
id: 1,
|
|
libraryId: 1,
|
|
title: "L'Herbier des machines",
|
|
author: "M. Valrose",
|
|
description: "Fragments, croquis et notes rassemblees autour d'automates introuvables.",
|
|
isbn: null,
|
|
language: "fr",
|
|
publisher: "Cabinet ReadaBook",
|
|
publishedDate: "1908",
|
|
format: "epub",
|
|
filePath: "/library/epub/herbier.epub",
|
|
coverPath: null,
|
|
fileSize: 4300000,
|
|
fileMtime: now,
|
|
createdAt: now,
|
|
updatedAt: now
|
|
},
|
|
{
|
|
id: 2,
|
|
libraryId: 2,
|
|
title: "Cartographie des songes",
|
|
author: "I. Nadir",
|
|
description: "Un atlas annote ou chaque page devient une vitrine de lecture.",
|
|
isbn: null,
|
|
language: "fr",
|
|
publisher: "ReadaBook",
|
|
publishedDate: "1921",
|
|
format: "pdf",
|
|
filePath: "/library/pdf/cartographie.pdf",
|
|
coverPath: null,
|
|
fileSize: 9100000,
|
|
fileMtime: now,
|
|
createdAt: now,
|
|
updatedAt: now
|
|
},
|
|
{
|
|
id: 3,
|
|
libraryId: 2,
|
|
title: "Les vitrines de verre",
|
|
author: "A. Muze",
|
|
description: "Un recit graphique indexe comme archive CBZ.",
|
|
isbn: null,
|
|
language: "fr",
|
|
publisher: "ReadaBook",
|
|
publishedDate: "1934",
|
|
format: "cbz",
|
|
filePath: "/library/cbz/vitrines.cbz",
|
|
coverPath: null,
|
|
fileSize: 12600000,
|
|
fileMtime: now,
|
|
createdAt: now,
|
|
updatedAt: now
|
|
},
|
|
{
|
|
id: 4,
|
|
libraryId: 2,
|
|
title: "Cabinet noir",
|
|
author: "L. Rar",
|
|
description: "Archive CBR lue avec le même parcours paginé que les comics CBZ.",
|
|
isbn: null,
|
|
language: "fr",
|
|
publisher: "ReadaBook",
|
|
publishedDate: "1937",
|
|
format: "cbr",
|
|
filePath: "/library/cbr/cabinet-noir.cbr",
|
|
coverPath: null,
|
|
fileSize: 14800000,
|
|
fileMtime: now,
|
|
createdAt: now,
|
|
updatedAt: now
|
|
}
|
|
];
|
|
|
|
export const mockProgress: ProgressDto[] = [
|
|
{ bookId: 1, locator: "mock:chapter-3", percent: 42, updatedAt: now },
|
|
{ bookId: 2, locator: "pdf:page:12", percent: 18, updatedAt: now },
|
|
{ bookId: 3, locator: "cbz:page:4", percent: 40, updatedAt: now },
|
|
{ bookId: 4, locator: "cbr:page:6", percent: 60, updatedAt: now }
|
|
];
|
|
|
|
export const mockContinue: ContinueItem[] = mockProgress.map((progress) => ({
|
|
progress,
|
|
book: mockBooks.find((book) => book.id === progress.bookId) ?? mockBooks[0]
|
|
}));
|
|
|
|
export const mockJobs: JobDto[] = [
|
|
{ id: 1, type: "scan-library", status: "succeeded", detail: "2 ouvrages indexes", error: null, createdAt: now, updatedAt: now }
|
|
];
|