working #18

Merged
derek merged 19 commits from working into main 2025-08-04 21:16:01 -07:00
6 changed files with 26 additions and 3 deletions
Showing only changes of commit d167405ef1 - Show all commits
+3
View File
@@ -18,6 +18,9 @@ Server:
not closed successful jobs -> number not closed successful jobs -> number
For company rating for ghost listings For company rating for ghost listings
When Job Posting Closes Successful:
Update the company rating
Client: Client:
jobs/new: jobs/new:
Job Listing Skills exists but isn't implimented in the UI 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, `EmailVerified` boolean DEFAULT 0,
`WebsiteURL` varchar(255) DEFAULT NULL, `WebsiteURL` varchar(255) DEFAULT NULL,
`Logo` mediumblob DEFAULT NULL, `Logo` mediumblob DEFAULT NULL,
`JobsClosedSuccessful` int DEFAULT 0,
`JobsAutoClosed` int DEFAULT 0,
`Phone` varchar(20) DEFAULT NULL, `Phone` varchar(20) DEFAULT NULL,
`PostalCode` varchar(20) NOT NULL, `PostalCode` varchar(20) NOT NULL,
`Country` char(2) NOT NULL, `Country` char(2) NOT NULL,
+2
View File
@@ -5,6 +5,8 @@ export class Company {
public emailVerified: boolean = false; public emailVerified: boolean = false;
public websiteURL: string = ""; public websiteURL: string = "";
public logo: string = ""; public logo: string = "";
public jobsClosedSuccessful: number = 0;
public jobsAutoClosed: number = 0;
public phone: string = ""; public phone: string = "";
public postalCode: string = ""; public postalCode: string = "";
public country: string = ""; // 2 Letter Country Code public country: string = ""; // 2 Letter Country Code
+2
View File
@@ -7,6 +7,8 @@ namespace BoredCareers.Entities {
public bool EmailVerified { get; set; } = false; public bool EmailVerified { get; set; } = false;
public string WebsiteURL { get; set; } = ""; public string WebsiteURL { get; set; } = "";
public string Logo { 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 Phone { get; set; } = "";
public string PostalCode { get; set; } = ""; public string PostalCode { get; set; } = "";
public string Country { get; set; } = ""; // 2 Letter Country Code 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"); bool _emailVerified = reader.GetBoolean("EmailVerified");
string _websiteurl = reader.GetString("WebsiteURL"); string _websiteurl = reader.GetString("WebsiteURL");
string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]); string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]);
int _jobsclosedsuccessful = reader.GetInt32("JobsClosedSuccessful");
int _jobsautoclosed = reader.GetInt32("JobsAutoClosed");
string _phone = reader.GetString( "Phone" ); string _phone = reader.GetString( "Phone" );
string _postalcode = reader.GetString( "PostalCode" ); string _postalcode = reader.GetString( "PostalCode" );
string _country = reader.GetString( "Country" ); string _country = reader.GetString( "Country" );
@@ -42,6 +44,8 @@ namespace BoredCareers.Services.DatabaseService {
EmailVerified = _emailVerified, EmailVerified = _emailVerified,
WebsiteURL = _websiteurl, WebsiteURL = _websiteurl,
Logo = _logo, Logo = _logo,
JobsAutoClosed = _jobsautoclosed,
JobsClosedSuccessful = _jobsclosedsuccessful,
Phone = _phone, Phone = _phone,
PostalCode = _postalcode, PostalCode = _postalcode,
Country = _country, Country = _country,
@@ -60,15 +64,17 @@ namespace BoredCareers.Services.DatabaseService {
await connection.OpenAsync(); await connection.OpenAsync();
string command = @" string command = @"
INSERT INTO Company 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 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 ON DUPLICATE KEY UPDATE
Name = @Name, Name = @Name,
Email = @Email, Email = @Email,
EmailVerified = @EmailVerified, EmailVerified = @EmailVerified,
WebsiteURL = @WebsiteURL, WebsiteURL = @WebsiteURL,
Logo = @Logo, Logo = @Logo,
JobsClosedSuccessful = @JobsClosedSuccessful,
JobsAutoClosed = @JobsAutoClosed,
Phone = @Phone, Phone = @Phone,
PostalCode = @PostalCode, PostalCode = @PostalCode,
Country = @Country, Country = @Country,
@@ -86,6 +92,8 @@ namespace BoredCareers.Services.DatabaseService {
cmd.Parameters.AddWithValue("@EmailVerified", company.EmailVerified); cmd.Parameters.AddWithValue("@EmailVerified", company.EmailVerified);
cmd.Parameters.AddWithValue("@WebsiteURL", company.WebsiteURL); cmd.Parameters.AddWithValue("@WebsiteURL", company.WebsiteURL);
cmd.Parameters.AddWithValue("@Logo", Encoding.UTF8.GetBytes(company.Logo)); 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("@Phone", company.Phone);
cmd.Parameters.AddWithValue("@PostalCode", company.PostalCode); cmd.Parameters.AddWithValue("@PostalCode", company.PostalCode);
cmd.Parameters.AddWithValue("@Country", company.Country); cmd.Parameters.AddWithValue("@Country", company.Country);
@@ -17,7 +17,13 @@ namespace BoredCareers.Services.TimerService {
foreach (JobListing listing in deletedJobListings) { foreach (JobListing listing in deletedJobListings) {
// Get applicants for each closed listing // Get applicants for each closed listing
// Notify applicants of the listing closing // 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) { } catch (Exception e) {
Console.WriteLine($"Error: {e.Message}"); Console.WriteLine($"Error: {e.Message}");