23 lines
490 B
TypeScript
23 lines
490 B
TypeScript
interface LinkValue {
|
|
value: string | null
|
|
}
|
|
|
|
export interface DiaryBookRow {
|
|
id: number
|
|
title: string | null
|
|
title_german: string | null
|
|
authors: LinkValue[]
|
|
read_date: string | null
|
|
}
|
|
|
|
export function toDiaryBook(row: DiaryBookRow): DiaryBook {
|
|
const original = (row.title ?? '').trim()
|
|
return {
|
|
id: row.id,
|
|
title: row.title_german?.trim() || original,
|
|
originalTitle: original,
|
|
authors: lookupValues(row.authors),
|
|
readDate: row.read_date || null
|
|
}
|
|
}
|