diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs
index 712e3c3..49609f5 100644
--- a/API/Controllers/JobController.cs
+++ b/API/Controllers/JobController.cs
@@ -374,4 +374,25 @@ public class JobController(PgsqlContext context, ILog Log) : Controller
{
return StatusCode(Status501NotImplemented);
}
+
+ ///
+ /// Removes failed and completed Jobs (that are not recurring)
+ ///
+ /// Job started
+ /// Error during Database Operation
+ [HttpPost("Cleanup")]
+ public IActionResult CleanupJobs()
+ {
+ try
+ {
+ context.Jobs.RemoveRange(context.Jobs.Where(j => j.state == JobState.Failed || j.state == JobState.Completed));
+ context.SaveChanges();
+ return Ok();
+ }
+ catch (Exception e)
+ {
+ Log.Error(e);
+ return StatusCode(500, e.Message);
+ }
+ }
}
\ No newline at end of file