diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs
index 6b71294..85d994d 100644
--- a/API/Controllers/JobController.cs
+++ b/API/Controllers/JobController.cs
@@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{version:apiVersion}/[controller]")]
public class JobController(PgsqlContext context) : Controller
{
@@ -17,7 +16,7 @@ public class JobController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetAllJobs()
{
Job[] ret = context.Jobs.ToArray();
@@ -30,7 +29,7 @@ public class JobController(PgsqlContext context) : Controller
/// Array of Job-IDs
///
[HttpPost("WithIDs")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetJobs([FromBody]string[] ids)
{
Job[] ret = context.Jobs.Where(job => ids.Contains(job.JobId)).ToArray();
@@ -43,7 +42,7 @@ public class JobController(PgsqlContext context) : Controller
/// Requested Job-State
///
[HttpGet("State/{state}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetJobsInState(JobState state)
{
Job[] jobsInState = context.Jobs.Where(job => job.state == state).ToArray();
@@ -56,7 +55,7 @@ public class JobController(PgsqlContext context) : Controller
/// Requested Job-Type
///
[HttpGet("Type/{type}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetJobsOfType(JobType type)
{
Job[] jobsOfType = context.Jobs.Where(job => job.JobType == type).ToArray();
@@ -70,7 +69,7 @@ public class JobController(PgsqlContext context) : Controller
///
/// Job with ID could not be found
[HttpGet("{id}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
public IActionResult GetJob(string id)
{
@@ -91,7 +90,7 @@ public class JobController(PgsqlContext context) : Controller
/// Error during Database Operation
[HttpPut("NewDownloadChapterJob/{mangaId}")]
[ProducesResponseType(Status201Created)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateNewDownloadChapterJob(string mangaId, [FromBody]ulong recurrenceTime)
{
Job job = new DownloadNewChaptersJob(recurrenceTime, mangaId);
@@ -106,7 +105,7 @@ public class JobController(PgsqlContext context) : Controller
/// Error during Database Operation
[HttpPut("DownloadSingleChapterJob/{chapterId}")]
[ProducesResponseType(Status201Created)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateNewDownloadChapterJob(string chapterId)
{
Job job = new DownloadSingleChapterJob(chapterId);
@@ -121,7 +120,7 @@ public class JobController(PgsqlContext context) : Controller
/// Error during Database Operation
[HttpPut("UpdateMetadataJob/{mangaId}")]
[ProducesResponseType(Status201Created)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateUpdateMetadataJob(string mangaId)
{
Job job = new UpdateMetadataJob(0, mangaId);
@@ -135,7 +134,7 @@ public class JobController(PgsqlContext context) : Controller
/// Error during Database Operation
[HttpPut("UpdateMetadataJob")]
[ProducesResponseType(Status201Created)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateUpdateAllMetadataJob()
{
List ids = context.Manga.Select(m => m.MangaId).ToList();
@@ -174,9 +173,9 @@ public class JobController(PgsqlContext context) : Controller
/// Job could not be found
/// Error during Database Operation
[HttpDelete("{id}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult DeleteJob(string id)
{
try
@@ -216,10 +215,10 @@ public class JobController(PgsqlContext context) : Controller
/// Job with ID not found
/// Error during Database Operation
[HttpPatch("{id}/")]
- [ProducesResponseType(Status202Accepted)]
+ [ProducesResponseType(Status202Accepted, "application/json")]
[ProducesResponseType(Status400BadRequest)]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult ModifyJob(string id, [FromBody]ModifyJobRecord modifyJobRecord)
{
try
@@ -252,7 +251,7 @@ public class JobController(PgsqlContext context) : Controller
[ProducesResponseType(Status202Accepted)]
[ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status409Conflict)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult StartJob(string id)
{
Job? ret = context.Jobs.Find(id);
diff --git a/API/Controllers/LibraryConnectorController.cs b/API/Controllers/LibraryConnectorController.cs
index 1660e14..bf734d4 100644
--- a/API/Controllers/LibraryConnectorController.cs
+++ b/API/Controllers/LibraryConnectorController.cs
@@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")]
public class LibraryConnectorController(PgsqlContext context) : Controller
{
@@ -17,7 +16,7 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetAllConnectors()
{
LibraryConnector[] connectors = context.LibraryConnectors.ToArray();
@@ -31,7 +30,7 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
///
/// Connector with ID not found.
[HttpGet("{id}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
public IActionResult GetConnector(string id)
{
@@ -47,11 +46,11 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
/// Creates a new Library-Connector
///
/// Library-Connector
- ///
+ ///
/// Error during Database Operation
[HttpPut]
- [ProducesResponseType(Status200OK)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status201Created)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateConnector([FromBody]LibraryConnector libraryConnector)
{
try
@@ -76,20 +75,18 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
[HttpDelete("{id}")]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult DeleteConnector(string id)
{
try
{
LibraryConnector? ret = context.LibraryConnectors.Find(id);
- switch (ret is not null)
- {
- case true:
- context.Remove(ret);
- context.SaveChanges();
- return Ok();
- case false: return NotFound();
- }
+ if (ret is null)
+ return NotFound();
+
+ context.Remove(ret);
+ context.SaveChanges();
+ return Ok();
}
catch (Exception e)
{
diff --git a/API/Controllers/MangaConnectorController.cs b/API/Controllers/MangaConnectorController.cs
index eae6123..ac297ec 100644
--- a/API/Controllers/MangaConnectorController.cs
+++ b/API/Controllers/MangaConnectorController.cs
@@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{v:apiVersion}")]
public class MangaConnectorController(PgsqlContext context) : Controller
{
@@ -17,7 +16,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetConnectors()
{
MangaConnector[] connectors = context.MangaConnectors.ToArray();
@@ -29,7 +28,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
///
///
[HttpGet("enabled")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetEnabledConnectors()
{
MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == true).ToArray();
@@ -41,7 +40,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
///
///
[HttpGet("disabled")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetDisabledConnectors()
{
MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == false).ToArray();
@@ -55,9 +54,11 @@ public class MangaConnectorController(PgsqlContext context) : Controller
/// Set true to enable
///
/// Connector with ID not found.
+ /// Error during Database Operation
[HttpPatch("{id}/SetEnabled/{enabled}")]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult SetEnabled(string id, bool enabled)
{
try
diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs
index 9f838c5..d1cf9ba 100644
--- a/API/Controllers/MangaController.cs
+++ b/API/Controllers/MangaController.cs
@@ -12,7 +12,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")]
public class MangaController(PgsqlContext context) : Controller
{
@@ -21,7 +20,7 @@ public class MangaController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetAllManga()
{
Manga[] ret = context.Manga.ToArray();
@@ -34,7 +33,7 @@ public class MangaController(PgsqlContext context) : Controller
/// Array of Manga-IDs
///
[HttpPost("WithIDs")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetManga([FromBody]string[] ids)
{
Manga[] ret = context.Manga.Where(m => ids.Contains(m.MangaId)).ToArray();
@@ -48,7 +47,7 @@ public class MangaController(PgsqlContext context) : Controller
///
/// Manga with ID not found
[HttpGet("{id}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
public IActionResult GetManga(string id)
{
@@ -68,7 +67,7 @@ public class MangaController(PgsqlContext context) : Controller
[HttpDelete("{id}")]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult DeleteManga(string id)
{
try
@@ -97,8 +96,7 @@ public class MangaController(PgsqlContext context) : Controller
/// The formatting-request was invalid
/// Manga with ID not found
[HttpPost("{id}/Cover")]
- [Produces("image/jpeg")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK,"image/jpeg")]
[ProducesResponseType(Status204NoContent)]
[ProducesResponseType(Status400BadRequest)]
[ProducesResponseType(Status404NotFound)]
@@ -135,7 +133,7 @@ public class MangaController(PgsqlContext context) : Controller
///
/// Manga with ID not found
[HttpGet("{id}/Chapters")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
public IActionResult GetChapters(string id)
{
@@ -156,10 +154,10 @@ public class MangaController(PgsqlContext context) : Controller
/// Manga with ID not found.
/// Could not retrieve the maximum chapter-number
[HttpGet("{id}/Chapter/Latest")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status204NoContent)]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult GetLatestChapter(string id)
{
Manga? m = context.Manga.Find(id);
@@ -184,7 +182,7 @@ public class MangaController(PgsqlContext context) : Controller
///
/// Manga with ID not found.
[HttpPatch("{id}/IgnoreChaptersBefore")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "text/plain")]
[ProducesResponseType(Status404NotFound)]
public IActionResult IgnoreChaptersBefore(string id)
{
diff --git a/API/Controllers/NotificationConnectorController.cs b/API/Controllers/NotificationConnectorController.cs
index 58381d4..f6c7ca7 100644
--- a/API/Controllers/NotificationConnectorController.cs
+++ b/API/Controllers/NotificationConnectorController.cs
@@ -17,7 +17,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
public IActionResult GetAllConnectors()
{
NotificationConnector[] ret = context.NotificationConnectors.ToArray();
@@ -31,7 +31,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
///
/// NotificationConnector with ID not found
[HttpGet("{id}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
public IActionResult GetConnector(string id)
{
@@ -50,8 +50,8 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
///
/// Error during Database Operation
[HttpPut]
- [ProducesResponseType(Status200OK)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status200OK, "application/json")]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult CreateConnector([FromBody]NotificationConnector notificationConnector)
{
try
@@ -76,7 +76,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
[HttpDelete("{id}")]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult DeleteConnector(string id)
{
try
diff --git a/API/Controllers/SearchController.cs b/API/Controllers/SearchController.cs
index e35e67c..a4a3920 100644
--- a/API/Controllers/SearchController.cs
+++ b/API/Controllers/SearchController.cs
@@ -10,7 +10,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")]
public class SearchController(PgsqlContext context) : Controller
{
@@ -22,8 +21,8 @@ public class SearchController(PgsqlContext context) : Controller
///
/// Error during Database Operation
[HttpPost("{name}")]
- [ProducesResponseType(Status200OK)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status200OK, "application/json")]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult SearchMangaGlobal(string name)
{
List<(Manga, List?, List?, List?, List?)> allManga = new();
@@ -57,10 +56,10 @@ public class SearchController(PgsqlContext context) : Controller
/// MangaConnector with ID is disabled
/// Error during Database Operation
[HttpPost("{id}/{name}")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status406NotAcceptable)]
- [ProducesResponseType(Status500InternalServerError)]
+ [ProducesResponseType(Status500InternalServerError, "text/plain")]
public IActionResult SearchManga(string id, string name)
{
MangaConnector? connector = context.MangaConnectors.Find(id);
diff --git a/API/Controllers/SettingsController.cs b/API/Controllers/SettingsController.cs
index 2906fcb..afb512b 100644
--- a/API/Controllers/SettingsController.cs
+++ b/API/Controllers/SettingsController.cs
@@ -9,7 +9,6 @@ namespace API.Controllers;
[ApiVersion(2)]
[ApiController]
-[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")]
public class SettingsController(PgsqlContext context) : Controller
{
@@ -18,7 +17,7 @@ public class SettingsController(PgsqlContext context) : Controller
///
///
[HttpGet]
- [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status200OK, "application/json")]
public IActionResult GetSettings()
{
return Ok(TrangaSettings.Serialize());
@@ -29,7 +28,7 @@ public class SettingsController(PgsqlContext context) : Controller
///
///
[HttpGet("UserAgent")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "text/plain")]
public IActionResult GetUserAgent()
{
return Ok(TrangaSettings.userAgent);
@@ -64,7 +63,7 @@ public class SettingsController(PgsqlContext context) : Controller
///
///
[HttpGet("RequestLimits")]
- [ProducesResponseType>(Status200OK)]
+ [ProducesResponseType>(Status200OK, "application/json")]
public IActionResult GetRequestLimits()
{
return Ok(TrangaSettings.requestLimits);
@@ -97,7 +96,7 @@ public class SettingsController(PgsqlContext context) : Controller
///
/// JPEG compression-level as Integer
[HttpGet("ImageCompression")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "text/plain")]
public IActionResult GetImageCompression()
{
return Ok(TrangaSettings.compression);
@@ -125,7 +124,7 @@ public class SettingsController(PgsqlContext context) : Controller
///
/// True if enabled
[HttpGet("BWImages")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "text/plain")]
public IActionResult GetBwImagesToggle()
{
return Ok(TrangaSettings.bwImages);
@@ -150,7 +149,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// April Fools Mode disables all downloads on April 1st
/// True if enabled
[HttpGet("AprilFoolsMode")]
- [ProducesResponseType(Status200OK)]
+ [ProducesResponseType(Status200OK, "text/plain")]
public IActionResult GetAprilFoolsMode()
{
return Ok(TrangaSettings.aprilFoolsMode);