From 65b7e6df8db47445a0c03991126df349cb889ba7 Mon Sep 17 00:00:00 2001
From: "aditya.chandel" <>
Date: Mon, 6 Jan 2025 15:18:14 -0700
Subject: [PATCH] WPI: Add table for display books
---
.../booklore/quartz/JobSchedulerService.java | 3 ++
.../booklore/util/FileService.java | 17 ++++++--
booklore-ui/src/app/app-routing.module.ts | 3 +-
booklore-ui/src/app/app.component.html | 1 -
.../metadata-searcher.component.html | 2 +-
.../book-browser/book-browser.component.ts | 3 +-
.../book-table/book-table.component.html | 43 +++++++++++++++++++
.../book-table/book-table.component.scss | 0
.../book-table/book-table.component.ts | 35 +++++++++++++++
9 files changed, 98 insertions(+), 9 deletions(-)
create mode 100644 booklore-ui/src/app/book/component/book-table/book-table.component.html
create mode 100644 booklore-ui/src/app/book/component/book-table/book-table.component.scss
create mode 100644 booklore-ui/src/app/book/component/book-table/book-table.component.ts
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/quartz/JobSchedulerService.java b/booklore-api/src/main/java/com/adityachandel/booklore/quartz/JobSchedulerService.java
index a216f1f04..d7d5da217 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/quartz/JobSchedulerService.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/quartz/JobSchedulerService.java
@@ -30,6 +30,9 @@ public class JobSchedulerService {
scheduler.scheduleJob(jobDetail, trigger);
} catch (Exception e) {
+ if(e.getMessage().contains("already exists")) {
+ throw ApiError.ANOTHER_METADATA_JOB_RUNNING.createException();
+ }
throw ApiError.SCHEDULE_REFRESH_ERROR.createException(e.getMessage());
}
}
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/util/FileService.java b/booklore-api/src/main/java/com/adityachandel/booklore/util/FileService.java
index cdbc9e96e..ae3184c2a 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/util/FileService.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/util/FileService.java
@@ -26,16 +26,21 @@ public class FileService {
private final AppProperties appProperties;
public Resource getBookCover(String thumbnailPath) {
- Path filePath = Paths.get(thumbnailPath);
+ Path thumbPath;
+ if (thumbnailPath == null || thumbnailPath.isEmpty()) {
+ thumbPath = Paths.get(getMissingThumbnailPath());
+ } else {
+ thumbPath = Paths.get(thumbnailPath);
+ }
try {
- Resource resource = new UrlResource(filePath.toUri());
+ Resource resource = new UrlResource(thumbPath.toUri());
if (resource.exists() && resource.isReadable()) {
return resource;
} else {
- throw ApiError.IMAGE_NOT_FOUND.createException(filePath);
+ throw ApiError.IMAGE_NOT_FOUND.createException(thumbPath);
}
} catch (IOException e) {
- throw ApiError.IMAGE_NOT_FOUND.createException(filePath);
+ throw ApiError.IMAGE_NOT_FOUND.createException(thumbPath);
}
}
@@ -75,4 +80,8 @@ public class FileService {
return appProperties.getPathConfig() + "/thumbs/" + bookId + "/";
}
+ public String getMissingThumbnailPath() {
+ return appProperties.getPathConfig() + "/thumbs/missing/m.jpg";
+ }
+
}
diff --git a/booklore-ui/src/app/app-routing.module.ts b/booklore-ui/src/app/app-routing.module.ts
index e3f559859..895f6949d 100644
--- a/booklore-ui/src/app/app-routing.module.ts
+++ b/booklore-ui/src/app/app-routing.module.ts
@@ -4,6 +4,7 @@ import {PdfViewerComponent} from './book/component/pdf-viewer/pdf-viewer.compone
import {DashboardComponent} from './book/component/dashboard/dashboard.component';
import {BookBrowserComponent} from './book/component/book-browser/book-browser.component';
import {AppLayoutComponent} from './book/component/layout/app.layout.component';
+import {BookTableComponent} from './book/component/book-table/book-table.component';
const routes: Routes = [
{
@@ -13,7 +14,7 @@ const routes: Routes = [
path: '', component: DashboardComponent,
},
{
- path: 'all-books', component: BookBrowserComponent,
+ path: 'all-books', component: BookTableComponent,
},
{
path: 'library/:libraryId/books', component: BookBrowserComponent,
diff --git a/booklore-ui/src/app/app.component.html b/booklore-ui/src/app/app.component.html
index 93fea6949..b899f0920 100644
--- a/booklore-ui/src/app/app.component.html
+++ b/booklore-ui/src/app/app.component.html
@@ -1,4 +1,3 @@
{{ truncateText(book['title'], 90) }}
ISBN: {{ book['isbn13'] }}
+ISBN: {{ book['isbn10'] }}
|
Published: {{ book['publishedDate'] }}