Skip to content

Commit 1424c0c

Browse files
Merge pull request #116 from ltctceplrm/master
Added isbn and isbn13 fields to books + included author name in the search results
2 parents 4f09776 + 80cca27 commit 1424c0c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/api/apis/OpenLibraryAPI.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class OpenLibraryAPI extends APIModel {
4141
year: result.first_publish_year,
4242
dataSource: this.apiName,
4343
id: result.key,
44+
author: result.author_name ?? 'unknown',
4445
} as BookModel),
4546
);
4647
}
@@ -69,6 +70,8 @@ export class OpenLibraryAPI extends APIModel {
6970
dataSource: this.apiName,
7071
url: `https://openlibrary.org` + result.key,
7172
id: result.key,
73+
isbn: result.isbn.find((el: string | any[]) => el.length <= 10) ?? 'unknown',
74+
isbn13: result.isbn.find((el: string | any[]) => el.length == 13) ?? 'unknown',
7275
englishTitle: result.title_english ?? result.title,
7376

7477
author: result.author_name ?? 'unknown',

src/models/BookModel.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export class BookModel extends MediaTypeModel {
99
image: string;
1010
onlineRating: number;
1111
english_title: string;
12+
isbn: number;
13+
isbn13: number;
1214

1315
released: boolean;
1416

@@ -25,6 +27,8 @@ export class BookModel extends MediaTypeModel {
2527
this.pages = undefined;
2628
this.image = undefined;
2729
this.onlineRating = undefined;
30+
this.isbn = undefined;
31+
this.isbn13 = undefined;
2832

2933
this.released = undefined;
3034

@@ -52,6 +56,6 @@ export class BookModel extends MediaTypeModel {
5256
}
5357

5458
getSummary(): string {
55-
return this.englishTitle + ' (' + this.year + ')';
59+
return this.englishTitle + ' (' + this.year + ') - ' + this.author;
5660
}
5761
}

0 commit comments

Comments
 (0)