From 3305519307751edd62bdf196b8b3b68e3e447b2e Mon Sep 17 00:00:00 2001 From: Glax Date: Fri, 7 Mar 2025 12:31:10 +0100 Subject: [PATCH] JobController XML-Documentation --- API/Controllers/JobController.cs | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs index 8cbae82..303f36a 100644 --- a/API/Controllers/JobController.cs +++ b/API/Controllers/JobController.cs @@ -15,7 +15,7 @@ public class JobController(PgsqlContext context) : Controller /// /// Returns all Jobs /// - /// Array of Jobs + /// [HttpGet] [ProducesResponseType(Status200OK)] public IActionResult GetAllJobs() @@ -28,7 +28,7 @@ public class JobController(PgsqlContext context) : Controller /// Returns Jobs with requested Job-IDs /// /// Array of Job-IDs - /// Array of Jobs + /// [HttpPost("WithIDs")] [ProducesResponseType(Status200OK)] public IActionResult GetJobs([FromBody]string[] ids) @@ -41,7 +41,7 @@ public class JobController(PgsqlContext context) : Controller /// Get all Jobs in requested State /// /// Requested Job-State - /// Array of Jobs + /// [HttpGet("State/{state}")] [ProducesResponseType(Status200OK)] public IActionResult GetJobsInState(JobState state) @@ -54,7 +54,7 @@ public class JobController(PgsqlContext context) : Controller /// Returns all Jobs of requested Type /// /// Requested Job-Type - /// Array of Jobs + /// [HttpGet("Type/{type}")] [ProducesResponseType(Status200OK)] public IActionResult GetJobsOfType(JobType type) @@ -67,7 +67,8 @@ public class JobController(PgsqlContext context) : Controller /// Return Job with ID /// /// Job-ID - /// Job + /// + /// Job with ID could not be found [HttpGet("{id}")] [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] @@ -84,8 +85,10 @@ public class JobController(PgsqlContext context) : Controller /// /// Create a new CreateNewDownloadChapterJob /// - /// ID of the Manga, and how often we check again - /// Nothing + /// ID of Manga + /// How often should we check for new chapters + /// Created new Job + /// Error during Database Operation [HttpPut("NewDownloadChapterJob/{mangaId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError)] @@ -99,7 +102,8 @@ public class JobController(PgsqlContext context) : Controller /// Create a new DownloadSingleChapterJob /// /// ID of the Chapter - /// Nothing + /// Created new Job + /// Error during Database Operation [HttpPut("DownloadSingleChapterJob/{chapterId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError)] @@ -113,7 +117,8 @@ public class JobController(PgsqlContext context) : Controller /// Create a new UpdateMetadataJob /// /// ID of the Manga - /// Nothing + /// Created new Job + /// Error during Database Operation [HttpPut("UpdateMetadataJob/{mangaId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError)] @@ -126,7 +131,8 @@ public class JobController(PgsqlContext context) : Controller /// /// Create a new UpdateMetadataJob for all Manga /// - /// Nothing + /// Created new Job + /// Error during Database Operation [HttpPut("UpdateMetadataJob")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError)] @@ -161,12 +167,14 @@ public class JobController(PgsqlContext context) : Controller } /// - /// Delete Job with ID + /// Delete Job with ID and all children /// /// Job-ID - /// Nothing + /// Job(s) deleted + /// Job could not be found + /// Error during Database Operation [HttpDelete("{id}")] - [ProducesResponseType(Status200OK)] + [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError)] public IActionResult DeleteJob(string id) @@ -181,7 +189,7 @@ public class JobController(PgsqlContext context) : Controller context.RemoveRange(children); context.Remove(ret); context.SaveChanges(); - return Ok(); + return new OkObjectResult(children.Select(x => x.JobId).Append(ret.JobId).ToArray()); } catch (Exception e) { @@ -265,7 +273,7 @@ public class JobController(PgsqlContext context) : Controller } /// - /// NOT IMPLEMENTED. Stops the Job with the requested ID + /// Stops the Job with the requested ID /// /// Job-ID /// Job started