summaryrefslogtreecommitdiffstats
path: root/src/server/Jobs/JobRegister.cs
blob: 98eac9751fb339d12a3fb1d8a141c8e1dc34ea6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using Quartz;

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;
	}
}