Display library name in metadata viewer page (#1211)

This commit is contained in:
Aditya Chandel
2025-09-25 21:05:43 -06:00
committed by GitHub
parent f82b22145c
commit bec721c21c
5 changed files with 15 additions and 10 deletions
@@ -22,6 +22,7 @@ import java.util.stream.Collectors;
public interface BookMapper { public interface BookMapper {
@Mapping(source = "library.id", target = "libraryId") @Mapping(source = "library.id", target = "libraryId")
@Mapping(source = "library.name", target = "libraryName")
@Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly") @Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly")
@Mapping(source = "metadata", target = "metadata") @Mapping(source = "metadata", target = "metadata")
@Mapping(source = "shelves", target = "shelves") @Mapping(source = "shelves", target = "shelves")
@@ -30,6 +31,7 @@ public interface BookMapper {
Book toBook(BookEntity bookEntity); Book toBook(BookEntity bookEntity);
@Mapping(source = "library.id", target = "libraryId") @Mapping(source = "library.id", target = "libraryId")
@Mapping(source = "library.name", target = "libraryName")
@Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly") @Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly")
@Mapping(source = "metadata", target = "metadata") @Mapping(source = "metadata", target = "metadata")
@Mapping(source = "shelves", target = "shelves") @Mapping(source = "shelves", target = "shelves")
@@ -37,14 +39,6 @@ public interface BookMapper {
@Mapping(source = "additionalFiles", target = "supplementaryFiles", qualifiedByName = "mapSupplementaryFiles") @Mapping(source = "additionalFiles", target = "supplementaryFiles", qualifiedByName = "mapSupplementaryFiles")
Book toBookWithDescription(BookEntity bookEntity, @Context boolean includeDescription); Book toBookWithDescription(BookEntity bookEntity, @Context boolean includeDescription);
@Mapping(source = "library.id", target = "libraryId")
@Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly")
@Mapping(target = "metadata", ignore = true)
@Mapping(target = "shelves", ignore = true)
@Mapping(target = "alternativeFormats", ignore = true)
@Mapping(target = "supplementaryFiles", ignore = true)
Book toBookWithoutMetadataAndShelves(BookEntity bookEntity);
default Set<String> mapAuthors(Set<AuthorEntity> authors) { default Set<String> mapAuthors(Set<AuthorEntity> authors) {
if (authors == null) return null; if (authors == null) return null;
return authors.stream() return authors.stream()
@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
public interface BookMapperV2 { public interface BookMapperV2 {
@Mapping(source = "library.id", target = "libraryId") @Mapping(source = "library.id", target = "libraryId")
@Mapping(source = "library.name", target = "libraryName")
@Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly") @Mapping(source = "libraryPath", target = "libraryPath", qualifiedByName = "mapLibraryPathIdOnly")
@Mapping(target = "metadata", qualifiedByName = "mapMetadata") @Mapping(target = "metadata", qualifiedByName = "mapMetadata")
Book toDTO(BookEntity bookEntity); Book toDTO(BookEntity bookEntity);
@@ -17,6 +17,7 @@ public class Book {
private Long id; private Long id;
private BookFileType bookType; private BookFileType bookType;
private Long libraryId; private Long libraryId;
private String libraryName;
private String fileName; private String fileName;
private String filePath; private String filePath;
private String fileSubPath; private String fileSubPath;
@@ -28,6 +28,7 @@ export interface Book extends FileInfo {
id: number; id: number;
bookType: BookType; bookType: BookType;
libraryId: number; libraryId: number;
libraryName: string;
metadata?: BookMetadata; metadata?: BookMetadata;
shelves?: Shelf[]; shelves?: Shelf[];
lastReadTime?: string; lastReadTime?: string;
@@ -69,7 +69,9 @@
<div class="flex flex-col items-center md:items-start gap-1"> <div class="flex flex-col items-center md:items-start gap-1">
<div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left"> <div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left">
<h2 class="text-2xl md:text-3xl font-extrabold leading-tight"> <h2 class="text-2xl md:text-3xl font-extrabold leading-tight">
{{ book?.metadata?.title }}@if (book?.metadata?.subtitle) {: {{ book.metadata?.subtitle }}} {{ book?.metadata?.title }}@if (book?.metadata?.subtitle) {
: {{ book.metadata?.subtitle }}
}
</h2> </h2>
<i <i
class="pi align-middle" class="pi align-middle"
@@ -229,6 +231,12 @@
<div class="px-1 md:px-0"> <div class="px-1 md:px-0">
<div class="grid md:grid-cols-4 gap-y-2.5 text-sm pt-2 md:pt-4 pb-2 text-gray-300 md:min-w-[60rem] md:max-w-[100rem]"> <div class="grid md:grid-cols-4 gap-y-2.5 text-sm pt-2 md:pt-4 pb-2 text-gray-300 md:min-w-[60rem] md:max-w-[100rem]">
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
<span class="font-bold">Library: </span>
@if (book?.libraryName) {
<span>{{ book.libraryName }}</span>
}
</p>
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis"> <p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
<span class="font-bold">Publisher: </span> <span class="font-bold">Publisher: </span>
@if (book?.metadata?.publisher) { @if (book?.metadata?.publisher) {
@@ -241,7 +249,6 @@
</p> </p>
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p> <p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p> <p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
<p class="whitespace-nowrap flex items-center gap-2"> <p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">File Type:</span> <span class="font-bold">File Type:</span>
<span <span
@@ -378,6 +385,7 @@
</div> </div>
} }
<p><strong>Page Count:</strong> {{ book?.metadata!.pageCount || '-' }}</p> <p><strong>Page Count:</strong> {{ book?.metadata!.pageCount || '-' }}</p>
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">