Compare commits
2 Commits
03c273abb8
...
d1741bcd32
| Author | SHA1 | Date | |
|---|---|---|---|
| d1741bcd32 | |||
| 89bcd058b6 |
@ -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<Void> 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 :)")));
|
||||
|
||||
|
||||
@ -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())));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user