feat(model): give each book an id

This commit is contained in:
pj committed 2026-06-20 15:09:13 -04:00
1 parent 709dd46f1c
commit 4896e10aba
1 file changed
+3
+3
View File
@@ -24,6 +24,7 @@ export interface Chapter {
export interface Book { export interface Book {
schema: "margin/1"; schema: "margin/1";
id: string;
metadata: BookMetadata; metadata: BookMetadata;
theme: string; theme: string;
settings: BookSettings; settings: BookSettings;
@@ -45,6 +46,7 @@ export function createChapter(title = "Untitled chapter"): Chapter {
export function createBook(): Book { export function createBook(): Book {
return { return {
schema: "margin/1", schema: "margin/1",
id: crypto.randomUUID(),
metadata: { title: "Untitled", subtitle: "", author: "", isbn: "", language: "en" }, metadata: { title: "Untitled", subtitle: "", author: "", isbn: "", language: "en" },
theme: "quiet-press", theme: "quiet-press",
settings: { trim: "6x9", bleed: true }, settings: { trim: "6x9", bleed: true },
@@ -54,6 +56,7 @@ export function createBook(): Book {
export function starterBook(): Book { export function starterBook(): Book {
const book = createBook(); const book = createBook();
book.metadata.title = "The Lighthouse";
book.chapters = [ book.chapters = [
{ {
id: crypto.randomUUID(), id: crypto.randomUUID(),