fix: send correct field names when updating book progress

This commit is contained in:
2026-08-10 23:58:42 -04:00
parent 3091cc879d
commit 3ae3dcb0d0
3 changed files with 11 additions and 28 deletions
+5 -8
View File
@@ -77,27 +77,24 @@ export const deleteBooksSchema = z.object({
library_id: stringCoerce
});
export const bookIdsSchema = z.object({
book_ids: stringArrayCoerce // TODO Could also set minimum length of 1
});
export const deleteBookFilesSchema = z.object({
book_id: stringCoerce,
file_ids: stringArrayCoerce,
delete_files: z.boolean()
});
// Mirrors BookProgressCreate in backend/src/chitai/schemas/book.py
export const updateBookProgressSchema = z.object({
book_ids: stringArrayCoerce,
progress: number().min(0).max(1),
percentage: number().min(0).max(1),
completed: z.boolean().optional().default(false),
epub_loc: z.string().optional(),
pdf_loc: z.string().optional()
epub_cfi: z.string().optional(),
epub_xpointer: z.string().optional(),
pdf_page: z.number().int().optional()
});
export type BookQuery = z.infer<typeof bookQuerySchema>;
export type BookEditMetadata = z.infer<typeof editBookMetadataSchema>;
export type DeleteBook = z.infer<typeof deleteBooksSchema>;
export type BookIds = z.infer<typeof bookIdsSchema>;
export type DeleteBookFiles = z.infer<typeof deleteBookFilesSchema>;
export type UpdateBookProgress = z.infer<typeof updateBookProgressSchema>;