Use JsonInclude in BookMetadata to remove nulls
This commit is contained in:
+8
@@ -10,12 +10,20 @@
|
||||
<div class="flex flex-col items-center gap-2 relative">
|
||||
|
||||
<img
|
||||
*ngIf="!metadata['thumbnailUrl']"
|
||||
[src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)"
|
||||
alt="Image"
|
||||
width="250"
|
||||
[ngClass]="{ 'brightness-50': isUploading }"
|
||||
class="transition-all duration-300 ease-in-out"/>
|
||||
|
||||
<img
|
||||
*ngIf="metadata['thumbnailUrl']"
|
||||
[src]="metadata['thumbnailUrl']"
|
||||
alt="Image"
|
||||
height="350"
|
||||
width="250"/>
|
||||
|
||||
<p-progressSpinner
|
||||
*ngIf="isUploading"
|
||||
class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10">
|
||||
|
||||
+20
-17
@@ -67,6 +67,7 @@ export class MetadataEditorComponent implements OnInit {
|
||||
seriesName: new FormControl(''),
|
||||
seriesNumber: new FormControl(''),
|
||||
seriesTotal: new FormControl(''),
|
||||
thumbnailUrl: new FormControl(''),
|
||||
|
||||
titleLocked: new FormControl(false),
|
||||
subtitleLocked: new FormControl(false),
|
||||
@@ -93,23 +94,24 @@ export class MetadataEditorComponent implements OnInit {
|
||||
if (metadata) {
|
||||
this.currentBookId = metadata.bookId;
|
||||
|
||||
this.metadataForm.setValue({
|
||||
title: metadata.title,
|
||||
subtitle: metadata.subtitle,
|
||||
authors: metadata.authors.sort().join(', '),
|
||||
categories: metadata.categories.sort().join(', '),
|
||||
publisher: metadata.publisher,
|
||||
publishedDate: metadata.publishedDate,
|
||||
isbn10: metadata.isbn10,
|
||||
isbn13: metadata.isbn13,
|
||||
description: metadata.description,
|
||||
pageCount: metadata.pageCount == 0 ? null : metadata.pageCount,
|
||||
language: metadata.language,
|
||||
rating: metadata.rating,
|
||||
reviewCount: metadata.reviewCount,
|
||||
seriesName: metadata.seriesName,
|
||||
seriesNumber: metadata.seriesNumber,
|
||||
seriesTotal: metadata.seriesTotal,
|
||||
this.metadataForm.patchValue({
|
||||
title: metadata.title || null,
|
||||
subtitle: metadata.subtitle || null,
|
||||
authors: (metadata.authors || []).sort().join(', '),
|
||||
categories: (metadata.categories || []).sort().join(', '),
|
||||
publisher: metadata.publisher || null,
|
||||
publishedDate: metadata.publishedDate || null,
|
||||
isbn10: metadata.isbn10 || null,
|
||||
isbn13: metadata.isbn13 || null,
|
||||
description: metadata.description || null,
|
||||
pageCount: metadata.pageCount || null,
|
||||
language: metadata.language || null,
|
||||
rating: metadata.rating || null,
|
||||
reviewCount: metadata.reviewCount || null,
|
||||
seriesName: metadata.seriesName || null,
|
||||
seriesNumber: metadata.seriesNumber || null,
|
||||
seriesTotal: metadata.seriesTotal || null,
|
||||
thumbnailUrl: metadata.thumbnailUrl || null,
|
||||
|
||||
titleLocked: metadata.titleLocked || false,
|
||||
subtitleLocked: metadata.subtitleLocked || false,
|
||||
@@ -215,6 +217,7 @@ export class MetadataEditorComponent implements OnInit {
|
||||
seriesName: this.metadataForm.get('seriesName')?.value,
|
||||
seriesNumber: this.metadataForm.get('seriesNumber')?.value,
|
||||
seriesTotal: this.metadataForm.get('seriesTotal')?.value,
|
||||
thumbnailUrl: this.metadataForm.get('thumbnailUrl')?.value,
|
||||
|
||||
titleLocked: this.metadataForm.get('titleLocked')?.value,
|
||||
subtitleLocked: this.metadataForm.get('subtitleLocked')?.value,
|
||||
|
||||
+17
-17
@@ -91,23 +91,23 @@ export class MetadataPickerComponent implements OnInit {
|
||||
this.bookMetadata$.subscribe((metadata) => {
|
||||
if (metadata) {
|
||||
this.currentBookId = metadata.bookId;
|
||||
this.metadataForm.setValue({
|
||||
title: metadata.title,
|
||||
subtitle: metadata.subtitle,
|
||||
authors: metadata.authors.sort().join(', '),
|
||||
categories: metadata.categories.sort().join(', '),
|
||||
publisher: metadata.publisher,
|
||||
publishedDate: metadata.publishedDate,
|
||||
isbn10: metadata.isbn10,
|
||||
isbn13: metadata.isbn13,
|
||||
description: metadata.description,
|
||||
pageCount: metadata.pageCount == 0 ? null : metadata.pageCount,
|
||||
language: metadata.language,
|
||||
rating: metadata.rating,
|
||||
reviewCount: metadata.reviewCount,
|
||||
seriesName: metadata.seriesName,
|
||||
seriesNumber: metadata.seriesNumber,
|
||||
seriesTotal: metadata.seriesTotal,
|
||||
this.metadataForm.patchValue({
|
||||
title: metadata.title || '',
|
||||
subtitle: metadata.subtitle || '',
|
||||
authors: (metadata.authors || []).sort().join(', '),
|
||||
categories: (metadata.categories || []).sort().join(', '),
|
||||
publisher: metadata.publisher || '',
|
||||
publishedDate: metadata.publishedDate || '',
|
||||
isbn10: metadata.isbn10 || '',
|
||||
isbn13: metadata.isbn13 || '',
|
||||
description: metadata.description || '',
|
||||
pageCount: metadata.pageCount || '',
|
||||
language: metadata.language || '',
|
||||
rating: metadata.rating || '',
|
||||
reviewCount: metadata.reviewCount || '',
|
||||
seriesName: metadata.seriesName || '',
|
||||
seriesNumber: metadata.seriesNumber || '',
|
||||
seriesTotal: metadata.seriesTotal || '',
|
||||
thumbnailUrl: this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn),
|
||||
|
||||
titleLocked: metadata.titleLocked || false,
|
||||
|
||||
+3
-3
@@ -46,10 +46,10 @@ export class MetadataSearcherComponent implements OnInit {
|
||||
this.metadataCenterService.currentMetadata$.subscribe((metadata => {
|
||||
if (metadata) {
|
||||
this.bookId = metadata.bookId;
|
||||
this.form.setValue(({
|
||||
this.form.patchValue(({
|
||||
provider: Object.values(MetadataProvider),
|
||||
isbn: metadata.isbn10,
|
||||
title: metadata.title,
|
||||
isbn: metadata.isbn10 || null,
|
||||
title: metadata.title || null,
|
||||
author: metadata.authors?.length! > 0 ? metadata.authors[0] : ''
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -25,12 +25,7 @@ export class MetadataService {
|
||||
}
|
||||
|
||||
quickUpdateBookMetadataSynchronous(bookId: number): Observable<BookMetadata> {
|
||||
return this.http.put<BookMetadata>(`${this.url}/${bookId}/refresh-book-sync`, {}).pipe(
|
||||
map(updatedMetadata => {
|
||||
this.bookService.handleBookMetadataUpdate(bookId, updatedMetadata);
|
||||
return updatedMetadata;
|
||||
})
|
||||
);
|
||||
return this.http.put<BookMetadata>(`${this.url}/${bookId}/refresh-book-sync`, {});
|
||||
}
|
||||
|
||||
updateBookMetadata(bookId: number, bookMetadata: BookMetadata): Observable<BookMetadata> {
|
||||
|
||||
Reference in New Issue
Block a user