From 94678e744f1832084582116853feba20cc6fd318 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 8 Mar 2025 13:26:07 +0100 Subject: [PATCH] Replace occurences of "ID" with more meaningful names in documentation --- API/Controllers/JobController.cs | 80 +++++++++---------- API/Controllers/LibraryConnectorController.cs | 16 ++-- API/Controllers/MangaConnectorController.cs | 2 +- API/Controllers/MangaController.cs | 62 +++++++------- .../NotificationConnectorController.cs | 16 ++-- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs index d321c6c..87728c7 100644 --- a/API/Controllers/JobController.cs +++ b/API/Controllers/JobController.cs @@ -40,41 +40,41 @@ public class JobController(PgsqlContext context) : Controller /// /// Get all Jobs in requested State /// - /// Requested Job-State + /// Requested Job-State /// - [HttpGet("State/{state}")] + [HttpGet("State/{JobState}")] [ProducesResponseType(Status200OK, "application/json")] - public IActionResult GetJobsInState(JobState state) + public IActionResult GetJobsInState(JobState JobState) { - Job[] jobsInState = context.Jobs.Where(job => job.state == state).ToArray(); + Job[] jobsInState = context.Jobs.Where(job => job.state == JobState).ToArray(); return Ok(jobsInState); } /// /// Returns all Jobs of requested Type /// - /// Requested Job-Type + /// Requested Job-Type /// - [HttpGet("Type/{type}")] + [HttpGet("Type/{JobType}")] [ProducesResponseType(Status200OK, "application/json")] - public IActionResult GetJobsOfType(JobType type) + public IActionResult GetJobsOfType(JobType JobType) { - Job[] jobsOfType = context.Jobs.Where(job => job.JobType == type).ToArray(); + Job[] jobsOfType = context.Jobs.Where(job => job.JobType == JobType).ToArray(); return Ok(jobsOfType); } /// /// Return Job with ID /// - /// Job-ID + /// Job-ID /// /// Job with ID could not be found - [HttpGet("{id}")] + [HttpGet("{JobId}")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] - public IActionResult GetJob(string id) + public IActionResult GetJob(string JobId) { - Job? ret = context.Jobs.Find(id); + Job? ret = context.Jobs.Find(JobId); return (ret is not null) switch { true => Ok(ret), @@ -85,46 +85,46 @@ public class JobController(PgsqlContext context) : Controller /// /// Create a new CreateNewDownloadChapterJob /// - /// ID of Manga + /// ID of Manga /// How often should we check for new chapters /// Created new Job /// Error during Database Operation - [HttpPut("NewDownloadChapterJob/{mangaId}")] + [HttpPut("NewDownloadChapterJob/{MangaId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult CreateNewDownloadChapterJob(string mangaId, [FromBody]ulong recurrenceTime) + public IActionResult CreateNewDownloadChapterJob(string MangaId, [FromBody]ulong recurrenceTime) { - Job job = new DownloadNewChaptersJob(recurrenceTime, mangaId); + Job job = new DownloadNewChaptersJob(recurrenceTime, MangaId); return AddJob(job); } /// /// Create a new DownloadSingleChapterJob /// - /// ID of the Chapter + /// ID of the Chapter /// Created new Job /// Error during Database Operation - [HttpPut("DownloadSingleChapterJob/{chapterId}")] + [HttpPut("DownloadSingleChapterJob/{ChapterId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult CreateNewDownloadChapterJob(string chapterId) + public IActionResult CreateNewDownloadChapterJob(string ChapterId) { - Job job = new DownloadSingleChapterJob(chapterId); + Job job = new DownloadSingleChapterJob(ChapterId); return AddJob(job); } /// /// Create a new UpdateMetadataJob /// - /// ID of the Manga + /// ID of the Manga /// Created new Job /// Error during Database Operation - [HttpPut("UpdateMetadataJob/{mangaId}")] + [HttpPut("UpdateMetadataJob/{MangaId}")] [ProducesResponseType(Status201Created)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult CreateUpdateMetadataJob(string mangaId) + public IActionResult CreateUpdateMetadataJob(string MangaId) { - Job job = new UpdateMetadataJob(0, mangaId); + Job job = new UpdateMetadataJob(0, MangaId); return AddJob(job); } @@ -169,22 +169,22 @@ public class JobController(PgsqlContext context) : Controller /// /// Delete Job with ID and all children /// - /// Job-ID + /// Job-ID /// Job(s) deleted /// Job could not be found /// Error during Database Operation - [HttpDelete("{id}")] + [HttpDelete("{JobId}")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult DeleteJob(string id) + public IActionResult DeleteJob(string JobId) { try { - Job? ret = context.Jobs.Find(id); + Job? ret = context.Jobs.Find(JobId); if(ret is null) return NotFound(); - IQueryable children = GetChildJobs(id); + IQueryable children = GetChildJobs(JobId); context.RemoveRange(children); context.Remove(ret); @@ -209,22 +209,22 @@ public class JobController(PgsqlContext context) : Controller /// /// Modify Job with ID /// - /// Job-ID + /// Job-ID /// Fields to modify, set to null to keep previous value /// Job modified /// Malformed request /// Job with ID not found /// Error during Database Operation - [HttpPatch("{id}/")] + [HttpPatch("{JobId}")] [ProducesResponseType(Status202Accepted, "application/json")] [ProducesResponseType(Status400BadRequest)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult ModifyJob(string id, [FromBody]ModifyJobRecord modifyJobRecord) + public IActionResult ModifyJob(string JobId, [FromBody]ModifyJobRecord modifyJobRecord) { try { - Job? ret = context.Jobs.Find(id); + Job? ret = context.Jobs.Find(JobId); if(ret is null) return NotFound(); @@ -243,19 +243,19 @@ public class JobController(PgsqlContext context) : Controller /// /// Starts the Job with the requested ID /// - /// Job-ID + /// Job-ID /// Job started /// Job with ID not found /// Job was already running /// Error during Database Operation - [HttpPost("{id}/Start")] + [HttpPost("{JobId}/Start")] [ProducesResponseType(Status202Accepted)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status409Conflict)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult StartJob(string id) + public IActionResult StartJob(string JobId) { - Job? ret = context.Jobs.Find(id); + Job? ret = context.Jobs.Find(JobId); if (ret is null) return NotFound(); try @@ -275,10 +275,10 @@ public class JobController(PgsqlContext context) : Controller /// /// Stops the Job with the requested ID /// - /// Job-ID + /// Job-ID /// NOT IMPLEMENTED - [HttpPost("{id}/Stop")] - public IActionResult StopJob(string id) + [HttpPost("{JobId}/Stop")] + public IActionResult StopJob(string JobId) { throw new NotImplementedException(); } diff --git a/API/Controllers/LibraryConnectorController.cs b/API/Controllers/LibraryConnectorController.cs index bf734d4..4a7ee66 100644 --- a/API/Controllers/LibraryConnectorController.cs +++ b/API/Controllers/LibraryConnectorController.cs @@ -26,15 +26,15 @@ public class LibraryConnectorController(PgsqlContext context) : Controller /// /// Returns Library-Connector with requested ID /// - /// Library-Connector-ID + /// Library-Connector-ID /// /// Connector with ID not found. - [HttpGet("{id}")] + [HttpGet("{LibraryControllerId}")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] - public IActionResult GetConnector(string id) + public IActionResult GetConnector(string LibraryControllerId) { - LibraryConnector? ret = context.LibraryConnectors.Find(id); + LibraryConnector? ret = context.LibraryConnectors.Find(LibraryControllerId); return (ret is not null) switch { true => Ok(ret), @@ -68,19 +68,19 @@ public class LibraryConnectorController(PgsqlContext context) : Controller /// /// Deletes the Library-Connector with the requested ID /// - /// Library-Connector-ID + /// Library-Connector-ID /// /// Connector with ID not found. /// Error during Database Operation - [HttpDelete("{id}")] + [HttpDelete("{LibraryControllerId}")] [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult DeleteConnector(string id) + public IActionResult DeleteConnector(string LibraryControllerId) { try { - LibraryConnector? ret = context.LibraryConnectors.Find(id); + LibraryConnector? ret = context.LibraryConnectors.Find(LibraryControllerId); if (ret is null) return NotFound(); diff --git a/API/Controllers/MangaConnectorController.cs b/API/Controllers/MangaConnectorController.cs index ac297ec..7b0dc1b 100644 --- a/API/Controllers/MangaConnectorController.cs +++ b/API/Controllers/MangaConnectorController.cs @@ -55,7 +55,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller /// /// Connector with ID not found. /// Error during Database Operation - [HttpPatch("{id}/SetEnabled/{enabled}")] + [HttpPatch("{MangaConnectorName}/SetEnabled/{enabled}")] [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs index a3c930c..dc67405 100644 --- a/API/Controllers/MangaController.cs +++ b/API/Controllers/MangaController.cs @@ -44,15 +44,15 @@ public class MangaController(PgsqlContext context) : Controller /// /// Return Manga with ID /// - /// Manga-ID + /// Manga-ID /// /// Manga with ID not found - [HttpGet("{id}")] + [HttpGet("{MangaId}")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] - public IActionResult GetManga(string id) + public IActionResult GetManga(string MangaId) { - Manga? ret = context.Manga.Find(id); + Manga? ret = context.Manga.Find(MangaId); if (ret is null) return NotFound(); return Ok(ret); @@ -61,19 +61,19 @@ public class MangaController(PgsqlContext context) : Controller /// /// Delete Manga with ID /// - /// Manga-ID + /// Manga-ID /// /// Manga with ID not found /// Error during Database Operation - [HttpDelete("{id}")] + [HttpDelete("{MangaId}")] [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult DeleteManga(string id) + public IActionResult DeleteManga(string MangaId) { try { - Manga? ret = context.Manga.Find(id); + Manga? ret = context.Manga.Find(MangaId); if (ret is null) return NotFound(); @@ -90,20 +90,20 @@ public class MangaController(PgsqlContext context) : Controller /// /// Returns Cover of Manga /// - /// Manga-ID + /// Manga-ID /// Formatting/Resizing Request /// JPEG Image /// Cover not loaded /// The formatting-request was invalid /// Manga with ID not found - [HttpPost("{id}/Cover")] + [HttpPost("{MangaId}/Cover")] [ProducesResponseType(Status200OK,"image/jpeg")] [ProducesResponseType(Status204NoContent)] [ProducesResponseType(Status400BadRequest)] [ProducesResponseType(Status404NotFound)] - public IActionResult GetCover(string id, [FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow)]CoverFormatRequestRecord? formatRequest) + public IActionResult GetCover(string MangaId, [FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow)]CoverFormatRequestRecord? formatRequest) { - Manga? m = context.Manga.Find(id); + Manga? m = context.Manga.Find(MangaId); if (m is null) return NotFound(); if (!System.IO.File.Exists(m.CoverFileNameInCache)) @@ -130,15 +130,15 @@ public class MangaController(PgsqlContext context) : Controller /// /// Returns all Chapters of Manga /// - /// Manga-ID + /// Manga-ID /// /// Manga with ID not found - [HttpGet("{id}/Chapters")] + [HttpGet("{MangaId}/Chapters")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] - public IActionResult GetChapters(string id) + public IActionResult GetChapters(string MangaId) { - Manga? m = context.Manga.Find(id); + Manga? m = context.Manga.Find(MangaId); if (m is null) return NotFound(); @@ -149,19 +149,19 @@ public class MangaController(PgsqlContext context) : Controller /// /// Returns the latest Chapter of requested Manga available on Website /// - /// Manga-ID + /// Manga-ID /// /// No available chapters /// Manga with ID not found. /// Could not retrieve the maximum chapter-number - [HttpGet("{id}/Chapter/LatestAvailable")] + [HttpGet("{MangaId}/Chapter/LatestAvailable")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status204NoContent)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult GetLatestChapter(string id) + public IActionResult GetLatestChapter(string MangaId) { - Manga? m = context.Manga.Find(id); + Manga? m = context.Manga.Find(MangaId); if (m is null) return NotFound(); @@ -179,19 +179,19 @@ public class MangaController(PgsqlContext context) : Controller /// /// Returns the latest Chapter of requested Manga that is downloaded /// - /// Manga-ID + /// Manga-ID /// /// No available chapters /// Manga with ID not found. /// Could not retrieve the maximum chapter-number - [HttpGet("{id}/Chapter/LatestDownloaded")] + [HttpGet("{MangaId}/Chapter/LatestDownloaded")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status204NoContent)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult GetLatestChapterDownloaded(string id) + public IActionResult GetLatestChapterDownloaded(string MangaId) { - Manga? m = context.Manga.Find(id); + Manga? m = context.Manga.Find(MangaId); if (m is null) return NotFound(); @@ -209,15 +209,15 @@ public class MangaController(PgsqlContext context) : Controller /// /// Configure the cut-off for Manga /// - /// Manga-ID + /// Manga-ID /// /// Manga with ID not found. - [HttpPatch("{id}/IgnoreChaptersBefore")] + [HttpPatch("{MangaId}/IgnoreChaptersBefore")] [ProducesResponseType(Status200OK, "text/plain")] [ProducesResponseType(Status404NotFound)] - public IActionResult IgnoreChaptersBefore(string id) + public IActionResult IgnoreChaptersBefore(string MangaId) { - Manga? m = context.Manga.Find(id); + Manga? m = context.Manga.Find(MangaId); if (m is null) return NotFound(); return Ok(m.IgnoreChapterBefore); @@ -226,11 +226,11 @@ public class MangaController(PgsqlContext context) : Controller /// /// Move the Directory the .cbz-files are located in /// - /// Manga-ID + /// Manga-ID /// New Directory-Path /// NOT IMPLEMENTED - [HttpPost("{id}/MoveFolder")] - public IActionResult MoveFolder(string id, [FromBody]string folder) + [HttpPost("{MangaId}/MoveFolder")] + public IActionResult MoveFolder(string MangaId, [FromBody]string folder) { throw new NotImplementedException(); } diff --git a/API/Controllers/NotificationConnectorController.cs b/API/Controllers/NotificationConnectorController.cs index e9adddb..43797c8 100644 --- a/API/Controllers/NotificationConnectorController.cs +++ b/API/Controllers/NotificationConnectorController.cs @@ -29,15 +29,15 @@ public class NotificationConnectorController(PgsqlContext context) : Controller /// /// Returns Notification-Connector with requested ID /// - /// Notification-Connector-ID + /// Notification-Connector-ID /// /// NotificationConnector with ID not found - [HttpGet("{id}")] + [HttpGet("{NotificationConnectorId}")] [ProducesResponseType(Status200OK, "application/json")] [ProducesResponseType(Status404NotFound)] - public IActionResult GetConnector(string id) + public IActionResult GetConnector(string NotificationConnectorId) { - NotificationConnector? ret = context.NotificationConnectors.Find(id); + NotificationConnector? ret = context.NotificationConnectors.Find(NotificationConnectorId); return (ret is not null) switch { true => Ok(ret), @@ -161,19 +161,19 @@ public class NotificationConnectorController(PgsqlContext context) : Controller /// /// Deletes the Notification-Connector with the requested ID /// - /// Notification-Connector-ID + /// Notification-Connector-ID /// /// NotificationConnector with ID not found /// Error during Database Operation - [HttpDelete("{id}")] + [HttpDelete("{NotificationConnectorId}")] [ProducesResponseType(Status200OK)] [ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status500InternalServerError, "text/plain")] - public IActionResult DeleteConnector(string id) + public IActionResult DeleteConnector(string NotificationConnectorId) { try { - NotificationConnector? ret = context.NotificationConnectors.Find(id); + NotificationConnector? ret = context.NotificationConnectors.Find(NotificationConnectorId); if(ret is null) return NotFound();