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

namespace IOL.GreatOffice.Api.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;
	}
}