Support File Move Operations with Watcher Refactor for Accurate Tracking

This commit is contained in:
aditya.chandel
2025-07-04 11:19:23 -06:00
committed by Aditya Chandel
parent 1c9c09628a
commit 841e359b92
73 changed files with 3714 additions and 852 deletions
@@ -420,9 +420,9 @@ export class BookService {
handleBookUpdate(updatedBook: Book) {
const currentState = this.bookStateSubject.value;
const updatedBooks = (currentState.books || []).map(book => {
return book.id == updatedBook.id ? {...book, metadata: updatedBook.metadata} : book
});
const updatedBooks = (currentState.books || []).map(book =>
book.id === updatedBook.id ? updatedBook : book
);
this.bookStateSubject.next({...currentState, books: updatedBooks});
}
@@ -56,6 +56,11 @@ export class LibraryShelfMenuService {
header: 'Confirmation',
rejectButtonProps: {
label: 'Cancel',
severity: 'secondary',
},
acceptButtonProps: {
label: 'Yes',
severity: 'success',
},
accept: () => {
this.libraryService.deleteLibrary(entity?.id!).subscribe({
@@ -84,6 +89,11 @@ export class LibraryShelfMenuService {
header: 'Confirmation',
rejectButtonProps: {
label: 'Cancel',
severity: 'secondary',
},
acceptButtonProps: {
label: 'Yes',
severity: 'success',
},
accept: () => {
this.libraryService.refreshLibrary(entity?.id!).subscribe({
@@ -120,7 +120,16 @@ export class LibraryService {
return this.libraryStateSubject.value.libraries || [];
}
getAllLibrariesFromAPI(): Observable<Library[]> {
return this.http.get <Library[]>(`${this.url}`);
getLibraryPathById(pathId: number): string | undefined {
const libraries = this.libraryStateSubject.value.libraries || [];
for (const library of libraries) {
const match = library.paths.find(p => p.id === pathId);
if (match) {
return match.path;
}
}
return undefined;
}
}