feat: add wishlist

This commit is contained in:
2026-09-30 19:15:57 +02:00
parent ab3bbb6338
commit 1f6061b998
57 changed files with 638 additions and 232 deletions
+10
View File
@@ -0,0 +1,10 @@
/** A row of the books table, as offered by the review form */
export interface DiaryBook {
id: number
/** German title, or the original title if there is none */
title: string
originalTitle: string
/** As stored in Baserow: "Last, First" */
authors: string[]
readDate: string | null
}
+5
View File
@@ -0,0 +1,5 @@
export interface Note {
id: number
date: string
text: string
}
+10
View File
@@ -0,0 +1,10 @@
export type Medium = 'book' | 'movie' | 'album'
export interface Review {
id: number
date: string
title: string
author: string | null
text: string
medium: Medium | null
}
+9
View File
@@ -0,0 +1,9 @@
import type { Medium } from '../types/review'
export const MEDIUMS: Record<Medium, { label: string, creator: string }> = {
book: { label: 'Book', creator: 'Author' },
movie: { label: 'Movie', creator: 'Director' },
album: { label: 'Album', creator: 'Artist' }
}
export const MEDIUM_KEYS = Object.keys(MEDIUMS) as [Medium, ...Medium[]]
+22
View File
@@ -0,0 +1,22 @@
import { z } from 'zod'
const isoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Pick a date')
const requiredText = z.string().trim().min(1, 'Write something first')
export const newNoteSchema = z.object({
date: isoDate,
text: requiredText
})
export const newReviewSchema = z.object({
bookId: z.number({ error: 'Pick a book' }).int().positive('Pick a book'),
date: isoDate,
text: requiredText
})
export const loginSchema = z.object({
password: z.string().min(1)
})
export type NewNoteInput = z.output<typeof newNoteSchema>
export type NewReviewInput = z.output<typeof newReviewSchema>