working #18

Merged
derek merged 19 commits from working into main 2025-08-04 21:16:01 -07:00
Showing only changes of commit 2d627733d7 - Show all commits
@@ -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();
@@ -297,7 +282,21 @@ namespace BoredCareers.Services.DatabaseService {
}
}
public async Task DeleteJobListing( int JobListingID ) {
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) {
using (MySqlConnection connection = GetConnection()) {
MySqlCommand cmd;
await connection.OpenAsync();