summaryrefslogtreecommitdiffstats
path: root/src/server/Jobs/JobRegister.cs
blob: a77db049b7a7193eef07a1d72e25ff566d5f867c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
namespace IOL.BookmarkThing.Server.Jobs;

public static class JobRegister
{
	public static readonly JobKey TokenCleanupKey = new("TokenCleanupJob");

	public static IServiceCollectionQuartzConfigurator RegisterJobs(this IServiceCollectionQuartzConfigurator configurator) {
		configurator.AddJob<TokenCleanupJob>(TokenCleanupKey);
		configurator.AddTrigger(options => {
			options.ForJob(TokenCleanupKey)
				   .WithIdentity(TokenCleanupKey.Name + "-trigger")
				   .WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(1, 0));
		});
		return configurator;
	}
}