From 3e947e8cafa84e6bb51a83fb659de835db94f04e Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Sat, 30 Aug 2025 16:22:11 -0700 Subject: [PATCH 1/3] Create indexes on postal code data for faster reads --- database/mistox.sql | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/database/mistox.sql b/database/mistox.sql index e7f744c..59032b3 100755 --- a/database/mistox.sql +++ b/database/mistox.sql @@ -186,18 +186,18 @@ CREATE TABLE IF NOT EXISTS `JobListingSkill` ( -- Postal Codes Section CREATE TABLE IF NOT EXISTS `PostalCodes` ( - `country code` char(2), - `postal code` varchar(20), - `place name` varchar(180), - `state` varchar(100), - `state code` varchar(20), - `city` varchar(100), - `admin code2` varchar(20), - `admin name3` varchar(100), - `admin code3` varchar(20), - `latitude` float, - `longitude` float, - `accuracy` varchar(2) + `CountryCode` char(2), + `PostalCode` varchar(20), + `City` varchar(180), + `State` varchar(100), + `StateCode` varchar(20), + `County` varchar(100), + `CountyCode` varchar(20), + `Admin` varchar(100), + `AdminCode` varchar(20), + `Latitude` float, + `Longitude` float, + `Accuracy` varchar(2) ); LOAD DATA INFILE '/var/lib/mysql-files/postalcodes.csv' @@ -206,6 +206,11 @@ FIELDS TERMINATED BY '\t' ENCLOSED BY '"' LINES TERMINATED BY '\n'; +CREATE INDEX idx_country_code ON PostalCodes(CountryCode); +CREATE INDEX idx_postal_code ON PostalCodes(PostalCode); +CREATE INDEX idx_latitude ON PostalCodes(Latitude); +CREATE INDEX idx_longitude ON PostalCodes(Longitude); + -- Application Section CREATE TABLE IF NOT EXISTS `JobApplication` ( -- 2.52.0 From 14b2b81bb7f6bfe7baa79bc6586471d7da68b442 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Sat, 30 Aug 2025 23:57:00 +0000 Subject: [PATCH 2/3] Update ToDo.yaml --- ToDo.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ToDo.yaml b/ToDo.yaml index f7fefa8..b3076a6 100755 --- a/ToDo.yaml +++ b/ToDo.yaml @@ -50,6 +50,9 @@ Client: Company: Need to impliment Add employee Need to impliment Remove employee + Add comment fields to companies for company conversions + This should solve invisible overtime + Goes along with the ratings AI Resume Rating: Allow companies to determine if the resume looks AI -> add rating -- 2.52.0 From 34dca5f57fe6a3ecfbf91201745707d601667526 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Mon, 1 Sep 2025 10:16:38 -0700 Subject: [PATCH 3/3] Update to mailkit for better email standard --- ToDo.yaml | 3 +- src/Server/Controllers/CompanyController.cs | 2 +- src/Server/Server.csproj | 1 + .../BackgroundServices/JobCleanupService.cs | 2 +- .../Services/EmailService/EmailService.cs | 41 +++++++++++-------- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/ToDo.yaml b/ToDo.yaml index f7fefa8..56da51e 100755 --- a/ToDo.yaml +++ b/ToDo.yaml @@ -12,7 +12,8 @@ Server: Need to update notification email Create page to notify cx that their work email has been verified - Verify that each resume section belongs to the resume it was created for: + Emails: + Make emails follow theme of website better Client: jobs/editor: diff --git a/src/Server/Controllers/CompanyController.cs b/src/Server/Controllers/CompanyController.cs index 003d06f..ff678d5 100644 --- a/src/Server/Controllers/CompanyController.cs +++ b/src/Server/Controllers/CompanyController.cs @@ -91,7 +91,7 @@ namespace BoredCareers.Controllers { EmailContents = Substitue(EmailContents, "@ID", CompanyID.ToString()); EmailContents = Substitue(EmailContents, "@VerifyPassword", test.EmailToken); - string result = _emailContext.Send(test.Email, EmailService.CompanyVerifyEmailSubject, EmailContents); + string result = await _emailContext.Send(test.Email, EmailService.CompanyVerifyEmailSubject, EmailContents); _emailContext._SentEmails.Add(key, DateTime.Now); return Redirect("/"); } diff --git a/src/Server/Server.csproj b/src/Server/Server.csproj index 88017e7..d455416 100755 --- a/src/Server/Server.csproj +++ b/src/Server/Server.csproj @@ -9,6 +9,7 @@ + diff --git a/src/Server/Services/BackgroundServices/JobCleanupService.cs b/src/Server/Services/BackgroundServices/JobCleanupService.cs index d943280..56a6fbb 100644 --- a/src/Server/Services/BackgroundServices/JobCleanupService.cs +++ b/src/Server/Services/BackgroundServices/JobCleanupService.cs @@ -51,7 +51,7 @@ namespace BoredCareers.Services.TimerService { string emailbody = EmailService.JobAutoClosedBody; //Substitue(emailbody, "@job", listing.JobListingID); - _em.Send(email, EmailService.JobAutoClosedSubject, emailbody); + await _em.Send(email, EmailService.JobAutoClosedSubject, emailbody); } } diff --git a/src/Server/Services/EmailService/EmailService.cs b/src/Server/Services/EmailService/EmailService.cs index a98fae8..ea0322b 100755 --- a/src/Server/Services/EmailService/EmailService.cs +++ b/src/Server/Services/EmailService/EmailService.cs @@ -1,4 +1,7 @@ -using System.Net.Mail; +using System.Threading.Tasks; +using MailKit.Net.Smtp; +using MailKit.Security; +using MimeKit; namespace BoredCareers.Services { public partial class EmailService { @@ -17,24 +20,28 @@ namespace BoredCareers.Services { EmailPassword = _EmailPassword; } - public string Send( string Destination, string Subject, string Body ) { - using (SmtpClient client = new SmtpClient( EmailServer, EmailPort )){ - client.EnableSsl = true; - client.Credentials = new System.Net.NetworkCredential( EmailAddress, EmailPassword ); - try { - MailMessage msg = new MailMessage(){ - IsBodyHtml = true, - Subject = Subject, - Body = Body - }; - msg.From = new MailAddress( EmailAddress, "no-reply" ); - msg.To.Add( new MailAddress( Destination ) ); - client.Send( msg ); - return "Success"; - } catch( Exception e ) { + public async Task Send(string Destination, string Subject, string Body) { + try { + MimeMessage message = new MimeMessage(); + message.From.Add(new MailboxAddress(EmailAddress.Split('@')[0], EmailAddress)); + message.To.Add(new MailboxAddress(Destination.Split('@')[0], Destination)); + message.Subject = Subject; + + BodyBuilder messageBody = new BodyBuilder(); + messageBody.HtmlBody = Body; + + message.Body = messageBody.ToMessageBody(); + + using (SmtpClient client = new SmtpClient()) { + await client.ConnectAsync(EmailServer, EmailPort); + client.Authenticate(new SaslMechanismLogin(EmailAddress, EmailPassword)); + string serverResponse = await client.SendAsync(message); + await client.DisconnectAsync(true); + return serverResponse; + } + } catch (Exception e) { return "An Error Has Occurred Sending Email : " + e.ToString(); } - } } } -- 2.52.0