add allowedFormats to mobile library endpoint and fix thumbnail classpath fallback
This commit is contained in:
@@ -5,6 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.booklore.model.enums.BookFileType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@@ -16,4 +19,5 @@ public class MobileLibrarySummary {
|
||||
private String name;
|
||||
private String icon;
|
||||
private long bookCount;
|
||||
private List<BookFileType> allowedFormats;
|
||||
}
|
||||
|
||||
@@ -283,6 +283,7 @@ public interface MobileBookMapper {
|
||||
.name(library.getName())
|
||||
.icon(library.getIcon())
|
||||
.bookCount(bookCount)
|
||||
.allowedFormats(library.getAllowedFormats())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +252,7 @@ public class BookService {
|
||||
if (Files.exists(thumbnailPath)) {
|
||||
return new UrlResource(thumbnailPath.toUri());
|
||||
} else {
|
||||
Path defaultCover = Paths.get("static/images/missing-cover.jpg");
|
||||
return new UrlResource(defaultCover.toUri());
|
||||
return new ClassPathResource("static/images/missing-cover.jpg");
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException("Failed to load book cover for bookId=" + bookId, e);
|
||||
|
||||
Reference in New Issue
Block a user