From 2f4ed2efd04f31d4c9bf8be8f0c61e88c19d9a93 Mon Sep 17 00:00:00 2001 From: Stefan Hardegger Date: Wed, 22 Jul 2026 07:14:46 +0200 Subject: [PATCH] fix cover url export to audiocove --- .../com/storycove/service/StoryService.java | 30 +++++++++---------- docker-compose.yml | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/com/storycove/service/StoryService.java b/backend/src/main/java/com/storycove/service/StoryService.java index d113d27..fa0244e 100644 --- a/backend/src/main/java/com/storycove/service/StoryService.java +++ b/backend/src/main/java/com/storycove/service/StoryService.java @@ -211,25 +211,21 @@ public class StoryService { @Transactional public Story setCoverImage(UUID id, String imagePath) { Story story = findById(id); - - // Delete old cover if exists - if (story.getCoverPath() != null && !story.getCoverPath().isEmpty()) { - // Note: ImageService would be injected here in a real implementation - // For now, we just update the path - } - + story.setCoverPath(imagePath); - return storyRepository.save(story); + Story savedStory = storyRepository.save(story); + searchServiceAdapter.updateStory(savedStory); + return savedStory; } - - @Transactional + + @Transactional public void removeCoverImage(UUID id) { Story story = findById(id); - + if (story.getCoverPath() != null && !story.getCoverPath().isEmpty()) { - // Note: ImageService would be injected here to delete file story.setCoverPath(null); - storyRepository.save(story); + Story savedStory = storyRepository.save(story); + searchServiceAdapter.updateStory(savedStory); } } @@ -490,13 +486,17 @@ public class StoryService { public Story setCover(UUID id, String coverPath) { Story story = findById(id); story.setCoverPath(coverPath); - return storyRepository.save(story); + Story savedStory = storyRepository.save(story); + searchServiceAdapter.updateStory(savedStory); + return savedStory; } public Story removeCover(UUID id) { Story story = findById(id); story.setCoverPath(null); - return storyRepository.save(story); + Story savedStory = storyRepository.save(story); + searchServiceAdapter.updateStory(savedStory); + return savedStory; } public Story addToSeries(UUID storyId, UUID seriesId, Double volume) { diff --git a/docker-compose.yml b/docker-compose.yml index 03bc46d..05a1037 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,6 +43,7 @@ services: - STORYCOVE_CORS_ALLOWED_ORIGINS=${STORYCOVE_CORS_ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:6925} - AUDIOCOVE_URL=${AUDIOCOVE_URL:-} - AUDIOCOVE_API_KEY=${AUDIOCOVE_API_KEY:-} + - STORYCOVE_PUBLIC_URL=${STORYCOVE_PUBLIC_URL:-http://localhost:6925} volumes: - ${DATA_DIR:-/volume1/docker/storycove}/images:/app/images - ${DATA_DIR:-/volume1/docker/storycove}/config:/app/config