From be72d4ba9781916c9c4f95538ced53d7cfb74f0e Mon Sep 17 00:00:00 2001 From: Glax Date: Thu, 13 Mar 2025 16:52:40 +0100 Subject: [PATCH] Add Endpoint to return Jobs with State and Type combined --- API/Controllers/JobController.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs index 2b7e80c..9383f7c 100644 --- a/API/Controllers/JobController.cs +++ b/API/Controllers/JobController.cs @@ -63,6 +63,20 @@ public class JobController(PgsqlContext context) : Controller return Ok(jobsOfType); } + /// + /// Returns all Jobs of requested Type and State + /// + /// Requested Job-Type + /// Requested Job-State + /// + [HttpGet("TypeAndState/{JobType}/{JobState}")] + [ProducesResponseType(Status200OK, "application/json")] + public IActionResult GetJobsOfType(JobType JobType, JobState JobState) + { + Job[] jobsOfType = context.Jobs.Where(job => job.JobType == JobType && job.state == JobState).ToArray(); + return Ok(jobsOfType); + } + /// /// Return Job with ID ///