diff --git a/src/main/java/com/magamochi/mangamochi/controller/ManagementController.java b/src/main/java/com/magamochi/mangamochi/controller/ManagementController.java index ec70588..ed38fec 100644 --- a/src/main/java/com/magamochi/mangamochi/controller/ManagementController.java +++ b/src/main/java/com/magamochi/mangamochi/controller/ManagementController.java @@ -4,6 +4,7 @@ import com.magamochi.mangamochi.client.NtfyClient; import com.magamochi.mangamochi.model.dto.DefaultResponseDTO; import com.magamochi.mangamochi.model.repository.UserRepository; import com.magamochi.mangamochi.task.ImageCleanupTask; +import com.magamochi.mangamochi.task.MangaFollowUpdateTask; import com.magamochi.mangamochi.task.UpdateMangaListTask; import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.*; public class ManagementController { private final UpdateMangaListTask updateMangaListTask; private final ImageCleanupTask imageCleanupTask; + private final MangaFollowUpdateTask mangaFollowUpdateTask; private final UserRepository userRepository; private final NtfyClient ntfyClient; @@ -43,6 +45,18 @@ public class ManagementController { return DefaultResponseDTO.ok().build(); } + @Operation( + summary = "Trigger user follow update", + description = "Trigger user follow update", + tags = {"Management"}, + operationId = "userFollowUpdate") + @PostMapping("user-follow") + public DefaultResponseDTO triggerUserFollowUpdate() { + mangaFollowUpdateTask.updateMangaList(); + + return DefaultResponseDTO.ok().build(); + } + @Operation( summary = "Test notification", description = "Sends a test notification to all users", @@ -56,7 +70,7 @@ public class ManagementController { user -> ntfyClient.notify( new NtfyClient.Request( - "mangamochi/" + user.getId().toString(), + "mangamochi-" + user.getId().toString(), "Mangamochi", "This is a test notification :)"))); diff --git a/src/main/java/com/magamochi/mangamochi/service/MangaService.java b/src/main/java/com/magamochi/mangamochi/service/MangaService.java index bc8090c..af57da5 100644 --- a/src/main/java/com/magamochi/mangamochi/service/MangaService.java +++ b/src/main/java/com/magamochi/mangamochi/service/MangaService.java @@ -144,7 +144,7 @@ public class MangaService { umf -> ntfyClient.notify( new NtfyClient.Request( - "mangamochi/" + umf.getUser().getId().toString(), + "mangamochi-" + umf.getUser().getId().toString(), umf.getManga().getTitle(), "New chapter available on " + mangaProvider.getProvider().getName()))); }