Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/nperez0111/bookhive. Track your books, share your shelves, see what others are reading bookhive.buzz
atproto bluesky books bookshelf goodreads management-system
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445/** * The viewer's relationship to one book. Every book-state write returns it * and the read answers with it, so a client can reconcile without a page * re-render. Excludes `userDid` and the raw PDS `record` (blob refs). */import type { BookProgress, HiveId, PreviousRead, UserBook } from "../types";
export type UserBookView = { uri: string; cid: string; hiveId: HiveId; title: string; authors: string; status: string | null; owned: boolean; stars: number | null; review: string | null; startedAt: string | null; finishedAt: string | null; bookProgress: BookProgress | null; previousReads: PreviousRead[] | null; createdAt: string; indexedAt: string;};
export function toUserBookView(userBook: UserBook): UserBookView { return { uri: userBook.uri, cid: userBook.cid, hiveId: userBook.hiveId, title: userBook.title, authors: userBook.authors, status: userBook.status ?? null, owned: userBook.owned === 1, stars: userBook.stars ?? null, review: userBook.review ?? null, startedAt: userBook.startedAt ?? null, finishedAt: userBook.finishedAt ?? null, bookProgress: userBook.bookProgress ?? null, previousReads: userBook.previousReads ?? null, createdAt: userBook.createdAt, indexedAt: userBook.indexedAt, };}