fix(file-move): ensure library monitoring is restored after file move and update tests (#2057)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
+5
-1
@@ -3,6 +3,7 @@ package com.adityachandel.booklore.service.file;
|
||||
import com.adityachandel.booklore.mapper.BookMapper;
|
||||
import com.adityachandel.booklore.mapper.LibraryMapper;
|
||||
import com.adityachandel.booklore.model.dto.FileMoveResult;
|
||||
import com.adityachandel.booklore.model.dto.Library;
|
||||
import com.adityachandel.booklore.model.dto.request.FileMoveRequest;
|
||||
import com.adityachandel.booklore.model.entity.BookEntity;
|
||||
import com.adityachandel.booklore.model.entity.LibraryEntity;
|
||||
@@ -182,7 +183,10 @@ public class FileMoveService {
|
||||
} finally {
|
||||
if (isLibraryMonitoredWhenCalled) {
|
||||
log.debug("Registering library paths for library {} with root {}", libraryId, libraryRoot);
|
||||
fileMoveHelper.registerLibraryPaths(libraryId, libraryRoot);
|
||||
LibraryEntity libraryEntity = bookEntity.getLibraryPath().getLibrary();
|
||||
Library library = libraryMapper.toLibrary(libraryEntity);
|
||||
library.setWatch(true);
|
||||
monitoringRegistrationService.registerLibrary(library);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user