Throw FetchMetadata in bin.

This commit is contained in:
aditya.chandel
2025-01-26 20:17:38 -07:00
parent d7cb1c1846
commit 0d573e2cb0
34 changed files with 191 additions and 287 deletions
@@ -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;
@@ -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 {