Files
Cleanuparr/code/Infrastructure/Models/JobSchedule.cs
Flaminel 9409346732 fix #20
2025-05-19 12:38:52 +03:00

39 lines
874 B
C#

using Infrastructure.Utilities;
namespace Infrastructure.Models;
/// <summary>
/// Represents the unit of time for job scheduling intervals
/// </summary>
public enum ScheduleUnit
{
Seconds,
Minutes,
Hours
}
/// <summary>
/// Represents a user-friendly job schedule format
/// </summary>
public class JobSchedule
{
/// <summary>
/// The numeric interval value
/// </summary>
public int Every { get; set; }
/// <summary>
/// The unit of time for the interval (seconds, minutes, or hours)
/// </summary>
public ScheduleUnit Type { get; set; }
/// <summary>
/// Converts the JobSchedule to a Quartz cron expression string
/// </summary>
/// <returns>A valid cron expression string</returns>
public string ToCronExpression()
{
return CronExpressionConverter.ConvertToCronExpression(this);
}
}