Ability to update settings. Take effect on next reboot.
This commit is contained in:
parent
e60f795410
commit
1050fa4e54
21 changed files with 953 additions and 146 deletions
41
API/Helpers/Converters/CronConverter.cs
Normal file
41
API/Helpers/Converters/CronConverter.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using Hangfire;
|
||||
|
||||
namespace API.Helpers.Converters
|
||||
{
|
||||
public static class CronConverter
|
||||
{
|
||||
public static readonly IEnumerable<string> Options = new []
|
||||
{
|
||||
"disabled",
|
||||
"daily",
|
||||
"weekly",
|
||||
};
|
||||
public static string ConvertToCronNotation(string source)
|
||||
{
|
||||
string destination = "";
|
||||
destination = source.ToLower() switch
|
||||
{
|
||||
"daily" => Cron.Daily(),
|
||||
"weekly" => Cron.Weekly(),
|
||||
"disabled" => Cron.Never(),
|
||||
"" => Cron.Never(),
|
||||
_ => destination
|
||||
};
|
||||
|
||||
return destination;
|
||||
}
|
||||
|
||||
public static string ConvertFromCronNotation(string cronNotation)
|
||||
{
|
||||
string destination = "";
|
||||
destination = cronNotation.ToLower() switch
|
||||
{
|
||||
"0 0 31 2 *" => "disabled",
|
||||
_ => destination
|
||||
};
|
||||
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue