Added:
- fix progressbar
- {slug} {chapterNumber} in Url
- activity toolbar
This commit is contained in:
@@ -84,6 +84,22 @@ class MangaController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/manga/delete/{id}', name: 'app_manga_delete', methods: ['DELETE'])]
|
||||
public function deleteManga(Manga $manga): JsonResponse
|
||||
{
|
||||
try {
|
||||
foreach ($manga->getChapters() as $chapter) {
|
||||
$this->entityManager->remove($chapter);
|
||||
}
|
||||
$this->entityManager->remove($manga);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return new JsonResponse(['success' => true]);
|
||||
} catch (\Exception $e) {
|
||||
return new JsonResponse(['success' => false, 'error' => 'Unable to delete manga.'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function _chaptersByManga(int $id): Response
|
||||
{
|
||||
@@ -291,7 +307,7 @@ class MangaController extends AbstractController
|
||||
]);
|
||||
|
||||
if (empty($volumeChapters)) {
|
||||
$this->notificationService->sendUpdate(['error' => 'No chapters found for this volume.']);
|
||||
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'No chapters found for this volume.']);
|
||||
return new JsonResponse(['error' => 'No chapters found for this volume.'], 200);
|
||||
}
|
||||
|
||||
@@ -309,13 +325,13 @@ class MangaController extends AbstractController
|
||||
{
|
||||
$chapter = $this->chapterRepository->find($chapterId);
|
||||
if (!$chapter) {
|
||||
$this->notificationService->sendUpdate(['error' => 'Chapitre non trouvé.']);
|
||||
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Chapitre non trouvé.']);
|
||||
return new JsonResponse(['error' => 'Chapitre non trouvé.'], 200);
|
||||
}
|
||||
|
||||
$cbzPath = $chapter->getCbzPath();
|
||||
if (!$cbzPath || !file_exists($cbzPath)) {
|
||||
$this->notificationService->sendUpdate(['error' => 'Le fichier CBZ n\'existe pas.']);
|
||||
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Le fichier CBZ n\'existe pas.']);
|
||||
return new JsonResponse(['error' => 'Le fichier CBZ n\'existe pas.'], 200);
|
||||
}
|
||||
|
||||
@@ -338,11 +354,11 @@ class MangaController extends AbstractController
|
||||
]);
|
||||
|
||||
if (empty($volumeChapters)) {
|
||||
$this->notificationService->sendUpdate(['error' => 'Aucun chapitre trouvé pour ce volume.']);
|
||||
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Aucun chapitre trouvé pour ce volume.']);
|
||||
}
|
||||
|
||||
if (!$this->cbzService->doAllChaptersHaveCbz($volumeChapters)) {
|
||||
$this->notificationService->sendUpdate(['error' => 'Tous les chapitres du volume ne sont pas scrapés.']);
|
||||
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Tous les chapitres du volume ne sont pas scrapés.']);
|
||||
return new JsonResponse(['error' => 'Tous les chapitres du volume ne sont pas scrapés.'], 200);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user