diff --git a/ToDo.yaml b/ToDo.yaml index 254c716..be7ce42 100755 --- a/ToDo.yaml +++ b/ToDo.yaml @@ -18,6 +18,9 @@ Server: not closed successful jobs -> number For company rating for ghost listings + When Job Posting Closes Successful: + Update the company rating + Client: jobs/new: Job Listing Skills exists but isn't implimented in the UI diff --git a/database/mistox.sql b/database/mistox.sql index b7a19a1..bd5dcae 100755 --- a/database/mistox.sql +++ b/database/mistox.sql @@ -131,6 +131,8 @@ CREATE TABLE IF NOT EXISTS `Company` ( `EmailVerified` boolean DEFAULT 0, `WebsiteURL` varchar(255) DEFAULT NULL, `Logo` mediumblob DEFAULT NULL, + `JobsClosedSuccessful` int DEFAULT 0, + `JobsAutoClosed` int DEFAULT 0, `Phone` varchar(20) DEFAULT NULL, `PostalCode` varchar(20) NOT NULL, `Country` char(2) NOT NULL, diff --git a/src/Client/src/app/models/Company.ts b/src/Client/src/app/models/Company.ts index 80a1e65..ae79789 100644 --- a/src/Client/src/app/models/Company.ts +++ b/src/Client/src/app/models/Company.ts @@ -5,6 +5,8 @@ export class Company { public emailVerified: boolean = false; public websiteURL: string = ""; public logo: string = ""; + public jobsClosedSuccessful: number = 0; + public jobsAutoClosed: number = 0; public phone: string = ""; public postalCode: string = ""; public country: string = ""; // 2 Letter Country Code diff --git a/src/Server/Entities/Company.cs b/src/Server/Entities/Company.cs index 1d78a4b..b9d6b06 100644 --- a/src/Server/Entities/Company.cs +++ b/src/Server/Entities/Company.cs @@ -7,6 +7,8 @@ namespace BoredCareers.Entities { public bool EmailVerified { get; set; } = false; public string WebsiteURL { get; set; } = ""; public string Logo { get; set; } = ""; + public int JobsClosedSuccessful { get; set; } = 0; + public int JobsAutoClosed { get; set; } = 0; public string Phone { get; set; } = ""; public string PostalCode { get; set; } = ""; public string Country { get; set; } = ""; // 2 Letter Country Code diff --git a/src/Server/Services/DatabaseService/Company.cs b/src/Server/Services/DatabaseService/Company.cs index f8efbda..5aaad81 100644 --- a/src/Server/Services/DatabaseService/Company.cs +++ b/src/Server/Services/DatabaseService/Company.cs @@ -28,6 +28,8 @@ namespace BoredCareers.Services.DatabaseService { bool _emailVerified = reader.GetBoolean("EmailVerified"); string _websiteurl = reader.GetString("WebsiteURL"); string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]); + int _jobsclosedsuccessful = reader.GetInt32("JobsClosedSuccessful"); + int _jobsautoclosed = reader.GetInt32("JobsAutoClosed"); string _phone = reader.GetString( "Phone" ); string _postalcode = reader.GetString( "PostalCode" ); string _country = reader.GetString( "Country" ); @@ -42,6 +44,8 @@ namespace BoredCareers.Services.DatabaseService { EmailVerified = _emailVerified, WebsiteURL = _websiteurl, Logo = _logo, + JobsAutoClosed = _jobsautoclosed, + JobsClosedSuccessful = _jobsclosedsuccessful, Phone = _phone, PostalCode = _postalcode, Country = _country, @@ -60,15 +64,17 @@ namespace BoredCareers.Services.DatabaseService { await connection.OpenAsync(); string command = @" INSERT INTO Company - (ID,Name,Email,EmailVerified,WebsiteURL,Logo,Phone,PostalCode,Country,StateOrRegion,City,Description) + (ID,Name,Email,EmailVerified,WebsiteURL,Logo,JobsClosedSuccessful,JobsAutoClosed,Phone,PostalCode,Country,StateOrRegion,City,Description) VALUES - (@ID,@Name,@Email,@EmailVerified,@WebsiteURL,@Logo,@Phone,@PostalCode,@Country,@StateOrRegion,@City,@Description) + (@ID,@Name,@Email,@EmailVerified,@WebsiteURL,@Logo,@JobsClosedSuccessful,@JobsAutoClosed,@Phone,@PostalCode,@Country,@StateOrRegion,@City,@Description) ON DUPLICATE KEY UPDATE Name = @Name, Email = @Email, EmailVerified = @EmailVerified, WebsiteURL = @WebsiteURL, Logo = @Logo, + JobsClosedSuccessful = @JobsClosedSuccessful, + JobsAutoClosed = @JobsAutoClosed, Phone = @Phone, PostalCode = @PostalCode, Country = @Country, @@ -86,6 +92,8 @@ namespace BoredCareers.Services.DatabaseService { cmd.Parameters.AddWithValue("@EmailVerified", company.EmailVerified); cmd.Parameters.AddWithValue("@WebsiteURL", company.WebsiteURL); cmd.Parameters.AddWithValue("@Logo", Encoding.UTF8.GetBytes(company.Logo)); + cmd.Parameters.AddWithValue("@JobsClosedSuccessful", company.JobsClosedSuccessful); + cmd.Parameters.AddWithValue("@JobsAutoClosed", company.JobsAutoClosed); cmd.Parameters.AddWithValue("@Phone", company.Phone); cmd.Parameters.AddWithValue("@PostalCode", company.PostalCode); cmd.Parameters.AddWithValue("@Country", company.Country); diff --git a/src/Server/Services/TimerServcie/JobCleanupService.cs b/src/Server/Services/TimerServcie/JobCleanupService.cs index 5d492b6..01e75a1 100644 --- a/src/Server/Services/TimerServcie/JobCleanupService.cs +++ b/src/Server/Services/TimerServcie/JobCleanupService.cs @@ -17,7 +17,13 @@ namespace BoredCareers.Services.TimerService { foreach (JobListing listing in deletedJobListings) { // Get applicants for each closed listing // Notify applicants of the listing closing - // Mark company for auto-closed job -> ghost listing + + // Mark the company for the auto closed listing + Company? comp = await _db.GetCompany(listing.CompanyID); + if (comp != null) { + comp.JobsAutoClosed++; + await _db.SetCompany(comp); + } } } catch (Exception e) { Console.WriteLine($"Error: {e.Message}");