WIP: Match Book

This commit is contained in:
aditya.chandel
2025-01-03 12:56:44 -07:00
parent 2c6c15e43c
commit 8453bfb2c9
17 changed files with 181 additions and 154 deletions
@@ -77,7 +77,7 @@ export class BookMetadataComponent implements OnInit, OnDestroy {
}
openEditDialog(bookId: number) {
this.loadingService.show();
/*this.loadingService.show();
forkJoin({
book: this.bookService.getBookByIdFromAPI(bookId, true),
fetchedMetadata: this.bookService.fetchMetadataFromSource(bookId)
@@ -116,7 +116,7 @@ export class BookMetadataComponent implements OnInit, OnDestroy {
this.loadingService.hide();
console.error('Error fetching metadata:', error);
}
});
});*/
}
coverImageSrc(bookId: number | undefined): string {
@@ -83,7 +83,7 @@ export class AppTopBarComponent implements OnDestroy {
header: 'Open book details',
modal: true,
closable: true,
width: '1000px',
width: '1200px',
height: '835px',
showHeader: false,
closeOnEscape: true,
+2 -1
View File
@@ -1,4 +1,5 @@
import {Shelf} from './shelf.model';
import {SafeUrl} from '@angular/platform-browser';
export interface Book {
id: number;
@@ -38,7 +39,7 @@ export interface FetchedMetadata {
isbn13: string | null;
isbn10: string | null;
pageCount: number | null;
thumbnailUrl: string | null;
thumbnailUrl: string | undefined;
language: string | null;
rating: number | null;
reviewCount: number | null;
@@ -0,0 +1,7 @@
export interface FetchMetadataRequest {
bookId: number,
provider: string,
title: string,
isbn: string,
author: string
}
@@ -0,0 +1,5 @@
export enum Provider {
AMAZON = 'Amazon',
GOOGLE_BOOKS = 'Google Books',
GOOGLE_BOOKS_API = 'Google Books (API)'
}
@@ -5,6 +5,7 @@ import {catchError, map, switchMap, tap} from 'rxjs/operators';
import {Book, BookMetadata, BookSetting, FetchedMetadata} from '../model/book.model';
import {BookState} from '../model/state/book-state.model';
import {BookMetadataForm} from '../model/book-metadata-form';
import {FetchMetadataRequest} from '../model/fetch-metadata-request.model';
@Injectable({
providedIn: 'root',
@@ -196,8 +197,8 @@ export class BookService {
});
}
fetchMetadataFromSource(bookId: number): Observable<FetchedMetadata> {
return this.http.post<FetchedMetadata>(`${this.url}/${bookId}/source/AMAZON/metadata`, null);
fetchMetadataFromSource(bookId: number, request: FetchMetadataRequest): Observable<FetchedMetadata[]> {
return this.http.post<FetchedMetadata[]>(`${this.url}/${bookId}/metadata`, request);
}
updateMetadata(bookId: number, updateMedata: FetchedMetadata): Observable<BookMetadata> {