diff --git a/src/Server/Services/DatabaseService/JobListing.cs b/src/Server/Services/DatabaseService/JobListing.cs index 065088c..8ceedb8 100644 --- a/src/Server/Services/DatabaseService/JobListing.cs +++ b/src/Server/Services/DatabaseService/JobListing.cs @@ -232,20 +232,6 @@ namespace BoredCareers.Services.DatabaseService { return joblistings.ToArray(); } - public async Task DeleteJobListingsPastExipre() { - using (MySqlConnection connection = GetConnection()) { - await connection.OpenAsync(); - string command = @" - UPDATE JobListing - SET IsDeleted = TRUE - WHERE IsDeleted = FALSE - AND CreatedTime < NOW() - INTERVAL 1 MONTH; - "; - MySqlCommand cmd = new MySqlCommand(command, connection); - await cmd.ExecuteNonQueryAsync(); - } - } - public async Task SetJobListing(JobListing jobListing) { using (MySqlConnection connection = GetConnection()) { await connection.OpenAsync(); @@ -267,7 +253,6 @@ namespace BoredCareers.Services.DatabaseService { JobType = @JobType, Remote = @Remote, Description = @Description, - CreatedTime = @CreatedTime, ModifiedTime = @ModifiedTime, IsDeleted = @IsDeleted; "; @@ -285,8 +270,8 @@ namespace BoredCareers.Services.DatabaseService { cmd.Parameters.AddWithValue("@JobType", jobListing.JobType); cmd.Parameters.AddWithValue("@Remote", jobListing.Remote); cmd.Parameters.AddWithValue("@Description", jobListing.Description); - cmd.Parameters.AddWithValue("@CreatedTime", jobListing.CreatedTime.ToUniversalTime()); - cmd.Parameters.AddWithValue("@ModifiedTime", jobListing.ModifiedTime.ToUniversalTime()); + cmd.Parameters.AddWithValue("@CreatedTime", DateTime.UtcNow); + cmd.Parameters.AddWithValue("@ModifiedTime", DateTime.UtcNow); cmd.Parameters.AddWithValue("@IsDeleted", jobListing.IsDeleted); await cmd.ExecuteNonQueryAsync(); @@ -296,8 +281,22 @@ namespace BoredCareers.Services.DatabaseService { } } } + + public async Task DeleteJobListingsPastExipre() { + using (MySqlConnection connection = GetConnection()) { + await connection.OpenAsync(); + string command = @" + UPDATE JobListing + SET IsDeleted = TRUE + WHERE IsDeleted = FALSE + AND CreatedTime < NOW() - INTERVAL 1 MONTH; + "; + MySqlCommand cmd = new MySqlCommand(command, connection); + await cmd.ExecuteNonQueryAsync(); + } + } - public async Task DeleteJobListing( int JobListingID ) { + public async Task DeleteJobListing(int JobListingID) { using (MySqlConnection connection = GetConnection()) { MySqlCommand cmd; await connection.OpenAsync();