From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- code/api/src/Jobs/JobRegister.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 code/api/src/Jobs/JobRegister.cs (limited to 'code/api/src/Jobs/JobRegister.cs') diff --git a/code/api/src/Jobs/JobRegister.cs b/code/api/src/Jobs/JobRegister.cs new file mode 100644 index 0000000..1da7d5b --- /dev/null +++ b/code/api/src/Jobs/JobRegister.cs @@ -0,0 +1,23 @@ +namespace IOL.GreatOffice.Api.Jobs; + +public static class JobRegister +{ + private static readonly JobKey AccessTokenCleanupKey = new("AccessTokenCleanupKey"); + private static readonly JobKey VaultTokenRenewalKey = new("VaultTokenRenewalKey"); + + public static IServiceCollectionQuartzConfigurator RegisterJobs(this IServiceCollectionQuartzConfigurator configurator) { + configurator.AddJob(AccessTokenCleanupKey); + configurator.AddJob(VaultTokenRenewalKey); + configurator.AddTrigger(options => { + options.ForJob(AccessTokenCleanupKey) + .WithIdentity(AccessTokenCleanupKey.Name + "-trigger") + .WithCronSchedule("0 0 0/1 ? * * *"); + }); + configurator.AddTrigger(options => { + options.ForJob(VaultTokenRenewalKey) + .WithIdentity(VaultTokenRenewalKey.Name + "-trigger") + .WithCronSchedule("0 0 0/1 ? * * *"); + }); + return configurator; + } +} \ No newline at end of file -- cgit v1.3