Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

646 B
Raw Blame
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)
    {
        var destination = string.Empty;
        destination = source.ToLower() switch
        {
            "daily" => Cron.Daily(),
            "weekly" => Cron.Weekly(),
            "disabled" => Cron.Never(),
            "" => Cron.Never(),
            _ => destination
        };

        return destination;
    }
}