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