From e92e4c329fd34f1075f2b0797c0b6b9d614c4a88 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Mon, 25 Aug 2025 17:31:49 -0700 Subject: [PATCH] Add Job Listing Skills to Job Listing --- ToDo.yaml | 3 ++- src/Client/src/app/models/Application.ts | 1 + src/Client/src/app/models/Company.ts | 1 + src/Client/src/app/models/Employee.ts | 1 + src/Client/src/app/models/JobListing.ts | 4 +++- .../jobs/editor/jobeditor.component.html | 21 +++++++++++++++++++ .../pages/jobs/editor/jobeditor.component.ts | 19 ++++++++++++++++- .../jobs/viewer/jobviewer.component.html | 10 +++++++++ .../pages/resumes/editor/editor.component.ts | 5 ----- .../Services/DatabaseService/JobListing.cs | 12 ++++++++++- .../DatabaseService/JobListingSkill.cs | 2 +- 11 files changed, 69 insertions(+), 10 deletions(-) diff --git a/ToDo.yaml b/ToDo.yaml index d0eb9cb..88a1556 100755 --- a/ToDo.yaml +++ b/ToDo.yaml @@ -12,9 +12,10 @@ Server: Need to update notification email Create page to notify cx that their work email has been verified + Verify that each resume section belongs to the resume it was created for: + Client: jobs/editor: - Job Listing Skills exists but isn't implimented in the UI Want to add completed job listing preview at end of carosel Resume: diff --git a/src/Client/src/app/models/Application.ts b/src/Client/src/app/models/Application.ts index 576fefd..73560f1 100644 --- a/src/Client/src/app/models/Application.ts +++ b/src/Client/src/app/models/Application.ts @@ -9,4 +9,5 @@ export class Application { public hasBeenViewed: boolean = false; public rating: number = 0; public notes: string = ""; + public trackUUID: string = crypto.randomUUID(); } \ No newline at end of file diff --git a/src/Client/src/app/models/Company.ts b/src/Client/src/app/models/Company.ts index a2e4a6a..1d34666 100644 --- a/src/Client/src/app/models/Company.ts +++ b/src/Client/src/app/models/Company.ts @@ -13,4 +13,5 @@ export class Company { public stateOrRegion: string = ""; public city: string = ""; public description: string = ""; + public trackUUID: string = crypto.randomUUID(); } \ No newline at end of file diff --git a/src/Client/src/app/models/Employee.ts b/src/Client/src/app/models/Employee.ts index b62a5ff..127bba2 100644 --- a/src/Client/src/app/models/Employee.ts +++ b/src/Client/src/app/models/Employee.ts @@ -6,4 +6,5 @@ export class Employee { public accountName: string = ""; public accountEmail: string = ""; public company: Company = new Company; + public trackUUID: string = crypto.randomUUID(); } \ No newline at end of file diff --git a/src/Client/src/app/models/JobListing.ts b/src/Client/src/app/models/JobListing.ts index ffd34e3..778d3b6 100644 --- a/src/Client/src/app/models/JobListing.ts +++ b/src/Client/src/app/models/JobListing.ts @@ -15,11 +15,13 @@ export class JobListing { public createdTime: Date = new Date(); public modifiedTime: Date = new Date(); public isDeleted: boolean = false; + public trackUUID: string = crypto.randomUUID(); } export class JobListingSkills { public id: number | null = null; public jobListingID: number = 0; public name: string = ""; - public Description: string = ""; + public description: string = ""; + public trackUUID: string = crypto.randomUUID(); } \ No newline at end of file diff --git a/src/Client/src/app/pages/jobs/editor/jobeditor.component.html b/src/Client/src/app/pages/jobs/editor/jobeditor.component.html index ef9f48e..93e47a4 100644 --- a/src/Client/src/app/pages/jobs/editor/jobeditor.component.html +++ b/src/Client/src/app/pages/jobs/editor/jobeditor.component.html @@ -91,6 +91,27 @@ + +
+
+
+ + +
+ @for(skill of Listing.skills; track skill.trackUUID){ +
+ + + +
+ } +
+ + +
+
+
+
diff --git a/src/Client/src/app/pages/jobs/editor/jobeditor.component.ts b/src/Client/src/app/pages/jobs/editor/jobeditor.component.ts index df01516..7a77aa3 100644 --- a/src/Client/src/app/pages/jobs/editor/jobeditor.component.ts +++ b/src/Client/src/app/pages/jobs/editor/jobeditor.component.ts @@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'; import { Router, ActivatedRoute, RouterModule } from '@angular/router'; import { Title } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; -import { JobListing } from 'app/models/JobListing'; +import { JobListing, JobListingSkills } from 'app/models/JobListing'; import { Authentication } from 'app/services/Authentication'; @Component({ @@ -51,6 +51,9 @@ export class JobEditorComponent { if (this.mode === "edit") { this.http.get("api/joblisting/" + JobID).subscribe({ next: data => { + data.skills.forEach(element => { + element.trackUUID = crypto.randomUUID(); + }); this.Listing = data; }, error: err => { @@ -80,6 +83,20 @@ export class JobEditorComponent { }); } + addSkill(){ + this.Listing.skills.push(new JobListingSkills); + } + + remSkill(self: JobListingSkills){ + for(let i=0; i{{ selectedJob.country }}

