Fix: Allow multiple users to add the same book to their shelves without errors (#1297)

This commit is contained in:
Aditya Chandel
2025-10-07 16:25:07 -06:00
committed by GitHub
parent b19381b29e
commit 5b16a25b47
@@ -113,7 +113,10 @@ public class BookService {
books.stream().map(Book::getId).collect(Collectors.toSet())
);
books.forEach(book -> enrichBookWithProgress(book, progressMap.get(book.getId())));
books.forEach(book -> {
enrichBookWithProgress(book, progressMap.get(book.getId()));
book.setShelves(filterShelvesByUserId(book.getShelves(), user.getId()));
});
return books;
}
@@ -647,5 +650,4 @@ public class BookService {
.filter(shelf -> userId.equals(shelf.getUserId()))
.collect(Collectors.toSet());
}
}
}