WIP: Metadata

This commit is contained in:
aditya.chandel
2025-01-03 23:43:16 -07:00
parent f976c70bed
commit c7724e6837
17 changed files with 295 additions and 324 deletions
@@ -85,7 +85,6 @@ export class BookCardComponent implements OnInit {
openBookDetailsDialog(bookId: number): void {
this.bookService.getBookByIdFromAPI(bookId, true).subscribe(({
next: (book) => {
console.log(book)
this.dialogService.open(BookInfoTabsComponent, {
header: 'Open book details',
modal: true,
@@ -36,14 +36,6 @@
</div>
</li>
<p-divider layout="vertical" />
<li>
<a class="topbar-item">
<i class="pi pi-book text-surface-700 dark:text-surface-100" (click)="openBookDetailsDialog()"
pTooltip="Book Details" tooltipPosition="top"></i>
</a>
</li>
<li>
<a class="topbar-item">
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
@@ -77,22 +77,6 @@ export class AppTopBarComponent implements OnDestroy {
this.showEvents = !this.showEvents;
}
openBookDetailsDialog(): void {
this.ref = this.dialogService.open(BookInfoTabsComponent, {
header: 'Open book details',
modal: true,
closable: true,
width: '1200px',
height: '835px',
showHeader: false,
closeOnEscape: true,
data: {
bookId: 1
}
});
}
openLibraryCreatorDialog(): void {
this.ref = this.dialogService.open(LibraryCreatorComponent, {
header: 'Create New Library',
@@ -1,4 +1,5 @@
export interface BookMetadataForm {
export interface BookMetadataBI {
bookId: number;
title: string;
subtitle?: string;
authors: Array<string>;
@@ -7,9 +8,10 @@ export interface BookMetadataForm {
publishedDate: string;
isbn10: string;
isbn13: string;
asin: string;
asin?: string;
description?: string;
pageCount: number;
pageCount?: number | null;
language: string;
googleBookId: string;
googleBookId?: string;
thumbnailUrl?: string;
}
@@ -45,6 +45,7 @@ export interface FetchedMetadata {
reviewCount: number | null;
authors: string[];
categories: string[];
asin: string | null;
[key: string]: any;
}
@@ -4,8 +4,8 @@ import {HttpClient} from '@angular/common/http';
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';
import {BookMetadataBI} from '../model/book-metadata-for-book-info.model';
@Injectable({
providedIn: 'root',
@@ -197,16 +197,12 @@ export class BookService {
});
}
fetchMetadataFromSource(bookId: number, request: FetchMetadataRequest): Observable<FetchedMetadata[]> {
fetchMetadata(bookId: number, request: FetchMetadataRequest): Observable<FetchedMetadata[]> {
return this.http.post<FetchedMetadata[]>(`${this.url}/${bookId}/metadata`, request);
}
updateMetadata(bookId: number, updateMedata: FetchedMetadata): Observable<BookMetadata> {
return this.http.put<BookMetadata>(`${this.url}/${bookId}/source/AMAZON/metadata`, updateMedata);
}
updateMetadataV2(bookId: number, bookMetadataForm: BookMetadataForm): Observable<BookMetadata> {
return this.http.put<BookMetadata>(`${this.url}/${bookId}/metadata`, bookMetadataForm);
updateMetadata(bookId: number, bookMetadata: BookMetadataBI): Observable<BookMetadata> {
return this.http.put<BookMetadata>(`${this.url}/${bookId}/metadata`, bookMetadata);
}
}