mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-13 14:57:53 +02:00
Add Endpoint POST /v2/Manga/internalId/moveFolder #167
This commit is contained in:
@ -30,6 +30,7 @@ public partial class Server : GlobalBase, IDisposable
|
||||
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters", GetV2MangaInternalIdChapters),
|
||||
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters/Latest", GetV2MangaInternalIdChaptersLatest),
|
||||
new ("POST", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/ignoreChaptersBelow", PostV2MangaInternalIdIgnoreChaptersBelow),
|
||||
new ("POST", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/moveFolder", PostV2MangaInternalIdMoveFolder),
|
||||
new ("GET", @"/v2/Jobs", GetV2Jobs),
|
||||
new ("GET", @"/v2/Jobs/Running", GetV2JobsRunning),
|
||||
new ("GET", @"/v2/Jobs/Waiting", GetV2JobsWaiting),
|
||||
|
@ -92,4 +92,17 @@ public partial class Server
|
||||
}else
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.InternalServerError, "Parameter 'startChapter' missing, or failed to parse.");
|
||||
}
|
||||
|
||||
private ValueTuple<HttpStatusCode, object?> PostV2MangaInternalIdMoveFolder(GroupCollection groups, Dictionary<string, string> requestParameters)
|
||||
{
|
||||
|
||||
if(groups.Count < 1 ||
|
||||
!_parent.TryGetPublicationById(groups[1].Value, out Manga? manga) ||
|
||||
manga is null)
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.NotFound, $"Manga with ID '{groups[1].Value} could not be found.'");
|
||||
if(!requestParameters.TryGetValue("location", out string? newFolder))
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.BadRequest, "Parameter 'location' missing.");
|
||||
manga.Value.MovePublicationFolder(settings.downloadLocation, newFolder);
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, null);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user