fix(api): book files cannot be left in a detached state (#2389)

This commit is contained in:
James Ward
2026-08-18 02:02:34 -04:00
committed by GitHub
parent 31b574d3a7
commit eb5d3905e0
2 changed files with 31 additions and 1 deletions
@@ -100,8 +100,8 @@ public class BookFileDetachmentService {
sourceBook.getBookFiles().remove(targetFile);
newBook.getBookFiles().add(targetFile);
bookRepository.saveAndFlush(sourceBook);
newBook = bookRepository.saveAndFlush(newBook);
bookRepository.saveAndFlush(sourceBook);
// Only save changes to the target file after the shift in relationship
// via source & new book or else we get a hibernate error.