Merge pull request #116 from ltctceplrm/master

Added isbn and isbn13 fields to books + included author name in the search results
This commit is contained in:
Moritz Jung 2023-12-21 20:42:35 +01:00 committed by GitHub
commit 1424c0cef6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -41,6 +41,7 @@ export class OpenLibraryAPI extends APIModel {
year: result.first_publish_year,
dataSource: this.apiName,
id: result.key,
author: result.author_name ?? 'unknown',
} as BookModel),
);
}
@ -69,6 +70,8 @@ export class OpenLibraryAPI extends APIModel {
dataSource: this.apiName,
url: `https://openlibrary.org` + result.key,
id: result.key,
isbn: result.isbn.find((el: string | any[]) => el.length <= 10) ?? 'unknown',
isbn13: result.isbn.find((el: string | any[]) => el.length == 13) ?? 'unknown',
englishTitle: result.title_english ?? result.title,
author: result.author_name ?? 'unknown',

View file

@ -9,6 +9,8 @@ export class BookModel extends MediaTypeModel {
image: string;
onlineRating: number;
english_title: string;
isbn: number;
isbn13: number;
released: boolean;
@ -25,6 +27,8 @@ export class BookModel extends MediaTypeModel {
this.pages = undefined;
this.image = undefined;
this.onlineRating = undefined;
this.isbn = undefined;
this.isbn13 = undefined;
this.released = undefined;
@ -52,6 +56,6 @@ export class BookModel extends MediaTypeModel {
}
getSummary(): string {
return this.englishTitle + ' (' + this.year + ')';
return this.englishTitle + ' (' + this.year + ') - ' + this.author;
}
}