mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-13 03:43:17 +02:00
Fix Endpoint ignorechaptersbefore
This commit is contained in:
parent
3ba1261f31
commit
2ca43e6f5d
@ -260,15 +260,27 @@ public class MangaController(PgsqlContext context) : Controller
|
||||
/// <param name="MangaId">Manga-ID</param>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="404">Manga with ID not found.</response>
|
||||
/// <response code="500">Error during Database Operation</response>
|
||||
[HttpPatch("{MangaId}/IgnoreChaptersBefore")]
|
||||
[ProducesResponseType<float>(Status200OK, "text/plain")]
|
||||
[ProducesResponseType(Status200OK)]
|
||||
[ProducesResponseType(Status404NotFound)]
|
||||
public IActionResult IgnoreChaptersBefore(string MangaId)
|
||||
[ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
|
||||
public IActionResult IgnoreChaptersBefore(string MangaId, [FromBody]float chapterThreshold)
|
||||
{
|
||||
Manga? m = context.Manga.Find(MangaId);
|
||||
if (m is null)
|
||||
return NotFound();
|
||||
return Ok(m.IgnoreChapterBefore);
|
||||
|
||||
try
|
||||
{
|
||||
m.IgnoreChapterBefore = chapterThreshold;
|
||||
context.SaveChanges();
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(500, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user