{{ selectedJob.postalCode }}

+
+

Required Skills

+ @for(skill of selectedJob.skills; track skill.trackUUID){ +
+

{{ skill.name }}

+

{{ skill.description }}

+
+ } +
+

{{ selectedJob.description }}

} diff --git a/src/Client/src/app/pages/resumes/editor/editor.component.ts b/src/Client/src/app/pages/resumes/editor/editor.component.ts index df4bdfc..0663fa5 100644 --- a/src/Client/src/app/pages/resumes/editor/editor.component.ts +++ b/src/Client/src/app/pages/resumes/editor/editor.component.ts @@ -75,11 +75,6 @@ export class ResumesEditorComponent { }); } - // Pagnation // - //////////////////////////////// - - //////////////////////////////// - SubmitForm(resume: Resume){ resume.accountID = this.auth.loggedInUser.id; this.http.post("api/resume", resume).subscribe({ diff --git a/src/Server/Services/DatabaseService/JobListing.cs b/src/Server/Services/DatabaseService/JobListing.cs index f23b28a..8dad416 100644 --- a/src/Server/Services/DatabaseService/JobListing.cs +++ b/src/Server/Services/DatabaseService/JobListing.cs @@ -228,6 +228,8 @@ namespace BoredCareers.Services.DatabaseService { Description = @Description, ModifiedTime = @ModifiedTime, IsDeleted = @IsDeleted; + + SELECT LAST_INSERT_ID(); "; MySqlCommand cmd = new MySqlCommand(command, connection); @@ -247,9 +249,17 @@ namespace BoredCareers.Services.DatabaseService { cmd.Parameters.AddWithValue("@ModifiedTime", DateTime.UtcNow); cmd.Parameters.AddWithValue("@IsDeleted", jobListing.IsDeleted); - await cmd.ExecuteNonQueryAsync(); + object? result = await cmd.ExecuteScalarAsync(); + int jobListingID = 0; + if (jobListing.ID != null && jobListing.ID != 0) { + jobListingID = Convert.ToInt32(jobListing.ID); + } else { + cmd.CommandText = ""; + jobListingID = Convert.ToInt32(result); + } foreach (JobListingSkill cur in jobListing.Skills) { + cur.JobListingID = jobListingID; await SetJobListingSkills(cur); } } diff --git a/src/Server/Services/DatabaseService/JobListingSkill.cs b/src/Server/Services/DatabaseService/JobListingSkill.cs index 953bc0b..3e20855 100644 --- a/src/Server/Services/DatabaseService/JobListingSkill.cs +++ b/src/Server/Services/DatabaseService/JobListingSkill.cs @@ -43,7 +43,7 @@ namespace BoredCareers.Services.DatabaseService { using( MySqlConnection connection = GetConnection() ) { await connection.OpenAsync(); string command = @" - INSERT INTO JobListing + INSERT INTO JobListingSkill (ID,JobListingID,Name,Description) VALUES (@ID,@JobListingID,@Name,@Description)