Throw FetchMetadata in bin.
This commit is contained in:
@@ -219,12 +219,12 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
switch (selectedFilter.type) {
|
||||
case 'author':
|
||||
filteredBooks = filteredBooks.filter(book =>
|
||||
book.metadata?.authors?.some(author => author.id === selectedFilter.value)
|
||||
book.metadata?.authors?.some(author => author === selectedFilter.value)
|
||||
);
|
||||
break;
|
||||
case 'category':
|
||||
filteredBooks = filteredBooks.filter(book =>
|
||||
book.metadata?.categories?.some(category => category.id === selectedFilter.value)
|
||||
book.metadata?.categories?.some(category => category === selectedFilter.value)
|
||||
);
|
||||
break;
|
||||
case 'publisher':
|
||||
@@ -259,7 +259,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
const filteredBooks = bookState.books?.filter(book => {
|
||||
const matchesTitle = book.metadata?.title?.toLowerCase().includes(title.toLowerCase());
|
||||
const matchesAuthor = book.metadata?.authors.some(author =>
|
||||
author.name.toLowerCase().includes(title.toLowerCase())
|
||||
author.toLowerCase().includes(title.toLowerCase())
|
||||
);
|
||||
return matchesTitle || matchesAuthor;
|
||||
}) || null;
|
||||
|
||||
+3
-2
@@ -17,6 +17,7 @@ type Filter<T> = { value: T; bookCount: number };
|
||||
selector: 'app-book-filter',
|
||||
templateUrl: './book-filter.component.html',
|
||||
styleUrls: ['./book-filter.component.scss'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
Accordion,
|
||||
AccordionPanel,
|
||||
@@ -47,8 +48,8 @@ export class BookFilterComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
if (this.entity$ && this.entityType$) {
|
||||
this.filterStreams = {
|
||||
author: this.getFilterStream((book) => book.metadata?.authors, 'id', 'name'),
|
||||
category: this.getFilterStream((book) => book.metadata?.categories, 'id', 'name'),
|
||||
author: this.getFilterStream((book: Book) => book.metadata?.authors.map((name) => ({id: name, name})) || [], 'id', 'name'),
|
||||
category: this.getFilterStream((book: Book) => book.metadata?.categories.map((name) => ({id: name, name})) || [], 'id', 'name'),
|
||||
series: this.getFilterStream((book) => (book.metadata?.seriesName ? [{id: book.metadata.seriesName, name: book.metadata.seriesName}] : []), 'id', 'name'),
|
||||
award: this.getFilterStream((book) => book.metadata?.awards?.filter((award) => award.designation === 'WINNER'), 'name', 'name'),
|
||||
publisher: this.getFilterStream((book) => (book.metadata?.publisher ? [{id: book.metadata.publisher, name: book.metadata.publisher}] : []), 'id', 'name'),
|
||||
|
||||
@@ -3,7 +3,7 @@ import {TableEditCompleteEvent, TableModule} from 'primeng/table';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {Rating} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Author, Book, Category} from '../../../model/book.model';
|
||||
import {Book} from '../../../model/book.model';
|
||||
import {SortOption} from '../../../model/sort.model';
|
||||
import {MetadataDialogService} from '../../../../metadata/service/metadata-dialog.service';
|
||||
import {UrlHelperService} from '../../../../utilities/service/url-helper.service';
|
||||
@@ -100,11 +100,11 @@ export class BookTableComponent implements OnChanges {
|
||||
}*/
|
||||
}
|
||||
|
||||
getAuthorNames(authors: Author[]): string {
|
||||
return authors?.map(author => author.name).join(', ') || 'No authors available';
|
||||
getAuthorNames(authors: string[]): string {
|
||||
return authors?.join(', ') || '';
|
||||
}
|
||||
|
||||
getGenres(genres: Category[]) {
|
||||
return genres?.map(g => g.name).join(', ') || 'No genres available';
|
||||
getGenres(genres: string[]) {
|
||||
return genres?.join(', ') || '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {of, Subject, Subscription} from 'rxjs';
|
||||
import {catchError, debounceTime, distinctUntilChanged, switchMap} from 'rxjs/operators';
|
||||
import {Author, Book} from '../../model/book.model';
|
||||
import {Book} from '../../model/book.model';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {InputTextModule} from 'primeng/inputtext';
|
||||
import {BookService} from '../../service/book.service';
|
||||
@@ -58,8 +58,8 @@ export class BookSearcherComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
getAuthorNames(authors: Author[] | undefined): string {
|
||||
return authors?.map(author => author.name).join(', ') || 'Unknown Author';
|
||||
getAuthorNames(authors: string[] | undefined): string {
|
||||
return authors?.join(', ') || 'Unknown Author';
|
||||
}
|
||||
|
||||
onSearchInputChange(): void {
|
||||
|
||||
@@ -32,9 +32,12 @@ export interface BookMetadata {
|
||||
rating?: number | null;
|
||||
reviewCount?: number | null;
|
||||
coverUpdatedOn?: string;
|
||||
authors: Author[];
|
||||
categories: Category[];
|
||||
authors: string[];
|
||||
categories: string[];
|
||||
awards?: Award[];
|
||||
provider?: string;
|
||||
providerBookId?: string;
|
||||
thumbnailUrl?: string | null;
|
||||
|
||||
titleLocked?: boolean;
|
||||
subtitleLocked?: boolean;
|
||||
@@ -60,42 +63,6 @@ export interface BookMetadata {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface FetchedMetadata {
|
||||
bookId: number | null;
|
||||
provider: string;
|
||||
providerBookId: string;
|
||||
title: string | null;
|
||||
subtitle?: string | null;
|
||||
publisher: string | null;
|
||||
publishedDate: string | null;
|
||||
description: string | null;
|
||||
seriesName: string | null;
|
||||
seriesNumber: number | null;
|
||||
seriesTotal: number | null;
|
||||
isbn13: string | null;
|
||||
isbn10: string | null;
|
||||
asin: string | null;
|
||||
pageCount: number | null;
|
||||
thumbnailUrl: string | undefined;
|
||||
language: string | null;
|
||||
rating: number | null;
|
||||
reviewCount: number | null;
|
||||
authors: string[];
|
||||
categories: string[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface Author {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Award {
|
||||
name: string;
|
||||
category: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, Observable, of} from 'rxjs';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {catchError, distinctUntilChanged, map, tap} from 'rxjs/operators';
|
||||
import {Author, Book, BookMetadata, BookSetting, Category} from '../model/book.model';
|
||||
import {catchError, map, tap} from 'rxjs/operators';
|
||||
import {Book, BookMetadata, BookSetting} from '../model/book.model';
|
||||
import {BookState} from '../model/state/book-state.model';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@@ -135,7 +135,7 @@ export class BookService {
|
||||
const state = this.bookStateSubject.value;
|
||||
return (state.books || []).filter(book =>
|
||||
book.metadata?.title?.toLowerCase().includes(query.toLowerCase()) ||
|
||||
book.metadata?.authors.some(author => author.name.toLowerCase().includes(query.toLowerCase()))
|
||||
book.metadata?.authors.some(author => author.toLowerCase().includes(query.toLowerCase()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user