diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs
index b3ac3c9..bb0c311 100644
--- a/API/Controllers/MangaController.cs
+++ b/API/Controllers/MangaController.cs
@@ -292,24 +292,30 @@ public class MangaController(PgsqlContext context) : Controller
return StatusCode(500, e.Message);
}
}
-
+
///
- /// Move the Directory the .cbz-files are located in
+ /// Move Manga to different Library
///
/// Manga-ID
- /// New Directory-Path
+ /// Library-Id
/// Folder is going to be moved
+ /// MangaId or LibraryId not found
/// Error during Database Operation
- [HttpPost("{MangaId}/MoveFolder")]
+ [HttpPost("{MangaId}/ChangeLibrary/{LibraryId}")]
[ProducesResponseType(Status202Accepted)]
+ [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status500InternalServerError, "text/plain")]
- public IActionResult MoveFolder(string MangaId, [FromBody]string folder)
+ public IActionResult MoveFolder(string MangaId, string LibraryId)
{
Manga? manga = context.Mangas.Find(MangaId);
if (manga is null)
return NotFound();
- MoveFileOrFolderJob dep = manga.UpdateFolderName(TrangaSettings.downloadLocation, folder);
- UpdateFilesDownloadedJob up = new UpdateFilesDownloadedJob(0, manga.MangaId, null, [dep.JobId]);
+ LocalLibrary? library = context.LocalLibraries.Find(LibraryId);
+ if (library is null)
+ return NotFound();
+
+ MoveMangaLibraryJob dep = new (MangaId, LibraryId);
+ UpdateFilesDownloadedJob up = new (0, manga.MangaId, null, [dep.JobId]);
try
{