feat: добавил напоминания о лекциях
Backend CI / build-and-test (push) Successful in 51s
Frontend CI / build-and-check (push) Failing after 5m11s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 14s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m20s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 23s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 11s

This commit is contained in:
2026-05-16 11:19:31 +03:00
parent 373e551bea
commit 926688cd2e
6 changed files with 250 additions and 10 deletions
@@ -19,13 +19,17 @@ public class QuartzNotificationScheduler : INotificationScheduler
_logger = logger;
}
public async Task<ScheduledNotificationResponse> ScheduleAsync(NotificationMessage message, DateTimeOffset sendAt, CancellationToken cancellationToken = default)
public async Task<ScheduledNotificationResponse> ScheduleAsync(
NotificationMessage message,
DateTimeOffset sendAt,
string? jobId = null,
CancellationToken cancellationToken = default)
{
if (sendAt <= DateTimeOffset.UtcNow)
throw new ArgumentException("Scheduled notification time must be in the future.", nameof(sendAt));
var scheduler = await _schedulerFactory.GetScheduler(cancellationToken);
var jobId = Guid.NewGuid().ToString("N");
jobId ??= Guid.NewGuid().ToString("N");
var jobKey = new JobKey(jobId, NotificationGroup);
var payload = JsonSerializer.Serialize(message);
@@ -45,4 +49,14 @@ public class QuartzNotificationScheduler : INotificationScheduler
return new ScheduledNotificationResponse(jobId, sendAt);
}
public async Task CancelAsync(string jobId, CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(jobId);
var scheduler = await _schedulerFactory.GetScheduler(cancellationToken);
var deleted = await scheduler.DeleteJob(new JobKey(jobId, NotificationGroup), cancellationToken);
if (deleted)
_logger.LogInformation("Cancelled notification job {JobId}", jobId);
}
}