From 8148a245b9355b50d7fdd017411b760c811645a5 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Mon, 4 Aug 2025 17:39:43 -0700 Subject: [PATCH] Complete job cleanup service --- .../EmailService/JobAutoCloseEmail.cs | 52 +++++++++++++++++++ .../TimerServcie/JobCleanupService.cs | 10 ++-- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100755 src/Server/Services/EmailService/JobAutoCloseEmail.cs diff --git a/src/Server/Services/EmailService/JobAutoCloseEmail.cs b/src/Server/Services/EmailService/JobAutoCloseEmail.cs new file mode 100755 index 0000000..a1055f3 --- /dev/null +++ b/src/Server/Services/EmailService/JobAutoCloseEmail.cs @@ -0,0 +1,52 @@ +namespace BoredCareers.Services { + public partial class EmailService { + +// @UserName +// @VerifyPassword +// https://mistox.com/api/account/verifyemail?UserName=@UserName&Guid=@VerifyPassword + + public static string JobAutoClosedSubject = "Verify Your Email Address"; + public static string JobAutoClosedEmail = @" + + + + + + Verify Your Email + + + + + + +
+ + + + + + + + + + +
+

Verify Email Request

+
+

Hi @UserName,

+

Thank you for making an account with us:

+

In order to start using your account we need to verify your email address by clicking the link below:

+

+ Verify Email +

+

If you didn't create an account please ignore this email.

+

Best regards

+
+

If you have any questions, feel free to contact support.

+
+
+ +"; + + } +} \ No newline at end of file diff --git a/src/Server/Services/TimerServcie/JobCleanupService.cs b/src/Server/Services/TimerServcie/JobCleanupService.cs index 01e75a1..2e69d75 100644 --- a/src/Server/Services/TimerServcie/JobCleanupService.cs +++ b/src/Server/Services/TimerServcie/JobCleanupService.cs @@ -4,9 +4,11 @@ namespace BoredCareers.Services.TimerService { public class JobCleanupService : BackgroundService { private readonly DatabaseService.DatabaseService _db; + private readonly EmailService _em; - public JobCleanupService(DatabaseService.DatabaseService db) { + public JobCleanupService(DatabaseService.DatabaseService db, EmailService em) { _db = db; + _em = em; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { @@ -15,8 +17,10 @@ namespace BoredCareers.Services.TimerService { JobListing[] deletedJobListings = await _db.GetJobListingsPastExipre(); await _db.DeleteJobListingsPastExipre(); foreach (JobListing listing in deletedJobListings) { - // Get applicants for each closed listing - // Notify applicants of the listing closing + Application[] apps = await _db.GetApplicationsFromJobListing(Convert.ToInt32(listing.ID)); + foreach (Application app in apps) { + _em.Send(app.ResponseEmail, EmailService.JobAutoClosedSubject, EmailService.JobAutoClosedEmail); + } // Mark the company for the auto closed listing Company? comp = await _db.GetCompany(listing.CompanyID);