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.
TypeScript
1234567891011121314151617181920import type { BookProgress } from "../types";
export function hydrateUserBook<T extends { bookProgress: string | null }>( row: T,): Omit<T, "bookProgress"> & { bookProgress: BookProgress | null } { return { ...row, bookProgress: row.bookProgress ? JSON.parse(row.bookProgress) : null, };}
export function serializeUserBook<T extends { bookProgress: BookProgress | null }>( book: T,): Omit<T, "bookProgress"> & { bookProgress: string | null } { return { ...book, bookProgress: book.bookProgress ? JSON.stringify(book.bookProgress) : null, };}