Add an option to save metadata directly into the EPUB file, along with the ability to back up and restore the original metadata.

This commit is contained in:
aditya.chandel
2025-06-17 00:19:20 -06:00
committed by Aditya Chandel
parent faae595ef6
commit 03ce268d8e
32 changed files with 1400 additions and 371 deletions
@@ -52,7 +52,7 @@ export class BookService {
getBookByIdFromState(bookId: number): Book | undefined {
const currentState = this.bookStateSubject.value;
return currentState.books?.find(book => book.id === bookId);
return currentState.books?.find(book => +book.id === +bookId);
}
updateBookShelves(bookIds: Set<number | undefined>, shelvesToAssign: Set<number | undefined>, shelvesToUnassign: Set<number | undefined>): Observable<Book[]> {
@@ -413,4 +413,16 @@ export class BookService {
);
}
restoreMetadata(bookId: number) {
return this.http.post<BookMetadata>(`${this.url}/${bookId}/metadata/restore`, null).pipe(
map(updatedMetadata => {
this.handleBookMetadataUpdate(bookId, updatedMetadata);
return updatedMetadata;
})
);
}
getBackupMetadata(bookId: number) {
return this.http.get<any>(`${this.url}/${bookId}/metadata/restore`);
}
}