* Fixed New Task creation

* Change Scheduler view
This commit is contained in:
2025-02-14 19:46:34 +01:00
parent c0fed5b3ec
commit d35955b461
5 changed files with 33 additions and 17 deletions

View File

@@ -88,21 +88,24 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
{
var tasks = await service.GetTaskSchedulers();
// foreach (TaskSchedulerDto taskSchedulerDto in tasks)
// {
// taskSchedulerDto.JobDetails = GetJob(taskSchedulerDto.Name);
// }
foreach (TaskSchedulerDto taskSchedulerDto in tasks)
{
var job = GetJob(taskSchedulerDto.Name);
taskSchedulerDto.LastExecution = job?.LastExecution;
taskSchedulerDto.NextExecution = job?.NextExecution;
}
return Ok(tasks);
}
private JobData? GetJob(string jobId)
private RecurringJobDto? GetJob(string jobId)
{
using IStorageConnection? connection = jobStorage.GetConnection();
return connection.GetJobData(jobId);
IList<RecurringJobDto>? recurringJobs = connection.GetRecurringJobs();
return recurringJobs.FirstOrDefault(x => x.Id == jobId);
}
private void RunConsoleApplication(string pathToApp)
public void RunConsoleApplication(string pathToApp)
{
try
{