Skip to content

Commit

Permalink
Added isbn13 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ltctceplrm committed Dec 19, 2023
1 parent fe9f041 commit d21ac66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api/apis/OpenLibraryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export class OpenLibraryAPI extends APIModel {
dataSource: this.apiName,
url: `https://openlibrary.org` + result.key,
id: result.key,
isbn: result.isbn[0] ?? 'unknown',
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',
Expand Down
2 changes: 2 additions & 0 deletions src/models/BookModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class BookModel extends MediaTypeModel {
onlineRating: number;
english_title: string;
isbn: number;
isbn13: number;

released: boolean;

Expand All @@ -27,6 +28,7 @@ export class BookModel extends MediaTypeModel {
this.image = undefined;
this.onlineRating = undefined;
this.isbn = undefined;
this.isbn13 = undefined;

this.released = undefined;

Expand Down

0 comments on commit d21ac66

Please sign in to comment.