Start work for company rating

This commit is contained in:
2025-08-04 16:44:24 -07:00
parent 32c7d2647d
commit d167405ef1
6 changed files with 26 additions and 3 deletions
+3
View File
@@ -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
+2
View File
@@ -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,
+2
View File
@@ -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
+2
View File
@@ -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
+10 -2
View File
@@ -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);
@@ -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}");